Skip to content

Commit

Permalink
Compile with -permissive- on MSVC (issue #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
chschulte committed Dec 21, 2018
1 parent 5c60e81 commit 843667a
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 35 deletions.
9 changes: 9 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ Thanks: Jip J. Dekker
[DESCRIPTION]
Added installation target to the CMake configuration.

[ENTRY]
Module: other
What: change
Rank: minor
[DESCRIPTION]
Fix compilation problems with the Microsoft Visual Studio IDE
which uses -permissive- as default, rather than -permissive as
cl.exe does.

[ENTRY]
Module: kernel
What: new
Expand Down
29 changes: 18 additions & 11 deletions gecode/int/branch/merit.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ namespace Gecode { namespace Int { namespace Branch {
// Minimum merit
template<class View>
forceinline
MeritMin<View>::MeritMin(Space& home, const VarBranch<Var>& vb)
MeritMin<View>::MeritMin
(Space& home, const VarBranch<MeritMin<View>::Var>& vb)
: MeritBase<View,int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -51,7 +52,8 @@ namespace Gecode { namespace Int { namespace Branch {
// Maximum merit
template<class View>
forceinline
MeritMax<View>::MeritMax(Space& home, const VarBranch<Var>& vb)
MeritMax<View>::MeritMax
(Space& home, const VarBranch<MeritMax<View>::Var>& vb)
: MeritBase<View,int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -66,7 +68,8 @@ namespace Gecode { namespace Int { namespace Branch {
// Size merit
template<class View>
forceinline
MeritSize<View>::MeritSize(Space& home, const VarBranch<Var>& vb)
MeritSize<View>::MeritSize
(Space& home, const VarBranch<MeritSize<View>::Var>& vb)
: MeritBase<View,unsigned int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -81,7 +84,8 @@ namespace Gecode { namespace Int { namespace Branch {
// Degree over size merit
template<class View>
forceinline
MeritDegreeSize<View>::MeritDegreeSize(Space& home, const VarBranch<Var>& vb)
MeritDegreeSize<View>::MeritDegreeSize
(Space& home, const VarBranch<MeritDegreeSize<View>::Var>& vb)
: MeritBase<View,double>(home,vb) {}
template<class View>
forceinline
Expand All @@ -96,7 +100,8 @@ namespace Gecode { namespace Int { namespace Branch {
// AFC over size merit
template<class View>
forceinline
MeritAFCSize<View>::MeritAFCSize(Space& home, const VarBranch<Var>& vb)
MeritAFCSize<View>::MeritAFCSize
(Space& home, const VarBranch<MeritAFCSize<View>::Var>& vb)
: MeritBase<View,double>(home,vb), afc(vb.afc()) {}
template<class View>
forceinline
Expand All @@ -122,8 +127,8 @@ namespace Gecode { namespace Int { namespace Branch {
// Action over size merit
template<class View>
forceinline
MeritActionSize<View>::MeritActionSize(Space& home,
const VarBranch<Var>& vb)
MeritActionSize<View>::MeritActionSize
(Space& home, const VarBranch<MeritActionSize<View>::Var>& vb)
: MeritBase<View,double>(home,vb), action(vb.action()) {}
template<class View>
forceinline
Expand All @@ -148,8 +153,8 @@ namespace Gecode { namespace Int { namespace Branch {
// CHB over size merit
template<class View>
forceinline
MeritCHBSize<View>::MeritCHBSize(Space& home,
const VarBranch<Var>& vb)
MeritCHBSize<View>::MeritCHBSize
(Space& home, const VarBranch<MeritCHBSize<View>::Var>& vb)
: MeritBase<View,double>(home,vb), chb(vb.chb()) {}
template<class View>
forceinline
Expand All @@ -174,7 +179,8 @@ namespace Gecode { namespace Int { namespace Branch {
// Minimum regret merit
template<class View>
forceinline
MeritRegretMin<View>::MeritRegretMin(Space& home, const VarBranch<Var>& vb)
MeritRegretMin<View>::MeritRegretMin
(Space& home, const VarBranch<MeritRegretMin<View>::Var>& vb)
: MeritBase<View,unsigned int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -189,7 +195,8 @@ namespace Gecode { namespace Int { namespace Branch {
// Maximum regret merit
template<class View>
forceinline
MeritRegretMax<View>::MeritRegretMax(Space& home, const VarBranch<Var>& vb)
MeritRegretMax<View>::MeritRegretMax
(Space& home, const VarBranch<MeritRegretMax<View>::Var>& vb)
: MeritBase<View,unsigned int>(home,vb) {}
template<class View>
forceinline
Expand Down
12 changes: 8 additions & 4 deletions gecode/int/branch/val-commit.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValCommitEq<View>::ValCommitEq(Space& home, const ValBranch<Var>& vb)
ValCommitEq<View>::ValCommitEq
(Space& home, const ValBranch<ValCommitEq<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
Expand Down Expand Up @@ -64,7 +65,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValCommitLq<View>::ValCommitLq(Space& home, const ValBranch<Var>& vb)
ValCommitLq<View>::ValCommitLq
(Space& home, const ValBranch<ValCommitLq<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
Expand Down Expand Up @@ -93,7 +95,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValCommitGq<View>::ValCommitGq(Space& home, const ValBranch<Var>& vb)
ValCommitGq<View>::ValCommitGq
(Space& home, const ValBranch<ValCommitGq<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
Expand Down Expand Up @@ -122,7 +125,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValCommitGr<View>::ValCommitGr(Space& home, const ValBranch<Var>& vb)
ValCommitGr<View>::ValCommitGr
(Space& home, const ValBranch<ValCommitGr<View>::Var>& vb)
: ValCommit<View,int>(home,vb) {}
template<class View>
forceinline
Expand Down
18 changes: 12 additions & 6 deletions gecode/int/branch/val-sel.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValSelMin<View>::ValSelMin(Space& home, const ValBranch<Var>& vb)
ValSelMin<View>::ValSelMin
(Space& home, const ValBranch<ValSelMin<View>::Var>& vb)
: ValSel<View,int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -49,7 +50,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValSelMax<View>::ValSelMax(Space& home, const ValBranch<Var>& vb)
ValSelMax<View>::ValSelMax
(Space& home, const ValBranch<ValSelMax<View>::Var>& vb)
: ValSel<View,int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -63,7 +65,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValSelMed<View>::ValSelMed(Space& home, const ValBranch<Var>& vb)
ValSelMed<View>::ValSelMed
(Space& home, const ValBranch<ValSelMed<View>::Var>& vb)
: ValSel<View,int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -77,7 +80,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValSelAvg<View>::ValSelAvg(Space& home, const ValBranch<Var>& vb)
ValSelAvg<View>::ValSelAvg
(Space& home, const ValBranch<ValSelAvg<View>::Var>& vb)
: ValSel<View,int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -91,7 +95,8 @@ namespace Gecode { namespace Int { namespace Branch {

template<class View>
forceinline
ValSelRnd<View>::ValSelRnd(Space& home, const ValBranch<Var>& vb)
ValSelRnd<View>::ValSelRnd
(Space& home, const ValBranch<ValSelRnd<View>::Var>& vb)
: ValSel<View,int>(home,vb), r(vb.rnd()) {}
template<class View>
forceinline
Expand Down Expand Up @@ -122,7 +127,8 @@ namespace Gecode { namespace Int { namespace Branch {
}

forceinline
ValSelRangeMin::ValSelRangeMin(Space& home, const ValBranch<IntVar>& vb)
ValSelRangeMin::ValSelRangeMin
(Space& home, const ValBranch<IntVar>& vb)
: ValSel<IntView,int>(home,vb) {}
forceinline
ValSelRangeMin::ValSelRangeMin(Space& home, ValSelRangeMin& vs)
Expand Down
2 changes: 2 additions & 0 deletions gecode/int/channel/dom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ namespace Gecode { namespace Int { namespace Channel {
template<class View, class Offset, bool shared>
ExecStatus
Dom<View,Offset,shared>::propagate(Space& home, const ModEventDelta& med) {
// MSVC in non-permissive mode needs this, no idea why...
const int n = this->n;
Region r;
ProcessStack xa(r,n);
ProcessStack ya(r,n);
Expand Down
8 changes: 4 additions & 4 deletions gecode/int/ldsb/brancher.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ namespace Gecode { namespace Int { namespace LDSB {
ViewSel<View>* vs[n],
ValSelCommitBase<View,Val>* vsc,
SymmetryImp<View>** syms, int nsyms,
BranchFilter<Var> bf,
VarValPrint<Var,Val> vvp)
BranchFilter<LDSBBrancher<View,n,Val,a,Filter,Print>::Var> bf,
VarValPrint<LDSBBrancher<View,n,Val,a,Filter,Print>::Var,Val> vvp)
: ViewValBrancher<View,n,Val,a,Filter,Print>(home, x, vs, vsc, bf, vvp),
_syms(syms),
_nsyms(nsyms),
Expand All @@ -112,8 +112,8 @@ namespace Gecode { namespace Int { namespace LDSB {
post(Home home, ViewArray<View>& x,
ViewSel<View>* vs[n], ValSelCommitBase<View,Val>* vsc,
SymmetryImp<View>** syms, int nsyms,
BranchFilter<Var> bf,
VarValPrint<Var,Val> vvp) {
BranchFilter<LDSBBrancher<View,n,Val,a,Filter,Print>::Var> bf,
VarValPrint<LDSBBrancher<View,n,Val,a,Filter,Print>::Var,Val> vvp) {
(void) new (home) LDSBBrancher<View,n,Val,a,Filter,Print>
(home,x,vs,vsc,syms,nsyms,bf,vvp);
}
Expand Down
15 changes: 10 additions & 5 deletions gecode/kernel/branch/merit.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ namespace Gecode {
// User-defined function merit
template<class View>
forceinline
MeritFunction<View>::MeritFunction(Space& home, const VarBranch<Var>& vb)
MeritFunction<View>::MeritFunction
(Space& home, const VarBranch<MeritFunction<View>::Var>& vb)
: MeritBase<View,double>(home,vb), f(vb.merit()) {
if (!f())
throw InvalidFunction("MeritFunction::MeritFunction");
Expand Down Expand Up @@ -221,7 +222,8 @@ namespace Gecode {
// Degree merit
template<class View>
forceinline
MeritDegree<View>::MeritDegree(Space& home, const VarBranch<Var>& vb)
MeritDegree<View>::MeritDegree
(Space& home, const VarBranch<MeritDegree<View>::Var>& vb)
: MeritBase<View,unsigned int>(home,vb) {}
template<class View>
forceinline
Expand All @@ -236,7 +238,8 @@ namespace Gecode {
// AFC merit
template<class View>
forceinline
MeritAFC<View>::MeritAFC(Space& home, const VarBranch<Var>& vb)
MeritAFC<View>::MeritAFC
(Space& home, const VarBranch<MeritAFC<View>::Var>& vb)
: MeritBase<View,double>(home,vb), afc(vb.afc()) {}
template<class View>
forceinline
Expand Down Expand Up @@ -264,7 +267,8 @@ namespace Gecode {
// Action merit
template<class View>
forceinline
MeritAction<View>::MeritAction(Space& home, const VarBranch<Var>& vb)
MeritAction<View>::MeritAction
(Space& home, const VarBranch<MeritAction<View>::Var>& vb)
: MeritBase<View,double>(home,vb), action(vb.action()) {}
template<class View>
forceinline
Expand All @@ -289,7 +293,8 @@ namespace Gecode {
// CHB merit
template<class View>
forceinline
MeritCHB<View>::MeritCHB(Space& home, const VarBranch<Var>& vb)
MeritCHB<View>::MeritCHB
(Space& home, const VarBranch<MeritCHB<View>::Var>& vb)
: MeritBase<View,double>(home,vb), chb(vb.chb()) {}
template<class View>
forceinline
Expand Down
3 changes: 2 additions & 1 deletion gecode/kernel/branch/val-sel.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ namespace Gecode {
// User-defined value selection
template<class View>
forceinline
ValSelFunction<View>::ValSelFunction(Space& home, const ValBranch<Var>& vb)
ValSelFunction<View>::ValSelFunction
(Space& home, const ValBranch<ValSelFunction<View>::Var>& vb)
: ValSel<View,Val>(home,vb), v(vb.val()) {
if (!v())
throw InvalidFunction("ValSelFunction::ValSelFunction");
Expand Down
8 changes: 4 additions & 4 deletions gecode/set/ldsb/brancher.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ namespace Gecode { namespace Set { namespace LDSB {
ViewSel<View>* vs[n],
ValSelCommitBase<View,Val>* vsc,
SymmetryImp<View>** syms, int nsyms,
BranchFilter<Var> bf,
VarValPrint<Var,Val> vvp)
BranchFilter<LDSBSetBrancher<View,n,Val,a,Filter,Print>::Var> bf,
VarValPrint<LDSBSetBrancher<View,n,Val,a,Filter,Print>::Var,Val> vvp)
: LDSBBrancher<View,n,Val,a,Filter,Print>
(home, x, vs, vsc, syms, nsyms, bf, vvp),
_prevPos(-1),
Expand Down Expand Up @@ -258,8 +258,8 @@ namespace Gecode { namespace Set { namespace LDSB {
post(Home home, ViewArray<View>& x,
ViewSel<View>* vs[n], ValSelCommitBase<View,Val>* vsc,
SymmetryImp<View>** syms, int nsyms,
BranchFilter<Var> bf,
VarValPrint<Var,Val> vvp) {
BranchFilter<LDSBSetBrancher<View,n,Val,a,Filter,Print>::Var> bf,
VarValPrint<LDSBSetBrancher<View,n,Val,a,Filter,Print>::Var,Val> vvp) {
(void) new (home) LDSBSetBrancher<View,n,Val,a,Filter,Print>
(home,x,vs,vsc,syms,nsyms,bf,vvp);
}
Expand Down

0 comments on commit 843667a

Please sign in to comment.