Skip to content

Commit

Permalink
Add explicit braces to avoid dangling else warning [-Wdangling-else]
Browse files Browse the repository at this point in the history
  • Loading branch information
rotolof committed Sep 20, 2019
1 parent 12758f8 commit 71a0bb3
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 36 deletions.
11 changes: 6 additions & 5 deletions MCFCplex/MCFCplex.C
Expand Up @@ -1285,13 +1285,14 @@ void MCFCplex::ChangeArc( cIndex name , cIndex nSN , cIndex nEN )
{
int temp = int( name );
int sn , en;
if( ( nSN == Inf<Index>() ) || ( nEN == Inf<Index>() ) )
if( net )
CPXNETgetarcnodes( env , net , &sn , &en , temp , temp );
else {
if( ( nSN == Inf<Index>() ) || ( nEN == Inf<Index>() ) ) {
if( net ) {
CPXNETgetarcnodes( env, net, &sn, &en, temp, temp );
} else {
sn = Startn[ name ];
en = Endn[ name ];
}
}
}

if( nSN < Inf<Index>() )
sn = int( nSN MINUSONE );
Expand Down
2 changes: 1 addition & 1 deletion MCFCplex/MCFCplex.h
Expand Up @@ -42,7 +42,7 @@

#include "MCFClass.h"

#include "cplex.h"
#include <ilcplex/cplex.h>

/*--------------------------------------------------------------------------*/
/*------------------------------- MACROS -----------------------------------*/
Expand Down
59 changes: 35 additions & 24 deletions RelaxIV/RelaxIV.C
Expand Up @@ -932,17 +932,19 @@ void RelaxIV::SolveMCF( void )
if( ETZ( RC[ arc ] , EpsCst ) ) {
Index t2 = Endn[ arc ];
if( ! mark[ t2 ] ) // t2 is not labeled
if( GTZ( X[ arc ] , EpsFlw ) ) {
if( LTZ( Dfct[ t2 ] , EpsDfct ) )
{
if( GTZ( X[ arc ], EpsFlw ) ) {
if( LTZ( Dfct[ t2 ], EpsDfct ) )
save[ naugnod++ ] = t2;

Prdcsr[ t2 ] = arc;
label[ nlabel++ ] = t2;
mark[ t2 ] = true;
delx += X[ arc ];
}
else
} else {
Prdcsr[ t2 ] = 0;
}
}

prvarc = arc;
arc = tnxtou[ arc ];
Expand All @@ -966,17 +968,19 @@ void RelaxIV::SolveMCF( void )
if( ETZ( RC[ arc ] , EpsCst ) ) {
Index t2 = Startn[ arc ];
if( ! mark[ t2 ] ) // t2 is not labeled
if( GTZ( U[ arc ] , EpsFlw ) ) {
if( LTZ( Dfct[ t2 ] , EpsDfct ) )
{
if( GTZ( U[ arc ], EpsFlw ) ) {
if( LTZ( Dfct[ t2 ], EpsDfct ) )
save[ naugnod++ ] = t2;

Prdcsr[ t2 ] = -arc;
label[ nlabel++ ] = t2;
mark[ t2 ] = true;
delx += U[ arc ];
}
else
} else {
Prdcsr[ t2 ] = 0;
}
}

prvarc = arc;
arc = tnxtin[ arc ];
Expand All @@ -1001,17 +1005,19 @@ void RelaxIV::SolveMCF( void )
if( ETZ( RC[ arc ] , EpsCst ) ) {
Index t2 = Startn[ arc ];
if( ! mark[ t2 ] ) // t2 is not labelled
if( GTZ( X[ arc ] , EpsFlw ) ) {
if( GTZ( Dfct[ t2 ] , EpsDfct ) )
{
if( GTZ( X[ arc ], EpsFlw ) ) {
if( GTZ( Dfct[ t2 ], EpsDfct ) )
save[ naugnod++ ] = t2;

Prdcsr[ t2 ] = arc;
label[ nlabel++ ] = t2;
mark[ t2 ] = true;
delx += X[ arc ];
}
else
} else {
Prdcsr[ t2 ] = 0;
}
}

prvarc = arc;
arc = tnxtin[ arc ];
Expand All @@ -1035,17 +1041,19 @@ void RelaxIV::SolveMCF( void )
if( ETZ( RC[ arc ] , EpsCst ) ) {
Index t2 = Endn[ arc ];
if( ! mark[ t2 ] ) // t2 is not albelled
if( GTZ( U[ arc ] , EpsFlw ) ) {
if( GTZ( Dfct[ t2 ] , EpsDfct ) )
{
if( GTZ( U[ arc ], EpsFlw ) ) {
if( GTZ( Dfct[ t2 ], EpsDfct ) )
save[ naugnod++ ] = t2;

Prdcsr[ t2 ] = -arc;
label[ nlabel++ ] = t2;
mark[ t2 ] = true;
delx += U[ arc ];
}
else
} else {
Prdcsr[ t2 ] = 0;
}
}

prvarc = arc;
arc = tnxtou[ arc ];
Expand Down Expand Up @@ -2148,13 +2156,15 @@ MCFClass::Index RelaxIV::AddArc( cIndex Start , cIndex End , cFNumber aU ,
arc = ffp;
}

if( ! arc )
if( m < mmax )
if( ! arc ) {
if( m < mmax ) {
arc = ++m;
else
return( Inf<Index>() );
} else {
return ( Inf< Index >() );
}
}

// insert new arc in position arc - - - - - - - - - - - - - - - - - - - - -
// insert new arc in position arc - - - - - - - - - - - - - - - - - - - - -

C[ arc ] = aC;
Cap[ arc ] = aU;
Expand Down Expand Up @@ -2310,7 +2320,7 @@ inline void RelaxIV::init_standard( void )
Index_Set tFIn = FIn + n;
for( tDfct = Dfct + n , tDDPos = DDPos + n , tDDNeg = DDNeg + n ;
tDfct > Dfct ; tDfct-- , tDDPos-- , tDDNeg-- , tFOu-- , tFIn-- )
if( ! ETZ( *tDfct , EpsDfct ) )
if( ! ETZ( *tDfct , EpsDfct ) ) {
if( LEZ( *tDDPos , EpsDfct ) ) {
// compute delprc, the stepsize to the next breakpoint in the dual cost
// as the price of node is increased: since the reduced cost of all
Expand Down Expand Up @@ -2365,7 +2375,7 @@ inline void RelaxIV::init_standard( void )
break;
} // end for( ever )
}
else
else {
if( LEZ( *tDDNeg , EpsDfct ) ) {
// Compute delprc, the stepsize to the next breakpoint in the dual cost
// as the price of node is decreased. Since the reduced cost of all
Expand Down Expand Up @@ -2420,7 +2430,8 @@ inline void RelaxIV::init_standard( void )
break;
} // end for( ever )
}

}
}
} // end( for( npass ) )
} // end( init_standard )

Expand Down
12 changes: 7 additions & 5 deletions SPTree/SPTree.C
Expand Up @@ -368,12 +368,14 @@ void SPTree::LoadNet( cIndex nmx , cIndex mmx , cIndex pn , cIndex pm ,
if( di > 0 )
DstBse[ NDsts++ ] = i;
else
if( di < 0 )
if( Origin < InINF )
throw( MCFException( "SPTree::LoadNet: more than one source in pDfct" ) );
else
if( di < 0 ) {
if( Origin < InINF ) {
throw ( MCFException( "SPTree::LoadNet: more than one source in pDfct" ) );
} else {
Origin = i;
}
}
}
}

if( Origin == InINF )
throw( MCFException( "SPTree::LoadNet: no sources in pDfct" ) );
Expand Down
2 changes: 1 addition & 1 deletion extlib/makefile-libCPLEX
Expand Up @@ -39,6 +39,6 @@ libCPLEXINCDIR = $(libCPLEXBSCDIR)lib/x86-64_osx/static_pic/
# macroes to be exported- - - - - - - - - - - - - - - - - - - - - - - - - - -

libCPLEXLIB = -L$(libCPLEXINCDIR) -lilocplex -lcplex $(libCPLEXEXTLIB)
libCPLEXINC = -I$(libCPLEXBSCDIR)include/ilcplex/
libCPLEXINC = -I$(libCPLEXBSCDIR)include/

############################# End of makefile ################################

0 comments on commit 71a0bb3

Please sign in to comment.