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

[DQM] [Clang]Cleanup clang-analyzer warnings #46227

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

smuzaffar
Copy link
Contributor

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 3, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 3, 2024

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46227/42038

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 3, 2024

A new Pull Request was created by @smuzaffar for master.

It involves the following packages:

  • Validation/CaloTowers (dqm)
  • Validation/DTRecHits (dqm)
  • Validation/EcalClusters (dqm)
  • Validation/EcalDigis (dqm)
  • Validation/GlobalDigis (dqm)
  • Validation/HLTrigger (dqm)
  • Validation/MuonDTDigis (dqm)
  • Validation/RecoB (dqm)
  • Validation/RecoParticleFlow (dqm)

@antoniovagnerini, @cmsbuild, @nothingface0, @rvenditti, @syuvivida, @tjavaid can you please review it and eventually sign? Thanks.
@AlexDeMoor, @Ming-Yan, @ReyerBand, @Senphy, @abdoulline, @andrzejnovak, @argiro, @battibass, @castaned, @hatakeyamak, @missirol, @mmusich, @rchatter, @thomreis, @wang0jin this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@@ -163,6 +166,7 @@ int CaloTowersClient::CaloTowersEndjob(const std::vector<MonitorElement*>& hcalM

cnorm = sumphi / phi_factor;
enorm = sqrt(sumphie) / phi_factor;
assert(occupancy_vs_ieta);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cms-sw/dqm-l2 , may be there is better way to fix this code . All these pointers are not set in https://github.com/cms-sw/cmssw/blob/master/Validation/CaloTowers/src/CaloTowersClient.cc#L63-L87 block. So clang-analyzer warns that these might be null. For now I have added assert to instruct clang static analyzer that we fail if these are null

Choose a reason for hiding this comment

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

I think your proposed solution for the null pointer error handling is fine.

@@ -685,6 +686,7 @@ void DTRecHitQuality::compute(const DTGeometry &dtGeom,
}
}
// Fill
assert(hEff);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same here, just to make sure these pointers are not null

@@ -144,6 +144,7 @@ void EnergyScaleAnalyzer::analyze(const edm::Event &evt, const edm::EventSetup &
Labels l;
labelsForToken(hepMCLabel_, l);

[[clang::suppress]]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

genEvent is used later in the code. Clang static analyzer complains that if hepMC.isValid() is not valid then genEvent is not used. [[clang::suppress]] here instruct clang analyzer to ignore this warnings

@smuzaffar
Copy link
Contributor Author

There is one warning [a] in https://github.com/cms-sw/cmssw/blob/master/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc#L47 which I have not fixed. looks like we force set doPhotostatistics = false; and ignore the reading of doPhotostatistics from parameter set.

[a]

  src/Validation/EcalDigis/plugins/EcalMixingModuleValidation.cc:47:8: warning: Value stored to 'doPhotostatistics' during its initialization is never read [deadcode.DeadStores]
    47 |   bool doPhotostatistics = ps.getParameter<bool>("doPhotostatistics");

@@ -741,7 +741,7 @@ void GlobalDigisAnalyzer::fillECal(const edm::Event &iEvent, const edm::EventSet
bool validDigiES = true;
if (!EcalDigiES.isValid()) {
LogDebug(MsgLoggerCat) << "Unable to find EcalDigiES in event!";
validDigiES = false;
[[clang::suppress]] validDigiES = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

clang analyzer complains as we force set validDigiES = false; at few line later

@@ -1468,7 +1468,7 @@ void GlobalDigisAnalyzer::fillMuon(const edm::Event &iEvent, const edm::EventSet
bool validrpcdigi = true;
if (!rpcDigis.isValid()) {
LogDebug(MsgLoggerCat) << "Unable to find rpcDigis in event!";
validrpcdigi = false;
[[clang::suppress]] validrpcdigi = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

clang analyzer complains as we force set validrpcdigi = false; at few line later

@smuzaffar
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 3, 2024

+1

Size: This PR adds an extra 88KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-4bbee3/41936/summary.html
COMMIT: 49112cc
CMSSW: CMSSW_14_2_X_2024-10-03-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/46227/41936/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

@antoniovagnerini
Copy link

+1

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 7, 2024

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @antoniovilela, @rappoccio, @sextonkennedy, @mandrenguyen (and backports should be raised in the release meeting by the corresponding L2)

@mandrenguyen
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 2693035 into cms-sw:master Oct 7, 2024
11 checks passed
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