Skip to content
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

Fix clang, gcc >=7.3.0 issues. #24

Merged
merged 13 commits into from
Apr 30, 2018
10 changes: 10 additions & 0 deletions Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ UNZIP = unzip

TESTGEN = $(CXXTEST_DIR)/cxxtestgen.pl

#
# Compiler version check
#

GCCVERSION = $(shell g++ --version | grep ^g++ | sed 's/^.* //g')

#
# Unzipping
#
Expand Down Expand Up @@ -76,6 +82,10 @@ CFLAGS += \
\
-g \

ifeq "$(GCCVERSION)" "7.3.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this affects other versions as well. For example, I have 6.3.0 and this warning already exists. Can you figure out when this warning was introduced, and check if the version is gte that version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 73e94b.

CFLAGS += -Wno-terminate
endif

%.obj: %.cpp
@echo "CC\t" $@
@$(COMPILE) -c -o $@ $< $(CFLAGS) $(addprefix -I, $(LOCAL_INCLUDES))
Expand Down
6 changes: 6 additions & 0 deletions src/engine/Tableau.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,13 @@ bool Tableau::basicOutOfBounds( unsigned basic ) const

bool Tableau::basicTooLow( unsigned basic ) const
{
ASSERT( basic < _m );
return _basicStatus[basic] == Tableau::BELOW_LB;
}

bool Tableau::basicTooHigh( unsigned basic ) const
{
ASSERT( basic < _m );
return _basicStatus[basic] == Tableau::ABOVE_UB;
}

Expand Down Expand Up @@ -572,6 +574,9 @@ bool Tableau::performingFakePivot() const

void Tableau::performPivot()
{
ASSERT( _leavingVariable <= _m );
ASSERT( _enteringVariable < _n - _m );

if ( _leavingVariable == _m )
{
if ( _statistics )
Expand Down Expand Up @@ -1123,6 +1128,7 @@ void Tableau::restoreState( const TableauState &state )
_boundsValid = state._boundsValid;

computeAssignment();
_costFunctionManager->initialize();
computeCostFunction();
}

Expand Down
7 changes: 5 additions & 2 deletions src/engine/tests/Test_Tableau.h
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ class TableauTestSuite : public CxxTest::TestSuite
TS_ASSERT( hasCandidates( *tableau ) );

double d[] = { -1, +2, -1 };
tableau->setChangeColumn( d );

TS_ASSERT_THROWS_NOTHING( tableau->pickLeavingVariable( d ) );
TS_ASSERT_EQUALS( tableau->getEnteringVariable(), 2u );
Expand All @@ -1094,9 +1095,11 @@ class TableauTestSuite : public CxxTest::TestSuite
// Do some more stuff again

TS_ASSERT_THROWS_NOTHING( tableau->computeCostFunction() );
tableau->setEnteringVariableIndex( 2u );
tableau->setEnteringVariableIndex( tableau->variableToIndex( 2u ) );
TS_ASSERT( hasCandidates( *tableau ) );

TS_ASSERT_THROWS_NOTHING( tableau->computeChangeColumn() );

TS_ASSERT_THROWS_NOTHING( tableau->pickLeavingVariable( d ) );
TS_ASSERT_EQUALS( tableau->getEnteringVariable(), 2u );
TS_ASSERT_EQUALS( tableau->getLeavingVariable(), 5u );
Expand Down Expand Up @@ -1396,9 +1399,9 @@ class TableauTestSuite : public CxxTest::TestSuite
TS_ASSERT( hasCandidates( *tableau ) );
TS_ASSERT_EQUALS( tableau->getEnteringVariable(), 2u );

tableau->computeChangeColumn();
TS_ASSERT_THROWS_NOTHING( tableau->pickLeavingVariable() );
TS_ASSERT_EQUALS( tableau->getLeavingVariable(), 5u );
tableau->computeChangeColumn();
TS_ASSERT_THROWS_NOTHING( tableau->performPivot() );

// A bit hackish: store the tableau state, because this causes
Expand Down