Skip to content

Commit

Permalink
Some warning for gcc and msvc removed
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/tack/GecodeGitMigration/gecode-svn-mirror/gecode/trunk@14471 e85b7adc-8362-4630-8c63-7469d557c915
  • Loading branch information
Christian Schulte committed Mar 20, 2015
1 parent 53e0b7f commit 23f8e16
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 47 deletions.
4 changes: 2 additions & 2 deletions examples/crossword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Crossword : public Script {
}
}
/// Print brancher information when branching on letters
static void printletters(const Space& home, const BrancherHandle& bh,
static void printletters(const Space& home, const BrancherHandle&,
unsigned int a,
IntVar, int i, const int& n,
std::ostream& o) {
Expand All @@ -175,7 +175,7 @@ class Crossword : public Script {
<< static_cast<char>(n);
}
/// Print brancher information when branching on words
static void printwords(const Space&, const BrancherHandle& bh,
static void printwords(const Space&, const BrancherHandle&,
unsigned int a,
IntVar, int i, const int& n,
std::ostream& o) {
Expand Down
2 changes: 1 addition & 1 deletion gecode/int/arithmetic/argmax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace Gecode { namespace Int { namespace Arithmetic {
}
x.size(j);

if (n == y.size())
if (static_cast<unsigned int>(n) == y.size())
return ES_FAILED;
Iter::Values::Array id(d,n);
GECODE_ME_CHECK(y.minus_v(home,id,false));
Expand Down
4 changes: 2 additions & 2 deletions gecode/int/bin-packing/conflict-graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
return ES_FAILED;
}
// Compute corresponding variables
ViewArray<IntView> bv(home,cur.c);
ViewArray<IntView> bv(home,static_cast<int>(cur.c));
int i=0;
for (Nodes c(cur.n); c() < nodes(); ++c)
bv[i++] = b[c()];
Expand Down Expand Up @@ -337,7 +337,7 @@ namespace Gecode { namespace Int { namespace BinPacking {
for (Nodes i(max.n); i() < nodes(); ++i)
n[j++]=i();
assert(j == static_cast<int>(max.c));
IntSet s(n,max.c);
IntSet s(n,static_cast<int>(max.c));
return s;
}

Expand Down
12 changes: 6 additions & 6 deletions gecode/int/cumulative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace Gecode {
fixp = false; break;
}
int nonOptionals = 0;
for (unsigned int i=u.size(); i--;)
for (int i=u.size(); i--;)
if (u[i]>0) nonOptionals++;
if (fixp) {
TaskArray<ManFixPTask> tasks(home,nonOptionals);
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace Gecode {
fixp = false; break;
}
int nonOptionals = 0;
for (unsigned int i=u.size(); i--;)
for (int i=u.size(); i--;)
if (u[i]>0) nonOptionals++;
if (fixp) {
TaskArray<OptFixPTask> tasks(home,nonOptionals);
Expand Down Expand Up @@ -236,7 +236,7 @@ namespace Gecode {
unary(home,s,p,icl);
} else {
int nonOptionals = 0;
for (unsigned int i=u.size(); i--;)
for (int i=u.size(); i--;)
if (u[i]>0) nonOptionals++;
TaskArray<ManFixPTask> t(home,nonOptionals);
int cur = 0;
Expand Down Expand Up @@ -294,7 +294,7 @@ namespace Gecode {
cumulative(home,c,s,p,u,icl);
} else {
int nonOptionals = 0;
for (unsigned int i=u.size(); i--;)
for (int i=u.size(); i--;)
if (u[i]>0) nonOptionals++;
TaskArray<OptFixPTask> t(home,nonOptionals);
int cur = 0;
Expand Down Expand Up @@ -358,7 +358,7 @@ namespace Gecode {
cumulative(home,c,s,pp,u,icl);
} else {
int nonOptionals = 0;
for (unsigned int i=u.size(); i--;)
for (int i=u.size(); i--;)
if (u[i]>0) nonOptionals++;
TaskArray<ManFlexTask> t(home,nonOptionals);
int cur = 0;
Expand Down Expand Up @@ -421,7 +421,7 @@ namespace Gecode {
cumulative(home,c,s,p,e,u,icl);
} else {
int nonOptionals = 0;
for (unsigned int i=u.size(); i--;)
for (int i=u.size(); i--;)
if (u[i]>0) nonOptionals++;
TaskArray<OptFlexTask> t(home,nonOptionals);
int cur = 0;
Expand Down
2 changes: 1 addition & 1 deletion gecode/kernel/brancher-view-val.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace Gecode {
}

template<class View, int n, class Val, unsigned int a>
forceinline BrancherHandle
inline BrancherHandle
ViewValBrancher<View,n,Val,a>::
post(Home home, ViewArray<View>& x,
ViewSel<View>* vs[n], ValSelCommitBase<View,Val>* vsc,
Expand Down
1 change: 1 addition & 0 deletions gecode/kernel/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3858,6 +3858,7 @@ namespace Gecode {
case ES_NOFIX_FORCE:
schedule(home,p,me,true);
break;
case __ES_SUBSUMED:
default:
GECODE_NEVER;
}
Expand Down
2 changes: 1 addition & 1 deletion gecode/minimodel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ namespace Gecode {
values(Home home, const IntVarArgs& x, IntSet y,
IntConLevel icl=ICL_DEF) {
dom(home,x,y,icl);
nvalues(home,x,IRT_EQ,y.size(),icl);
nvalues(home,x,IRT_EQ,static_cast<int>(y.size()),icl);
}

//@}
Expand Down
3 changes: 3 additions & 0 deletions gecode/minimodel/set-expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ namespace Gecode {
case SRT_CMPL:
invsrt = srt;
break;
default:
invsrt = srt;
GECODE_NEVER;
}
dom(home, s, invsrt, ss, b);
}
Expand Down
4 changes: 2 additions & 2 deletions gecode/search/cutoff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ namespace Gecode { namespace Search {

unsigned long int
CutoffGeometric::operator ()(void) const {
return scale * n;
return static_cast<unsigned long int>(scale * n);
}
unsigned long int
CutoffGeometric::operator ++(void) {
n *= base;
return scale * n;
return static_cast<unsigned long int>(scale * n);
}


Expand Down
2 changes: 1 addition & 1 deletion gecode/search/meta/nogoods.hh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace Gecode { namespace Search { namespace Meta {
forceinline ExecStatus
NoGoodsProp::post(Space& home, const Path& p) {
int s = 0;
int n = std::min(p.ds.entries(),p.ngdl());
int n = std::min(p.ds.entries(),static_cast<int>(p.ngdl()));

unsigned long int n_nogood = 0;

Expand Down
7 changes: 4 additions & 3 deletions gecode/search/parallel/bab.hh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace Gecode { namespace Search { namespace Parallel {
/// Try to find some work
void find(void);
/// Reset engine to restart at space \a s
void reset(Space* s, int ngdl);
void reset(Space* s, unsigned int ngdl);
/// Destructor
virtual ~Worker(void);
};
Expand Down Expand Up @@ -112,12 +112,13 @@ namespace Gecode { namespace Search { namespace Parallel {
}

forceinline void
BAB::Worker::reset(Space* s, int ngdl) {
BAB::Worker::reset(Space* s, unsigned int ngdl) {
delete cur;
delete best;
best = NULL;
path.reset((s == NULL) ? 0 : ngdl);
d = mark = 0;
d = 0;
mark = 0;
idle = false;
if ((s == NULL) || (s->status(*this) == SS_FAILED)) {
delete s;
Expand Down
4 changes: 2 additions & 2 deletions gecode/search/parallel/dfs.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace Gecode { namespace Search { namespace Parallel {
/// Try to find some work
void find(void);
/// Reset worker to restart at space \a s
void reset(Space* s, int ngdl);
void reset(Space* s, unsigned int ngdl);
};
/// Array of worker references
Worker** _worker;
Expand Down Expand Up @@ -128,7 +128,7 @@ namespace Gecode { namespace Search { namespace Parallel {
* Reset
*/
forceinline void
DFS::Worker::reset(Space* s, int ngdl) {
DFS::Worker::reset(Space* s, unsigned int ngdl) {
delete cur;
path.reset((s != NULL) ? ngdl : 0);
d = 0;
Expand Down
2 changes: 1 addition & 1 deletion gecode/search/parallel/engine.hh
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ namespace Gecode { namespace Search { namespace Parallel {
forceinline
Engine::Worker::Worker(Space* s, Engine& e)
: _engine(e),
path(s == NULL ? 0 : static_cast<int>(e.opt().nogoods_limit)), d(0),
path(s == NULL ? 0 : e.opt().nogoods_limit), d(0),
idle(false) {
if (s != NULL) {
if (s->status(*this) == SS_FAILED) {
Expand Down
24 changes: 12 additions & 12 deletions gecode/search/parallel/path.hh
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ namespace Gecode { namespace Search { namespace Parallel {
/// Stack to store edge information
Support::DynamicStack<Edge,Heap> ds;
/// Depth limit for no-good generation
int _ngdl;
unsigned int _ngdl;
/// Number of edges that have work for stealing
unsigned int n_work;
public:
/// Initialize with no-good depth limit \a l
Path(int l);
Path(unsigned int l);
/// Return no-good depth limit
int ngdl(void) const;
unsigned int ngdl(void) const;
/// Set no-good depth limit to \a l
void ngdl(int l);
void ngdl(unsigned int l);
/// Push space \a c (a clone of \a s or NULL)
const Choice* push(Worker& stat, Space* s, Space* c);
/// Generate path for next node
Expand All @@ -140,7 +140,7 @@ namespace Gecode { namespace Search { namespace Parallel {
/// Return number of entries on stack
int entries(void) const;
/// Reset stack and set no-good depth limit to \a l
void reset(int l);
void reset(unsigned int l);
/// Make a quick check whether stealing might be feasible
bool steal(void) const;
/// Steal work at depth \a d
Expand Down Expand Up @@ -222,16 +222,16 @@ namespace Gecode { namespace Search { namespace Parallel {
*/

forceinline
Path::Path(int l)
Path::Path(unsigned int l)
: ds(heap), _ngdl(l), n_work(0) {}

forceinline int
forceinline unsigned int
Path::ngdl(void) const {
return _ngdl;
}

forceinline void
Path::ngdl(int l) {
Path::ngdl(unsigned int l) {
_ngdl = l;
}

Expand Down Expand Up @@ -306,7 +306,7 @@ namespace Gecode { namespace Search { namespace Parallel {
}

forceinline void
Path::reset(int l) {
Path::reset(unsigned int l) {
n_work = 0;
while (!ds.empty())
ds.pop().dispose();
Expand Down Expand Up @@ -340,7 +340,7 @@ namespace Gecode { namespace Search { namespace Parallel {
if (!ds[n].work())
n_work--;
// No no-goods can be extracted above n
ngdl(std::min(ngdl(),n));
ngdl(std::min(ngdl(),static_cast<unsigned int>(n)));
d = stat.steal_depth(static_cast<unsigned long int>(n+1));
return c;
}
Expand All @@ -362,7 +362,7 @@ namespace Gecode { namespace Search { namespace Parallel {
assert(ds.entries()-1 == lc());
ds.top().space(NULL);
// Mark as reusable
if (ds.entries() > ngdl())
if (static_cast<unsigned int>(ds.entries()) > ngdl())
ds.top().next();
d = 0;
return s;
Expand Down Expand Up @@ -431,7 +431,7 @@ namespace Gecode { namespace Search { namespace Parallel {
}
ds.top().space(NULL);
// Mark as reusable
if (ds.entries() > ngdl())
if (static_cast<unsigned int>(ds.entries()) > ngdl())
ds.top().next();
d = 0;
return s;
Expand Down
6 changes: 3 additions & 3 deletions gecode/search/sequential/bab.hh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ namespace Gecode { namespace Search { namespace Sequential {

forceinline
BAB::BAB(Space* s, const Options& o)
: opt(o), path(static_cast<int>(opt.nogoods_limit)),
d(0), mark(0), best(NULL) {
: opt(o), path(opt.nogoods_limit), d(0), mark(0), best(NULL) {
if ((s == NULL) || (s->status(*this) == SS_FAILED)) {
fail++;
cur = NULL;
Expand Down Expand Up @@ -173,7 +172,8 @@ namespace Gecode { namespace Search { namespace Sequential {
delete best;
best = NULL;
path.reset();
d = mark = 0U;
d = 0;
mark = 0;
delete cur;
if ((s == NULL) || (s->status(*this) == SS_FAILED)) {
delete s;
Expand Down
2 changes: 1 addition & 1 deletion gecode/search/sequential/dfs.hh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace Gecode { namespace Search { namespace Sequential {

forceinline
DFS::DFS(Space* s, const Options& o)
: opt(o), path(static_cast<int>(opt.nogoods_limit)), d(0) {
: opt(o), path(opt.nogoods_limit), d(0) {
if ((s == NULL) || (s->status(*this) == SS_FAILED)) {
fail++;
cur = NULL;
Expand Down
18 changes: 9 additions & 9 deletions gecode/search/sequential/path.hh
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ namespace Gecode { namespace Search { namespace Sequential {
/// Stack to store edge information
Support::DynamicStack<Edge,Heap> ds;
/// Depth limit for no-good generation
int _ngdl;
unsigned int _ngdl;
public:
/// Initialize with no-good depth limit \a l
Path(int l);
Path(unsigned int l);
/// Return no-good depth limit
int ngdl(void) const;
unsigned int ngdl(void) const;
/// Set no-good depth limit to \a l
void ngdl(int l);
void ngdl(unsigned int l);
/// Push space \a c (a clone of \a s or NULL)
const Choice* push(Worker& stat, Space* s, Space* c);
/// Generate path for next node
Expand Down Expand Up @@ -205,16 +205,16 @@ namespace Gecode { namespace Search { namespace Sequential {
*/

forceinline
Path::Path(int l)
Path::Path(unsigned int l)
: ds(heap), _ngdl(l) {}

forceinline int
forceinline unsigned int
Path::ngdl(void) const {
return _ngdl;
}

forceinline void
Path::ngdl(int l) {
Path::ngdl(unsigned int l) {
_ngdl = l;
}

Expand Down Expand Up @@ -299,7 +299,7 @@ namespace Gecode { namespace Search { namespace Sequential {
assert(ds.entries()-1 == lc());
ds.top().space(NULL);
// Mark as reusable
if (ds.entries() > ngdl())
if (static_cast<unsigned int>(ds.entries()) > ngdl())
ds.top().next();
d = 0;
return s;
Expand Down Expand Up @@ -368,7 +368,7 @@ namespace Gecode { namespace Search { namespace Sequential {
}
ds.top().space(NULL);
// Mark as reusable
if (ds.entries() > ngdl())
if (static_cast<unsigned int>(ds.entries()) > ngdl())
ds.top().next();
d = 0;
return s;
Expand Down

0 comments on commit 23f8e16

Please sign in to comment.