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

Utilities/StaticAnalyzers: Check for CMS_THREAD_SAFETY or CMS_SA_ALLOW attributes on statments using const_cast and skip warnings. #40204

Merged
merged 2 commits into from Nov 30, 2022

Conversation

gartung
Copy link
Member

@gartung gartung commented Nov 30, 2022

This adds a veto on ConstCastChecker and ConstCastAwayChecker using the CMS_THREAD_SAFETY or CMS_SA_ALLOW attributes at the beginning of statements using const_cast or casting const away.

For example

--- a/FWCore/Framework/src/EventSetupRecordIntervalFinder.cc
+++ b/FWCore/Framework/src/EventSetupRecordIntervalFinder.cc
@@ -12,6 +12,7 @@
 
 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
 #include "FWCore/Utilities/interface/Likely.h"
+#include "FWCore/Utilities/interface/thread_safety_macros.h"
 #include <cassert>
 #include <mutex>
 
@@ -67,7 +68,7 @@ namespace edm {
   std::set<EventSetupRecordKey> EventSetupRecordIntervalFinder::findingForRecords() const {
     if (intervals_.empty()) {
       //we are delaying our reading
-      const_cast<EventSetupRecordIntervalFinder*>(this)->delaySettingRecords();
+      CMS_SA_ALLOW const_cast<EventSetupRecordIntervalFinder*>(this)->delaySettingRecords();
     }

removes the warning about the use of const_cast.

Tested locally.

…W attributes on statments using const_cast and skip warnings.
@gartung
Copy link
Member Author

gartung commented Nov 30, 2022

@makortel

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40204/33222

  • This PR adds an extra 12KB to repository

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40204/33223

  • This PR adds an extra 12KB to repository

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • Utilities/StaticAnalyzers (core)

@cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please review it and eventually sign? Thanks.
@wddgit this is something you requested to watch as well.
@perrotta, @dpiparo, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@gartung
Copy link
Member Author

gartung commented Nov 30, 2022

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-0508ac/29357/summary.html
COMMIT: 5cfcf76
CMSSW: CMSSW_13_0_X_2022-11-30-1100/el8_amd64_gcc11
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/40204/29357/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 48
  • DQMHistoTests: Total histograms compared: 3421159
  • DQMHistoTests: Total failures: 3
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3421134
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 47 files compared)
  • Checked 206 log files, 48 edm output root files, 48 DQM output files
  • TriggerResults: no differences found

@makortel
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

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. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@perrotta
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 0cc6517 into cms-sw:master Nov 30, 2022
@gartung gartung deleted the gartung-SA-const-cast-attr branch December 7, 2022 14:26
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.

None yet

4 participants