Skip to content

Commit 0e35723

Browse files
committed
remove or disable more set-but-unused variables
- from clang 14.0.3 warnings
1 parent 0e9a47e commit 0e35723

File tree

8 files changed

+42
-16
lines changed

8 files changed

+42
-16
lines changed

CoinUtils/src/CoinLpIO.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,15 +1090,15 @@ int CoinLpIO::writeLp(FILE *fp, const bool useRowNames)
10901090

10911091
fprintf(fp, "Subject To\n");
10921092

1093-
int cnt_out_rows = 0;
1093+
//int cnt_out_rows = 0;
10941094

10951095
for (i = 0; i < nrow; i++) {
10961096
cnt_print = 0;
10971097

10981098
if (useRowNames) {
10991099
fprintf(fp, "%s: ", rowNames[i]);
11001100
}
1101-
cnt_out_rows++;
1101+
//cnt_out_rows++;
11021102

11031103
for (j = matrixByRow_->getVectorFirst(i);
11041104
j < matrixByRow_->getVectorLast(i); j++) {
@@ -1132,7 +1132,7 @@ int CoinLpIO::writeLp(FILE *fp, const bool useRowNames)
11321132
if (useRowNames) {
11331133
fprintf(fp, "%s_low:", rowNames[i]);
11341134
}
1135-
cnt_out_rows++;
1135+
//cnt_out_rows++;
11361136

11371137
for (j = matrixByRow_->getVectorFirst(i);
11381138
j < matrixByRow_->getVectorLast(i); j++) {

CoinUtils/src/CoinOslFactorization.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ void CoinOslFactorization::makeNonSingular(int *sequence, int numberColumns)
289289
//printf("nr %d nc %d\n",nr,nc);
290290
#ifndef NDEBUG
291291
bool goodPass = true;
292-
#endif
293292
int numberDone = 0;
293+
#endif
294294
for (int i = 0; i < numberRows_; i++) {
295295
int cRow = (-clink[i].pre) - 1;
296296
if (cRow == numberRows_ || cRow < 0) {
@@ -303,7 +303,9 @@ void CoinOslFactorization::makeNonSingular(int *sequence, int numberColumns)
303303
if (nextRow < numberRows_) {
304304
sequence[i] = nextRow + numberColumns;
305305
nextRow++;
306+
#ifndef NDEBUG
306307
numberDone++;
308+
#endif
307309
} else {
308310
#ifndef NDEBUG
309311
goodPass = false;

CoinUtils/src/CoinPackedMatrix.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,9 @@ CoinPackedMatrix::CoinPackedMatrix(const CoinPackedMatrix &rhs,
22082208
const CoinBigIndex *oldStart = rhs.start_;
22092209
const int *oldIndex = rhs.index_;
22102210
const int *oldLength = rhs.length_;
2211+
#ifndef NDEBUG
22112212
CoinBigIndex tooSmallCount = 0;
2213+
#endif
22122214
for (int i = 0; i < majorDim_; i++) {
22132215
start_[i] = size;
22142216
for (CoinBigIndex j = oldStart[i];
@@ -2218,7 +2220,9 @@ CoinPackedMatrix::CoinPackedMatrix(const CoinPackedMatrix &rhs,
22182220
element_[size] = value;
22192221
index_[size++] = oldIndex[j];
22202222
} else {
2223+
#ifndef NDEBUG
22212224
tooSmallCount++;
2225+
#endif
22222226
}
22232227
}
22242228
length_[i] = static_cast< int >(size - start_[i]);

CoinUtils/src/CoinPresolveDual.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const CoinPresolveAction
202202
*/
203203
char *active = reinterpret_cast< char * >(prob->usefulColumnInt_);
204204
memset(active, 0, ncols);
205-
int nOneBound = 0;
205+
//int nOneBound = 0;
206206
int numberLook = prob->numberColsToDo_;
207207
int *look = prob->colsToDo_;
208208
for (int iLook = 0; iLook < numberLook; iLook++) {
@@ -221,11 +221,11 @@ const CoinPresolveAction
221221
else
222222
type = 4;
223223
}
224-
if (type == 1 || type == 2)
225-
nOneBound++;
224+
//if (type == 1 || type == 2)
225+
// nOneBound++;
226226
active[j] = type;
227227
}
228-
int nFreed = 0;
228+
//int nFreed = 0;
229229
#define USE_ACTIVE 1
230230
//#define PRESOLVE_DEBUG 2
231231
for (int i = 0; i < nrows; i++) {
@@ -333,7 +333,7 @@ const CoinPresolveAction
333333
#endif
334334
doneSomething = true;
335335
active[icol] = 2 + 8;
336-
nFreed++;
336+
//nFreed++;
337337
#define TRY_UPPER 3
338338
#if TRY_UPPER > 1
339339
} else if (impliedUpper < ub + 1.0e-7) {
@@ -352,7 +352,7 @@ const CoinPresolveAction
352352
#if TRY_UPPER > 2
353353
doneSomething = true;
354354
active[icol] = 1 + 8;
355-
nFreed++;
355+
//nFreed++;
356356
#endif
357357
#endif
358358
} else {
@@ -445,7 +445,7 @@ const CoinPresolveAction
445445
printf("second type can take off lb of %g on column %d as implied lower %g - effective upper %g, coeff %g on row %d\n", lb, icol, impliedLower, maxUp, coeff, i);
446446
#endif
447447
active[icol] = 2 + 8;
448-
nFreed++;
448+
//nFreed++;
449449
#if 0 //TRY_UPPER
450450
} else if (impliedLower>lb-1.0e-7 ) {
451451
printf("second type can't take off lb of %g on column %d as implied lower %g - effective upper %g, coeff %g on row %d\n",lb,icol,impliedLower,maxUp,coeff,i);
@@ -467,7 +467,7 @@ const CoinPresolveAction
467467
#if TRY_UPPER > 2
468468
doneSomething = true;
469469
active[icol] = 1 + 8;
470-
nFreed++;
470+
//nFreed++;
471471
#endif
472472
#endif
473473
}
@@ -585,7 +585,9 @@ const CoinPresolveAction
585585
int nflagu = 0;
586586
int nflagl = 0;
587587
// Number of ordinary rows
588+
#if PROCESS_INFINITE_LB
588589
int nordu = 0;
590+
#endif
589591
int nordl = 0;
590592
double cbarjmin = cost[j];
591593
double cbarjmax = cbarjmin;
@@ -598,7 +600,9 @@ const CoinPresolveAction
598600
if (aij > 0.0) {
599601
if (ymin[i] >= -ekkinf2) {
600602
cbarjmax -= mindelta;
603+
#if PROCESS_INFINITE_LB
601604
nordu++;
605+
#endif
602606
} else {
603607
nflagu++;
604608
}
@@ -611,7 +615,9 @@ const CoinPresolveAction
611615
} else {
612616
if (ymax[i] <= ekkinf2) {
613617
cbarjmax -= maxdelta;
618+
#if PROCESS_INFINITE_LB
614619
nordu++;
620+
#endif
615621
} else {
616622
nflagu++;
617623
}
@@ -1429,7 +1435,7 @@ const CoinPresolveAction
14291435
#endif
14301436
}
14311437
}
1432-
#if 1 // PRESOLVE_DEBUG > 0
1438+
#if PRESOLVE_DEBUG > 0
14331439
int makeEqCandCnt = 0;
14341440
for (int i = 0; i < nrows; i++) {
14351441
if (abs(canFix[i]) == 1)

CoinUtils/src/CoinPresolveFixed.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,9 @@ void transferCosts(CoinPresolveMatrix *prob)
788788
For unfixed column singletons in equalities, calculate and install transform
789789
(A) described in the comments at the head of the method.
790790
*/
791+
#if PRESOLVE_DEBUG > 0
791792
int nchanged = 0;
793+
#endif
792794
for (int js = 0; js < ncols; js++) {
793795
if (cost[js] && hincol[js] == 1 && cup[js] > clo[js]) {
794796
const CoinBigIndex &jsstrt = mcstrt[js];
@@ -804,7 +806,9 @@ void transferCosts(CoinPresolveMatrix *prob)
804806
cost[j] -= ratio * aij;
805807
}
806808
cost[js] = 0.0;
809+
#if PRESOLVE_DEBUG > 0
807810
nchanged++;
811+
#endif
808812
}
809813
}
810814
}
@@ -862,8 +866,8 @@ void transferCosts(CoinPresolveMatrix *prob)
862866
}
863867
}
864868
if (changed) {
865-
nchanged += changed;
866869
#if PRESOLVE_DEBUG > 0
870+
nchanged += changed;
867871
std::cout
868872
<< " pass " << nPasses++ << " transferred costs to "
869873
<< changed << " integer variables." << std::endl;

CoinUtils/src/CoinPresolveImpliedFree.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,9 @@ const CoinPresolveAction *implied_free_action::presolve(
828828
// if not integer - don't allow much fill
829829
if (!prob->anyInteger()) {
830830
int numberFree = unprocessed;
831+
#if CLP_USEFUL_PRINTOUT
831832
int nBad = 0;
833+
#endif
832834
unprocessed = 0;
833835
// Take out ones that make much denser or might lead to instability
834836
/*
@@ -989,8 +991,10 @@ const CoinPresolveAction *implied_free_action::presolve(
989991
if (numberBadElements || 3 * numberFill > 2 * (colLengths[tgtcol] + rowLengths[tgtrow])) {
990992
//printf("Bad subst col %d row %d - %d small elements, fill %d\n",
991993
// tgtcol,tgtrow,numberBadElements,numberFill);
994+
#if CLP_USEFUL_PRINTOUT
992995
if (numberBadElements)
993996
nBad++;
997+
#endif
994998
} else {
995999
whichFree[unprocessed] = tgtcol;
9961000
implied_free[unprocessed++] = tgtrow;

CoinUtils/src/CoinPresolveSingleton.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ slack_singleton_action::presolve(CoinPresolveMatrix *prob,
589589
int nactions = 0;
590590
int *fixed_cols = new int[numberLook];
591591
int nfixed_cols = 0;
592-
int nWithCosts = 0;
593592
#ifdef COIN_DEVELOP
593+
int nWithCosts = 0;
594594
double costOffset = 0.0;
595595
#endif
596596
for (iLook = 0; iLook < numberLook; iLook++) {
@@ -743,9 +743,9 @@ slack_singleton_action::presolve(CoinPresolveMatrix *prob,
743743
cup[iCol] = 0.0;
744744
if (rowObjective && dcost[iCol]) {
745745
rowObjective[iRow] = -dcost[iCol] / coeff;
746+
#ifdef COIN_DEVELOP
746747
nWithCosts++;
747748
// adjust offset
748-
#ifdef COIN_DEVELOP
749749
costOffset += currentLower * rowObjective[iRow];
750750
#endif
751751
prob->dobias_ -= currentLower * rowObjective[iRow];

CoinUtils/src/CoinPresolveUseless.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ const CoinPresolveAction *testRedundant(CoinPresolveMatrix *prob,
551551
double *cup = prob->cup_;
552552
int *fixed = prob->usefulColumnInt_;
553553
int nFixed = 0;
554+
#ifdef CLP_INVESTIGATE
554555
int nChanged = 0;
556+
#endif
555557
for (int j = 0; j < n; j++) {
556558
if (clo[j] == cup[j])
557559
continue;
@@ -576,12 +578,16 @@ const CoinPresolveAction *testRedundant(CoinPresolveMatrix *prob,
576578
if (integerType[j]) {
577579
if (upper < cup[j]) {
578580
cup[j] = upper;
581+
#ifdef CLP_INVESTIGATE
579582
nChanged++;
583+
#endif
580584
prob->addCol(j);
581585
}
582586
if (lower > clo[j]) {
583587
clo[j] = lower;
588+
#ifdef CLP_INVESTIGATE
584589
nChanged++;
590+
#endif
585591
prob->addCol(j);
586592
}
587593
}

0 commit comments

Comments
 (0)