Skip to content
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

GeneratorInterface/LHEInterface : formatting fix for statements flagged by gcc 6.0 indentation warning #15065

Merged
merged 2 commits into from
Aug 9, 2016
Merged

GeneratorInterface/LHEInterface : formatting fix for statements flagged by gcc 6.0 indentation warning #15065

merged 2 commits into from
Aug 9, 2016

Conversation

gartung
Copy link
Member

@gartung gartung commented Jun 29, 2016

/home/cms_admin/CMSSW_8_1_X_2016-06-28-1400/src/GeneratorInterface/LHEInterface/src/LHEEvent.cc: In member function 'std::auto_ptr<HepMC::Ge
nEvent> lhef::LHEEvent::asHepMCEvent() const':
/home/cms_admin/CMSSW_8_1_X_2016-06-28-1400/src/GeneratorInterface/LHEInterface/src/LHEEvent.cc:309:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(unsigned int j = mother1; j <= mother2; j++) // set mother-daughter relations
^~~
/home/cms_admin/CMSSW_8_1_X_2016-06-28-1400/src/GeneratorInterface/LHEInterface/src/LHEEvent.cc:314:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'for'
current_vtx->add_particle_out(genParticles.at(i));
^~~~~~~~~~~

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @gartung (Patrick Gartung) for CMSSW_8_1_X.

It involves the following packages:

GeneratorInterface/LHEInterface

@covarell, @perrozzi, @thuer, @cmsbuild, @davidlange6, @govoni can you please review it and eventually sign? Thanks.
@agrohsje, @mkirsano this is something you requested to watch as well.
@slava77, @Degano, @smuzaffar you are the release manager for this.

cms-bot commands are list here #13028

@@ -306,7 +306,7 @@ std::auto_ptr<HepMC::GenEvent> LHEEvent::asHepMCEvent() const
genVertices.push_back(current_vtx);
}

for(unsigned int j = mother1; j <= mother2; j++) // set mother-daughter relations
for(unsigned int j = mother1; j <= mother2; j++) { // set mother-daughter relations
if (!genParticles.at(j)->end_vertex())
current_vtx->add_particle_in(genParticles.at(j));

Copy link
Member Author

@gartung gartung Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 309 was flagged as not guarding line 314 because of a missing opening curly brace. The indentation would seem to indicate that was what the author intended.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is right. With your new code, we get mother2-mother1+1 copies of particle i added to the current current_vtx. I'm pretty sure we only want one which is what the original code would do.
The original code would only proceed if mother1 != 0 which is probably sensible since we are translating from FORTRAN and the number there would start at 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the logic from the original code but just change the indentation to make the compiler happy.

@gartung
Copy link
Member Author

gartung commented Jun 29, 2016

@Dr15Jones Does this bug fix look correct to you?

@gartung gartung changed the title GeneratorInterface/LHEInterface : gcc 6.0 misleading-indentation warning flags potential bug; with bug fix for incorrectly places curly brace GeneratorInterface/LHEInterface : bug fix for incorrectly placed curly brace flagged by gcc 6.0 indentation warning Jun 29, 2016
@cmsbuild
Copy link
Contributor

Pull request #15065 was updated. @covarell, @perrozzi, @thuer, @cmsbuild, @davidlange6, @govoni can you please check and sign again.

@gartung gartung changed the title GeneratorInterface/LHEInterface : bug fix for incorrectly placed curly brace flagged by gcc 6.0 indentation warning GeneratorInterface/LHEInterface : formatting fix for statements flagged by gcc 6.0 indentation warning Jun 30, 2016
@davidlange6
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 5, 2016

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/14382/console

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 5, 2016

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 5, 2016

@davidlange6 davidlange6 merged commit 80962a2 into cms-sw:CMSSW_8_1_X Aug 9, 2016
@gartung gartung deleted the GeneratorInterface-LHEInterface-fix-indent-not-guard branch August 9, 2016 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants