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
RecoTracker/MeasurementDet : bug fix for gcc 6.0 misleading-indentation warning #15003
RecoTracker/MeasurementDet : bug fix for gcc 6.0 misleading-indentation warning #15003
Conversation
A new Pull Request was created by @gartung (Patrick Gartung) for CMSSW_8_1_X. It involves the following packages: RecoTracker/MeasurementDet @cmsbuild, @cvuosalo, @slava77, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are list here #13028 |
@cmsbuild please test |
The tests are being triggered in jenkins. |
since when line breaking and indentation have a meaning in C(++)???? |
Did the author mean to enclose the line in curly braces? |
of course not! |
I don't know that. The warning is to catch the case where the author meant to enclose in curly braces. |
@Dr15Jones care to comment. |
hasAny128StripBad_[i] = true; | ||
for (int j = 0; i < (totalStrips_[j] >> 7); j++) { | ||
if (bad128Strip_[j+offset] == false) hasAny128StripBad_[i] = false; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't actually make sense, although matches what the previous version was doing. This code always stops after the first iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better fix the bug and not loose the warning that points to a problem.
It may make more sense if someone (@VinInn ?) take over.
In the case the bug is fixed, the title of the PR should be changed.
@VinInn the gcc 6 compiler prints warnings when one doesn't use braces for an |
@slava77 How does this bug (i.e. the |
@Dr15Jones I started adding curly braces where I thought they should go but then changed to just adding line breaks. In some cases I can't tell what the author meant. |
@VinInn Definitely the |
@Dr15Jones , |
the compiler most probably remove the loop! |
@cmsbuild , please test |
The tests are being triggered in jenkins. |
@gartung: I don't understand your latest change to the PR title. This PR potentially changes run-time behavior in TkMeasurementDetSet.cc by moving the |
Sorry. Pasted the wrong title change. |
+1 Cleaning up confusing indentation in two TkStripMeasurementDet files. One change is actually a bug fix, but it is in a section of code that was probably never actually executed, so the fix shouldn't change normal run-time behavior. There should be no change in monitored quantities. The code changes are satisfactory, and Jenkins tests against baseline CMSSW_8_1_X_2016-06-28-1100 show no significant differences, as expected. |
This pull request is fully signed and it will be integrated in one of the next CMSSW_8_1_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @slava77, @davidlange6, @Degano, @smuzaffar |
/build/cmsbuild/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/8258e37281729e179b5af9c3b033d930/opt/cmssw/slc6_amd64_gcc600/cms/cmssw/CMSSW_8_1_X_2016-06-26-2300/src/RecoTracker/MeasurementDet/plugins/TkStripMeasurementDet.cc:83:7: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (auto && h: tmp) result.push_back(new SiStripRecHit2D(std::move(h))); tmp.clear();
^~~
/build/cmsbuild/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/8258e37281729e179b5af9c3b033d930/opt/cmssw/slc6_amd64_gcc600/cms/cmssw/CMSSW_8_1_X_2016-06-26-2300/src/RecoTracker/MeasurementDet/plugins/TkStripMeasurementDet.cc:83:81: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'for'
for (auto && h: tmp) result.push_back(new SiStripRecHit2D(std::move(h))); tmp.clear();
^~~
/build/cmsbuild/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/8258e37281729e179b5af9c3b033d930/opt/cmssw/slc6_amd64_gcc600/cms/cmssw/CMSSW_8_1_X_2016-06-26-2300/src/RecoTracker/MeasurementDet/plugins/TkStripMeasurementDet.cc:90:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (auto && h: tmp) result.push_back(new SiStripRecHit2D(std::move(h))); tmp.clear();
^~~
/build/cmsbuild/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/8258e37281729e179b5af9c3b033d930/opt/cmssw/slc6_amd64_gcc600/cms/cmssw/CMSSW_8_1_X_2016-06-26-2300/src/RecoTracker/MeasurementDet/plugins/TkStripMeasurementDet.cc:90:79: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'for'
for (auto && h: tmp) result.push_back(new SiStripRecHit2D(std::move(h))); tmp.clear();
^~~
/build/cmsbuild/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/8258e37281729e179b5af9c3b033d930/opt/cmssw/slc6_amd64_gcc600/cms/cmssw/CMSSW_8_1_X_2016-06-26-2300/src/RecoTracker/MeasurementDet/src/TkMeasurementDetSet.cc:29:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (bad128Strip_[j+offset] == false) hasAny128StripBad_[i] = false; break;
^~
/build/cmsbuild/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/8258e37281729e179b5af9c3b033d930/opt/cmssw/slc6_amd64_gcc600/cms/cmssw/CMSSW_8_1_X_2016-06-26-2300/src/RecoTracker/MeasurementDet/src/TkMeasurementDetSet.cc:29:72: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
if (bad128Strip_[j+offset] == false) hasAny128StripBad_[i] = false; break;
^~~~~