-
Notifications
You must be signed in to change notification settings - Fork 273
Build cleanly without globally disabling warnings #873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
08feae5
to
db93002
Compare
Disabling warnings globally by setting 'Wno-deprecated-register' and 'Wno-sign-compare' in CXXFLAGS will silence these errors, even in new code. It's better to use `pragma`-based warning suppression, so that warnings are only disabled in locations that won't or can't be fixed. Likewise, rather than filtering 'Wpedantic' from CXXFLAGS when building some of the solvers, it's better to disable warnings just on the problematic headers.
This is ready for review now (@tautschnig?) |
Looking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this work. What I'd like to see a rationale for is the file-names-without-suffix choice. Furthermore I'm of course asking you to do even more work as those warnings have turned up actual bugs/useless checks.
index 501393d..b450b73 100644 | ||
--- a/minisat/core/Solver.cc | ||
+++ b/minisat/core/Solver.cc | ||
@@ -210,7 +210,7 @@ void Solver::cancelUntil(int level) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer for those changes to not be included (and similarly below), but also I'm not going to embark on bike shedding here.
scripts/minisat-2.2.1-patch
Outdated
unsigned has_extra : 1; | ||
unsigned reloced : 1; | ||
unsigned size : 27; } header; | ||
+#include <util/pragma_push> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the choice of not using a suffix in the file name.
src/ansi-c/expr2c.cpp
Outdated
assert(indent>=0); | ||
#include <util/pragma_pop> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That assert
should just be removed.
src/ansi-c/expr2c.cpp
Outdated
assert(indent>=0); | ||
#include <util/pragma_pop> // NOLINT(build/include) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the assert
instead.
src/ansi-c/library/jsa.h
Outdated
for(i=0; i < __CPROVER_JSA_MAX_ABSTRACT_NODES; ++i) | ||
#include <util/pragma_pop> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why we're getting a tautological-comparison warning here?
src/path-symex/locs.h
Outdated
assert(l.loc_number>=0 && l.loc_number<loc_vector.size()); | ||
#include <util/pragma_pop> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first condition in the assertion should be removed.
src/path-symex/locs.h
Outdated
assert(l.loc_number>=0 && l.loc_number<loc_vector.size()); | ||
#include <util/pragma_pop> // NOLINT(build/include) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
src/util/pragma_pop
Outdated
@@ -0,0 +1,7 @@ | |||
#if defined __clang__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason to use file names without suffix here?
Firstly, I agree that the asserts should be changed/removed. The patch file changed because I recreated it with git (I had to add some stuff around the zero length array), but if there's another way that results in fewer changes then I'll do that instead. The no-suffix thing is to differentiate the includes from normal headers or source files - where they don't include any declarations or definitions, it's a bit misleading to call them headers. I could give them some other extension though (.macro, .def or similar?) |
Thanks in advance!
I had figured that you had re-generated the patch using git; what I would have done is largely the same, except I'd then only selectively add the resulting changes to the commit using
I think using |
src/ansi-c/library/jsa.h
Outdated
for(i=0; i < __CPROVER_JSA_MAX_ABSTRACT_NODES; ++i) | ||
#include <util/pragma_pop.def> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having had another look at the code I do now seem to understand. For all cases in this file, could you please wrap the for
loop (and also the preceding declaration by #if __CPROVER_JSA_MAX_ABSTRACT_NODES > 0
- this will resolve the need for the pragma in those loops. (This is all due to cegis/jsa/value/jsa_genetic_synthesis.h.)
I've made the suggested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for all the fixes!
On Wed, 2017-04-26 at 09:29 -0700, Michael Tautschnig wrote:
<snip>
> @@ -1,7 +1,8 @@
-diff -urN minisat-2.2.1/minisat/core/Solver.cc minisat-2.2.1.patched/minisat/core/Solver.cc
---- minisat-2.2.1/minisat/core/Solver.cc 2011-02-21 13:31:17.000000000 +0000
-+++ minisat-2.2.1.patched/minisat/core/Solver.cc 2016-03-05 16:21:17.000000000 +0000
-@@ -210,7 +210,7 @@
+diff --git a/minisat/core/Solver.cc b/minisat/core/Solver.cc
+index 501393d..b450b73 100644
+--- a/minisat/core/Solver.cc
++++ b/minisat/core/Solver.cc
+@@ -210,7 +210,7 @@ void Solver::cancelUntil(int level) {
I'd prefer for those changes to not be included (and similarly below), but also I'm not going to embark on bike shedding here.
I would strongly recommend not changing MiniSAT code.
|
While I do agree in general, our patches primarily reduce the number of warnings. (And this particular additional change just adds pragmas.) Is that something to be concerned about? |
Dup of #873 targeting test-gen-support
Disabling warnings globally by setting 'Wno-deprecated-register' and 'Wno-sign-compare' in CXXFLAGS will silence these errors in all files, even in new code. It's better to use
pragma
-based warning suppression, so that warnings are only disabled in locations that won't or can't be fixed. Likewise, rather than filtering 'Wpedantic' from CXXFLAGS when building some of the solvers, it's better to disable warnings just on the problematic headers.The goal is to create a clean build using the flags
-Wall -Wpedantic -Werror
on all platforms, without having to disable any errors.