Skip to content

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

Merged
merged 4 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ matrix:
install:
- COMMAND="make -C src minisat2-download" &&
eval ${PRE_COMMAND} ${COMMAND}
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -O2 -g -Werror -Wno-deprecated-register -pedantic -Wno-sign-compare $EXTRA_CXXFLAGS\" -j2" &&
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
eval ${PRE_COMMAND} ${COMMAND}
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"$FLAGS $EXTRA_CXXFLAGS\" -j2 cegis.dir clobber.dir memory-models.dir musketeer.dir" &&
eval ${PRE_COMMAND} ${COMMAND}
Expand Down
101 changes: 60 additions & 41 deletions scripts/minisat-2.2.1-patch
Original file line number Diff line number Diff line change
@@ -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) {
Copy link
Collaborator

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.

for (int c = trail.size()-1; c >= trail_lim[level]; c--){
Var x = var(trail[c]);
assigns [x] = l_Undef;
Expand All @@ -10,7 +11,7 @@ diff -urN minisat-2.2.1/minisat/core/Solver.cc minisat-2.2.1.patched/minisat/cor
polarity[x] = sign(trail[c]);
insertVarOrder(x); }
qhead = trail_lim[level];
@@ -666,7 +666,7 @@
@@ -666,7 +666,7 @@ lbool Solver::search(int nof_conflicts)

}else{
// NO CONFLICT
Expand All @@ -19,10 +20,11 @@ diff -urN minisat-2.2.1/minisat/core/Solver.cc minisat-2.2.1.patched/minisat/cor
// Reached bound on number of conflicts:
progress_estimate = progressEstimate();
cancelUntil(0);
diff -urN minisat-2.2.1/minisat/core/SolverTypes.h minisat-2.2.1.patched/minisat/core/SolverTypes.h
--- minisat-2.2.1/minisat/core/SolverTypes.h 2011-02-21 13:31:17.000000000 +0000
+++ minisat-2.2.1.patched/minisat/core/SolverTypes.h 2016-03-05 16:29:42.000000000 +0000
@@ -47,7 +47,7 @@
diff --git a/minisat/core/SolverTypes.h b/minisat/core/SolverTypes.h
index 4757b20..c3fae2b 100644
--- a/minisat/core/SolverTypes.h
+++ b/minisat/core/SolverTypes.h
@@ -47,7 +47,7 @@ struct Lit {
int x;

// Use this as a constructor:
Expand All @@ -31,7 +33,7 @@ diff -urN minisat-2.2.1/minisat/core/SolverTypes.h minisat-2.2.1.patched/minisat

bool operator == (Lit p) const { return x == p.x; }
bool operator != (Lit p) const { return x != p.x; }
@@ -55,7 +55,7 @@
@@ -55,7 +55,7 @@ struct Lit {
};


Expand All @@ -40,7 +42,18 @@ diff -urN minisat-2.2.1/minisat/core/SolverTypes.h minisat-2.2.1.patched/minisat
inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; }
inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; }
inline bool sign (Lit p) { return p.x & 1; }
@@ -142,11 +142,12 @@
@@ -127,7 +127,10 @@ class Clause {
unsigned has_extra : 1;
unsigned reloced : 1;
unsigned size : 27; } header;
+#include <util/pragma_push>
Copy link
Collaborator

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.

+#include <util/pragma_wzero_length_array>
union { Lit lit; float act; uint32_t abs; CRef rel; } data[0];
+#include <util/pragma_pop>

friend class ClauseAllocator;

@@ -142,11 +145,12 @@ class Clause {
for (int i = 0; i < ps.size(); i++)
data[i].lit = ps[i];

Expand All @@ -54,7 +67,7 @@ diff -urN minisat-2.2.1/minisat/core/SolverTypes.h minisat-2.2.1.patched/minisat
}

// NOTE: This constructor cannot be used directly (doesn't allocate enough memory).
@@ -157,11 +158,12 @@
@@ -157,11 +161,12 @@ class Clause {
for (int i = 0; i < from.size(); i++)
data[i].lit = from[i];

Expand All @@ -68,10 +81,11 @@ diff -urN minisat-2.2.1/minisat/core/SolverTypes.h minisat-2.2.1.patched/minisat
}

public:
diff -urN minisat-2.2.1/minisat/mtl/IntTypes.h minisat-2.2.1.patched/minisat/mtl/IntTypes.h
--- minisat-2.2.1/minisat/mtl/IntTypes.h 2011-02-21 13:31:17.000000000 +0000
+++ minisat-2.2.1.patched/minisat/mtl/IntTypes.h 2016-03-05 16:21:17.000000000 +0000
@@ -31,7 +31,9 @@
diff --git a/minisat/mtl/IntTypes.h b/minisat/mtl/IntTypes.h
index c488162..e8e24bd 100644
--- a/minisat/mtl/IntTypes.h
+++ b/minisat/mtl/IntTypes.h
@@ -31,7 +31,9 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#else

# include <stdint.h>
Expand All @@ -81,10 +95,11 @@ diff -urN minisat-2.2.1/minisat/mtl/IntTypes.h minisat-2.2.1.patched/minisat/mtl

#endif

diff -urN minisat-2.2.1/minisat/mtl/Vec.h minisat-2.2.1.patched/minisat/mtl/Vec.h
--- minisat-2.2.1/minisat/mtl/Vec.h 2011-02-21 13:31:17.000000000 +0000
+++ minisat-2.2.1.patched/minisat/mtl/Vec.h 2016-03-05 16:21:17.000000000 +0000
@@ -96,7 +96,7 @@
diff --git a/minisat/mtl/Vec.h b/minisat/mtl/Vec.h
index b225911..d46e169 100644
--- a/minisat/mtl/Vec.h
+++ b/minisat/mtl/Vec.h
@@ -96,7 +96,7 @@ template<class T>
void vec<T>::capacity(int min_cap) {
if (cap >= min_cap) return;
int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2
Expand All @@ -93,10 +108,11 @@ diff -urN minisat-2.2.1/minisat/mtl/Vec.h minisat-2.2.1.patched/minisat/mtl/Vec.
throw OutOfMemoryException();
}

diff -urN minisat-2.2.1/minisat/simp/SimpSolver.cc minisat-2.2.1.patched/minisat/simp/SimpSolver.cc
--- minisat-2.2.1/minisat/simp/SimpSolver.cc 2011-02-21 13:31:17.000000000 +0000
+++ minisat-2.2.1.patched/minisat/simp/SimpSolver.cc 2016-03-05 16:21:17.000000000 +0000
@@ -130,8 +130,6 @@
diff --git a/minisat/simp/SimpSolver.cc b/minisat/simp/SimpSolver.cc
index 1d219a3..5ccdb67 100644
--- a/minisat/simp/SimpSolver.cc
+++ b/minisat/simp/SimpSolver.cc
@@ -130,8 +130,6 @@ lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp)
return result;
}

Expand All @@ -105,7 +121,7 @@ diff -urN minisat-2.2.1/minisat/simp/SimpSolver.cc minisat-2.2.1.patched/minisat
bool SimpSolver::addClause_(vec<Lit>& ps)
{
#ifndef NDEBUG
@@ -227,10 +225,12 @@
@@ -227,10 +225,12 @@ bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, vec<Lit>& ou
if (var(qs[i]) != v){
for (int j = 0; j < ps.size(); j++)
if (var(ps[j]) == var(qs[i]))
Expand All @@ -118,7 +134,7 @@ diff -urN minisat-2.2.1/minisat/simp/SimpSolver.cc minisat-2.2.1.patched/minisat
out_clause.push(qs[i]);
}
next:;
@@ -261,10 +261,12 @@
@@ -261,10 +261,12 @@ bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, int& size)
if (var(__qs[i]) != v){
for (int j = 0; j < ps.size(); j++)
if (var(__ps[j]) == var(__qs[i]))
Expand All @@ -131,10 +147,11 @@ diff -urN minisat-2.2.1/minisat/simp/SimpSolver.cc minisat-2.2.1.patched/minisat
size++;
}
next:;
diff -urN minisat-2.2.1/minisat/utils/Options.h minisat-2.2.1.patched/minisat/utils/Options.h
--- minisat-2.2.1/minisat/utils/Options.h 2011-02-21 13:31:17.000000000 +0000
+++ minisat-2.2.1.patched/minisat/utils/Options.h 2016-03-05 16:21:17.000000000 +0000
@@ -60,7 +60,7 @@
diff --git a/minisat/utils/Options.h b/minisat/utils/Options.h
index 2dba10f..7d2e83a 100644
--- a/minisat/utils/Options.h
+++ b/minisat/utils/Options.h
@@ -60,7 +60,7 @@ class Option
struct OptionLt {
bool operator()(const Option* x, const Option* y) {
int test1 = strcmp(x->category, y->category);
Expand All @@ -143,7 +160,7 @@ diff -urN minisat-2.2.1/minisat/utils/Options.h minisat-2.2.1.patched/minisat/ut
}
};

@@ -282,15 +282,15 @@
@@ -282,15 +282,15 @@ class Int64Option : public Option
if (range.begin == INT64_MIN)
fprintf(stderr, "imin");
else
Expand All @@ -162,10 +179,11 @@ diff -urN minisat-2.2.1/minisat/utils/Options.h minisat-2.2.1.patched/minisat/ut
if (verbose){
fprintf(stderr, "\n %s\n", description);
fprintf(stderr, "\n");
diff -urN minisat-2.2.1/minisat/utils/ParseUtils.h minisat-2.2.1.patched/minisat/utils/ParseUtils.h
--- minisat-2.2.1/minisat/utils/ParseUtils.h 2011-02-21 13:31:17.000000000 +0000
+++ minisat-2.2.1.patched/minisat/utils/ParseUtils.h 2016-03-05 16:21:17.000000000 +0000
@@ -24,7 +24,7 @@
diff --git a/minisat/utils/ParseUtils.h b/minisat/utils/ParseUtils.h
index d307164..7b46f09 100644
--- a/minisat/utils/ParseUtils.h
+++ b/minisat/utils/ParseUtils.h
@@ -24,7 +24,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include <stdlib.h>
#include <stdio.h>

Expand All @@ -174,7 +192,7 @@ diff -urN minisat-2.2.1/minisat/utils/ParseUtils.h minisat-2.2.1.patched/minisat

namespace Minisat {

@@ -35,7 +35,7 @@
@@ -35,7 +35,7 @@ static const int buffer_size = 1048576;


class StreamBuffer {
Expand All @@ -183,7 +201,7 @@ diff -urN minisat-2.2.1/minisat/utils/ParseUtils.h minisat-2.2.1.patched/minisat
unsigned char buf[buffer_size];
int pos;
int size;
@@ -43,10 +43,10 @@
@@ -43,10 +43,10 @@ class StreamBuffer {
void assureLookahead() {
if (pos >= size) {
pos = 0;
Expand All @@ -196,10 +214,11 @@ diff -urN minisat-2.2.1/minisat/utils/ParseUtils.h minisat-2.2.1.patched/minisat

int operator * () const { return (pos >= size) ? EOF : buf[pos]; }
void operator ++ () { pos++; assureLookahead(); }
diff -urN minisat-2.2.1/minisat/utils/System.h minisat-2.2.1.patched/minisat/utils/System.h
--- minisat-2.2.1/minisat/utils/System.h 2017-02-21 18:23:22.727464369 +0000
+++ minisat-2.2.1.patched/minisat/utils/System.h 2017-02-21 18:23:14.451343361 +0000
@@ -21,7 +21,7 @@
diff --git a/minisat/utils/System.h b/minisat/utils/System.h
index 9cbbc51..27b9700 100644
--- a/minisat/utils/System.h
+++ b/minisat/utils/System.h
@@ -21,7 +21,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#ifndef Minisat_System_h
#define Minisat_System_h

Expand Down
6 changes: 6 additions & 0 deletions src/ansi-c/expr2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3618,7 +3618,10 @@ std::string expr2ct::convert_code_block(
const code_blockt &src,
unsigned indent)
{
#include <util/pragma_push>
#include <util/pragma_wtautological_compare>
assert(indent>=0);
#include <util/pragma_pop>
Copy link
Collaborator

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.

std::string dest=indent_str(indent);
dest+="{\n";

Expand Down Expand Up @@ -3654,7 +3657,10 @@ std::string expr2ct::convert_code_decl_block(
const codet &src,
unsigned indent)
{
#include <util/pragma_push> // NOLINT(build/include)
#include <util/pragma_wtautological_compare> // NOLINT(build/include)
assert(indent>=0);
#include <util/pragma_pop> // NOLINT(build/include)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the assert instead.

std::string dest;

forall_operands(it, src)
Expand Down
15 changes: 15 additions & 0 deletions src/ansi-c/library/jsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ __CPROVER_jsa_inline _Bool __CPROVER_jsa__internal_are_heaps_equal(
const __CPROVER_jsa_abstract_heapt *const rhs)
{
__CPROVER_jsa__internal_index_t i;
#include <util/pragma_push>
#include <util/pragma_wtautological_compare>
for(i=0; i < __CPROVER_JSA_MAX_ABSTRACT_NODES; ++i)
#include <util/pragma_pop>
Copy link
Collaborator

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?

{
const __CPROVER_jsa_abstract_nodet lhs_node=lhs->abstract_nodes[i];
const __CPROVER_jsa_abstract_nodet rhs_node=rhs->abstract_nodes[i];
Expand All @@ -198,7 +201,10 @@ __CPROVER_jsa_inline _Bool __CPROVER_jsa__internal_are_heaps_equal(
lhs_node.value_ref!=rhs_node.value_ref)
return false;
}
#include <util/pragma_push> // NOLINT(build/include)
#include <util/pragma_wtautological_compare> // NOLINT(build/include)
for(i=0; i < __CPROVER_JSA_MAX_ABSTRACT_RANGES; ++i)
#include <util/pragma_pop> // NOLINT(build/include)
{
const __CPROVER_jsa_abstract_ranget lhs_range=lhs->abstract_ranges[i];
const __CPROVER_jsa_abstract_ranget rhs_range=rhs->abstract_ranges[i];
Expand Down Expand Up @@ -592,9 +598,12 @@ __CPROVER_jsa_inline void __CPROVER_jsa_assume_valid_heap(
__CPROVER_jsa__internal_assume_linking_correct(h, cnode, prev, nxt);
}
}
#include <util/pragma_push> // NOLINT(build/include)
#include <util/pragma_wtautological_compare> // NOLINT(build/include)
for(__CPROVER_jsa__internal_index_t anode=0;
anode<__CPROVER_JSA_MAX_ABSTRACT_NODES;
++anode)
#include <util/pragma_pop> // NOLINT(build/include)
{
const __CPROVER_jsa_id_t nxt=h->abstract_nodes[anode].next;
__CPROVER_jsa_assume(__CPROVER_jsa__internal_is_valid_node_id(nxt));
Expand All @@ -604,9 +613,12 @@ __CPROVER_jsa_inline void __CPROVER_jsa_assume_valid_heap(
__CPROVER_jsa__internal_get_abstract_node_id(anode);
__CPROVER_jsa__internal_assume_linking_correct(h, nid, prev, nxt);
}
#include <util/pragma_push> // NOLINT(build/include)
#include <util/pragma_wtautological_compare> // NOLINT(build/include)
for(__CPROVER_jsa__internal_index_t range=0;
range<__CPROVER_JSA_MAX_ABSTRACT_RANGES;
++range)
#include <util/pragma_pop> // NOLINT(build/include)
{
const __CPROVER_jsa_abstract_ranget r=h->abstract_ranges[range];
__CPROVER_jsa_assume(r.size >= 1);
Expand Down Expand Up @@ -653,9 +665,12 @@ __CPROVER_jsa_inline void __CPROVER_jsa_assume_valid_heap(
++cnodec)
if(h->concrete_nodes[cnodec].list == listc)
++count;
#include <util/pragma_push> // NOLINT(build/include)
#include <util/pragma_wtautological_compare> // NOLINT(build/include)
for(__CPROVER_jsa__internal_index_t anodec=0;
anodec<__CPROVER_JSA_MAX_ABSTRACT_NODES;
++anodec)
#include <util/pragma_pop> // NOLINT(build/include)
if(h->abstract_nodes[anodec].list==listc)
++count;
__CPROVER_jsa_assume(count<=__CPROVER_JSA_MAX_NODES_PER_CE_LIST);
Expand Down
4 changes: 4 additions & 0 deletions src/ansi-c/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ int cpp_operator(int token)
}
}

#include <util/pragma_wsign_compare>
#include <util/pragma_wnull_conversion>
#include <util/pragma_wdeprecated_register>

/*** macros for easier rule definition **********************************/
%}

Expand Down
4 changes: 4 additions & 0 deletions src/assembler/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ static int isatty(int) { return 0; }

#include "assembler_parser.h"

#include <util/pragma_wsign_compare>
#include <util/pragma_wnull_conversion>
#include <util/pragma_wdeprecated_register>

/*** macros for easier rule definition **********************************/
%}

Expand Down
4 changes: 4 additions & 0 deletions src/jsil/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ static int make_identifier()
return TOK_IDENTIFIER;
}

#include <util/pragma_wsign_compare>
#include <util/pragma_wnull_conversion>
#include <util/pragma_wdeprecated_register>

%}

delimiter [ \t\b\r]
Expand Down
5 changes: 5 additions & 0 deletions src/json/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ static int isatty(int) { return 0; }

#include "json_parser.h"
#include "json_y.tab.h"

#include <util/pragma_wsign_compare>
#include <util/pragma_wnull_conversion>
#include <util/pragma_wdeprecated_register>

%}

string \"\"|\"{chars}\"
Expand Down
4 changes: 4 additions & 0 deletions src/memory-models/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ static int isatty(int) { return 0; }

unsigned comment_nesting;

#include <util/pragma_wsign_compare>
#include <util/pragma_wnull_conversion>
#include <util/pragma_wdeprecated_register>

%}

%x GRAMMAR
Expand Down
6 changes: 6 additions & 0 deletions src/path-symex/locs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ class locst

loct &operator[] (loc_reft l)
{
#include <util/pragma_push>
#include <util/pragma_wtautological_compare>
assert(l.loc_number>=0 && l.loc_number<loc_vector.size());
#include <util/pragma_pop>
Copy link
Collaborator

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.

return loc_vector[l.loc_number];
}

const loct &operator[] (loc_reft l) const
{
#include <util/pragma_push> // NOLINT(build/include)
#include <util/pragma_wtautological_compare> // NOLINT(build/include)
assert(l.loc_number>=0 && l.loc_number<loc_vector.size());
#include <util/pragma_pop> // NOLINT(build/include)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

return loc_vector[l.loc_number];
}

Expand Down
Loading