Skip to content

Commit f3e2aa9

Browse files
committed
Merge branch 'fix_pclint_warnings_SCIP10' into 'master'
SCIP 10: fix pclint warnings See merge request integer/scip!3866
2 parents 3ed5124 + aacc96b commit f3e2aa9

16 files changed

+451
-410
lines changed

pclint/scip.lnt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
// turn off warnings for third-party code
8080
-efile(*,src/amplmp/*)
8181

82+
// switch condition is a constant expression
83+
-emacro(837,SCIPstatIncrement)
84+
-emacro(837,SCIPstatAdd)
85+
-emacro(837,SCIPstatUpdate)
86+
8287
// last value assigned to '_restat_' not used
8388
-emacro(438,SCIP_CALL)
8489
-emacro(438,SCIP_CALL_ABORT)
@@ -195,6 +200,7 @@
195200
-emacro(774,debugMessage)
196201
-emacro(774,SCIP_CALL_TERMINATE)
197202
-emacro(774,MCFdebugMessage)
203+
-emacro(774,SG_FREE)
198204

199205
// possible truncation of addition
200206
-emacro(776,SCIPreallocBufferArray)

src/scip/benders.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4127,7 +4127,7 @@ SCIP_RETCODE SCIPbendersExec(
41274127
/* inserting the subproblems into the priority queue for the next solve call */
41284128
SCIP_CALL( updateSubproblemStatQueue(benders, executedidx, nexecutedidx, TRUE) );
41294129

4130-
if( stopped )
4130+
if( stopped ) /*lint !e774*/
41314131
goto TERMINATE;
41324132

41334133
allverified = (nverified == nsubproblems);
@@ -4278,7 +4278,7 @@ SCIP_RETCODE SCIPbendersExec(
42784278

42794279
TERMINATE:
42804280
/* if the solving process has stopped, then all subproblems need to be freed */
4281-
if( stopped )
4281+
if( stopped ) /*lint !e774*/
42824282
nfree = nsubproblems;
42834283
else
42844284
nfree = nexecutedidx;

src/scip/branch_relpscost.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ SCIP_Bool continueStrongBranchingTreeSizeEstimation(
10301030
SCIP_Real currentdepth;
10311031
SCIP_Real currenttreesize;
10321032
SCIP_Real absdualgap;
1033-
SCIP_Real gaptoclose;
1033+
SCIP_Real gaptoclose = -1.0;
10341034

10351035
/* default values never used */
10361036
SCIP_Real logmeangain = 0.0;
@@ -1061,6 +1061,7 @@ SCIP_Bool continueStrongBranchingTreeSizeEstimation(
10611061
else
10621062
return TRUE;
10631063

1064+
assert(gaptoclose >= 0.0);
10641065
assert(!SCIPisInfinity(scip, -maxmeangain));
10651066

10661067
SCIP_Real zeroprob = (SCIP_Real) branchruledata->nzerogains / (branchruledata->nzerogains + branchruledata->currndualgains);
@@ -1087,7 +1088,7 @@ SCIP_Bool continueStrongBranchingTreeSizeEstimation(
10871088
}
10881089

10891090
/* Continue strong branching since we do not have good enough gains in this case */
1090-
currentdepth = strongBranchingDepth(gaptoclose, maxmeangain);
1091+
currentdepth = strongBranchingDepth(gaptoclose, maxmeangain); /*lint !e644*/
10911092

10921093
if (currentdepth >= 50)
10931094
return TRUE;

src/scip/certificate.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ SCIP_Bool checkAndUpdateFilesize(
8585
{
8686
if( certificate->filesize < certificate->maxfilesize )
8787
certificate->filesize += nchars/(SCIP_MB_TO_CHAR_RATE);
88-
return certificate->filesize < certificate->maxfilesize;
88+
if( certificate->filesize < certificate->maxfilesize )
89+
return TRUE;
90+
return FALSE;
8991
}
9092

9193
/** checks whether node is a left node or not */
@@ -816,7 +818,7 @@ SCIP_RETCODE SCIPcertificateExit(
816818

817819
if( certificate->origfile != NULL )
818820
{
819-
SCIP_Bool printingaborted = !checkAndUpdateFilesize(certificate, 0);
821+
SCIP_Bool printingaborted = checkAndUpdateFilesize(certificate, 0) ? FALSE : TRUE;
820822

821823
SCIPmessagePrintVerbInfo(messagehdlr, set->disp_verblevel, SCIP_VERBLEVEL_NORMAL,
822824
"closing certificate file (wrote approx. %.1f MB%s)\n", certificate->filesize,
@@ -896,8 +898,9 @@ SCIP_Bool SCIPcertificateIsEnabled(
896898
SCIP_CERTIFICATE* certificate /**< certificate information */
897899
)
898900
{
899-
return certificate != NULL && certificate->transfile != NULL && certificate->origfile != NULL
900-
&& certificate->derivationfile != NULL;
901+
if( certificate != NULL && certificate->transfile != NULL && certificate->origfile != NULL && certificate->derivationfile != NULL )
902+
return TRUE;
903+
return FALSE;
901904
}
902905

903906
/** returns current certificate file size in MB */
@@ -935,26 +938,26 @@ SCIP_Bool SCIPcertificateEnsureLastBoundInfoConsistent(
935938
SCIP_Bool consistent;
936939

937940
if( !SCIPcertificateIsEnabled(certificate) )
938-
return true;
941+
return TRUE;
939942

940943
assert(certificate != NULL);
941944

942945
consistent = certificate->lastinfo->isbound;
943-
consistent = consistent && certificate->lastinfo->varindex == SCIPvarGetCertificateIndex(var);
946+
consistent = consistent && certificate->lastinfo->varindex == SCIPvarGetCertificateIndex(var); /*lint !e1785*/
944947
if( boundtype == SCIP_BOUNDTYPE_LOWER )
945948
{
946-
consistent = consistent && certificate->lastinfo->boundtype == SCIP_BOUNDTYPE_LOWER;
947-
consistent = consistent && SCIPrationalRoundReal(certificate->lastinfo->boundval, SCIP_R_ROUND_DOWNWARDS) >= newbound;
949+
consistent = consistent && certificate->lastinfo->boundtype == SCIP_BOUNDTYPE_LOWER; /*lint !e1785*/
950+
consistent = consistent && SCIPrationalRoundReal(certificate->lastinfo->boundval, SCIP_R_ROUND_DOWNWARDS) >= newbound; /*lint !e1785*/
948951
}
949952
else
950953
{
951-
consistent = consistent && certificate->lastinfo->boundtype == SCIP_BOUNDTYPE_UPPER;
952-
consistent = consistent && SCIPrationalRoundReal(certificate->lastinfo->boundval, SCIP_R_ROUND_UPWARDS) <= newbound;
954+
consistent = consistent && certificate->lastinfo->boundtype == SCIP_BOUNDTYPE_UPPER; /*lint !e1785*/
955+
consistent = consistent && SCIPrationalRoundReal(certificate->lastinfo->boundval, SCIP_R_ROUND_UPWARDS) <= newbound; /*lint !e1785*/
953956
}
954-
consistent = consistent && (!needsglobal || certificate->lastinfo->isglobal);
955-
consistent = consistent && certificate->lastinfo->certificateindex == certificate->indexcounter - 1;
956-
return consistent;
957+
consistent = consistent && (!needsglobal || certificate->lastinfo->isglobal); /*lint !e1785*/
958+
consistent = consistent && certificate->lastinfo->certificateindex == certificate->indexcounter - 1; /*lint !e1785*/
957959

960+
return consistent;
958961
}
959962
#endif
960963

@@ -1221,8 +1224,6 @@ SCIP_RETCODE SCIPcertificatePrintProofRational(
12211224
int len = SCIPrationalStrLen(val) + 1;
12221225
char* buffer = NULL;
12231226

1224-
assert(len <= INT_MAX);
1225-
12261227
/* check whether certificate output should be created */
12271228
if( !SCIPcertificateIsEnabled(certificate) )
12281229
return SCIP_OKAY;;
@@ -3350,7 +3351,7 @@ SCIP_RETCODE SCIPcertificatePrintCutoffConflictingBounds(
33503351
SCIPrationalDiv(ub, ub, var->exactdata->aggregate.scalar);
33513352

33523353
assert(SCIPrationalIsZero(var->exactdata->aggregate.constant));
3353-
SCIP_Bool swapBounds = !SCIPrationalIsPositive(var->exactdata->aggregate.scalar);
3354+
SCIP_Bool swapBounds = SCIPrationalIsPositive(var->exactdata->aggregate.scalar) ? FALSE: TRUE;
33543355
SCIP_CALL( SCIPcertificatePrintCutoffConflictingBounds(scip, certificate, var->data.aggregate.var, swapBounds ? ub : lb, swapBounds ? lb : ub, swapBounds ? ubindex : lbindex, swapBounds ? lbindex : ubindex) );
33553356
if( lb != NULL )
33563357
SCIPrationalMult(lb, lb, var->exactdata->aggregate.scalar);

src/scip/cons_exactlinear.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,10 +2039,11 @@ void consdataUpdateDelCoef(
20392039
/** returns the minimum absolute value of all coefficients in the constraint */
20402040
static
20412041
SCIP_RATIONAL* consdataGetMinAbsvalEx(
2042-
SCIP* scip,
2042+
SCIP* scip, /**< SCIP data structure */
20432043
SCIP_CONSDATA* consdata /**< linear constraint data */
20442044
)
20452045
{
2046+
assert(scip != NULL);
20462047
assert(consdata != NULL);
20472048

20482049
if( !consdata->validminabsval )

0 commit comments

Comments
 (0)