Skip to content

Commit

Permalink
COMP: fixed various Wunused-but-set-variable warnings from Clang 13
Browse files Browse the repository at this point in the history
Two solutions:
- removed the dead code.
- use the variable by logging it
  • Loading branch information
seanm committed Oct 15, 2021
1 parent f56cc7e commit a79936d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Modules/Core/Common/test/itkPeriodicBoundaryConditionTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,17 @@ itkPeriodicBoundaryConditionTest(int, char *[])
back.push_back({ { 0, 0 } });
testIter.SetNeedToUseBoundaryCondition(true);
testIter.GoToBegin();
float sum = 0.0f;
while (!testIter.IsAtEnd())
{
float sum = 0;
for (auto & j : back)
{
const float d = testIter.GetPixel(j);
sum += d * d;
sum += d;
}
++testIter;
}
std::cout << "Dummy sum: " << sum << std::endl;

return EXIT_SUCCESS;
}
1 change: 1 addition & 0 deletions Modules/Core/Common/test/itkTimeProbeTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ itkTimeProbeTest(int, char *[])
{
sum += i;
}
std::cout << "Dummy sum: " << sum << std::endl;
localTimer.Stop();

// Print current values
Expand Down
1 change: 1 addition & 0 deletions Modules/Core/Common/test/itkTimeProbeTest2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ itkTimeProbeTest2(int, char *[])
{
sum += i;
}
std::cout << "Dummy sum: " << sum << std::endl;

localTimer.Stop();
}
Expand Down
3 changes: 3 additions & 0 deletions Modules/IO/MRC/src/itkMRCHeaderObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ MRCHeaderObject::SetHeader(const Header * buffer)
{
extendedHeaderBytes += 2;
}
// TODO: all the above to set extendedHeaderBytes, yet extendedHeaderBytes is unused!
itkWarningMacro(<< "extendedHeaderBytes is: " << extendedHeaderBytes <<
"If you see this log please contact https://github.com/InsightSoftwareConsortium/ITK/pull/2778");

this->m_ExtendedHeaderSize = this->m_Header.next;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ VoronoiSegmentationImageFilter<TInputImage, TOutputImage, TBinaryPriorImage>::Ta
}

float addb = 0;
float addbb = 0;
int numb = 0;

ait.GoToBegin();
Expand Down Expand Up @@ -172,7 +171,6 @@ VoronoiSegmentationImageFilter<TInputImage, TOutputImage, TBinaryPriorImage>::Ta
numb++;
currp = (float)(iit.Get());
addb += currp;
addbb += currp * currp;
}
++ait;
++iit;
Expand Down

0 comments on commit a79936d

Please sign in to comment.