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

[WIP] [CPP20] Fix deprecated enum arithmetics #44469

Closed
wants to merge 1 commit into from

Conversation

iarspider
Copy link
Contributor

PR description:

In C++20, arithmetic and comparision operations between different enums, and between floating-point types and enum are deprecated:

src/DQM/CTPPS/plugins/TotemT2DQMSource.cc: In member function 'void TotemT2DQMSource::fillFlags(const TotemT2Digi&, const TotemT2DetId&)':
  src/DQM/CTPPS/plugins/TotemT2DQMSource.cc:381:47: warning: arithmetic between enumeration type 'TotemT2DQMSource::evFlag' and floating-point type 'double' is deprecated [-Wdeprecated-enum-float-conversion]
   381 |     sectorPlots_[secId].eventFlags->Fill(t2TE + 0.0);
      |                                          ~~~~~^~~~~
<...>
src/DQM/CTPPS/plugins/TotemTimingDQMSource.cc: In member function 'virtual void TotemTimingDQMSource::analyze(const edm::Event&, const edm::EventSetup&)':
  src/DQM/CTPPS/plugins/TotemTimingDQMSource.cc:622:27: warning: comparison of floating-point type 'float' with enumeration type 'TotemTimingRecHit::<unnamed enum>' is deprecated [-Wdeprecated-enum-float-conversion]
   622 |         if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) {
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/DQM/CTPPS/plugins/TotemTimingDQMSource.cc:679:25: warning: comparison of floating-point type 'float' with enumeration type 'TotemTimingRecHit::<unnamed enum>' is deprecated [-Wdeprecated-enum-float-conversion]
   679 |       if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE && potPlots_.find(detId_pot) != potPlots_.end() &&
      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PR validation:

Bot tests

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 19, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-44469/39553

  • This PR adds an extra 68KB 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-44469/39566

  • This PR adds an extra 68KB to repository

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • CalibFormats/SiStripObjects (alca)
  • Calibration/EcalCalibAlgos (alca)
  • CondCore/EcalPlugins (db)
  • CondCore/PCLConfigPlugins (db)
  • CondFormats/PCLConfig (alca, db)
  • DPGAnalysis/SiStripTools (analysis)
  • DQM/CTPPS (dqm)
  • Geometry/CaloEventSetup (geometry)

@nothingface0, @mdhildreth, @saumyaphor4252, @tvami, @cmsbuild, @antoniovagnerini, @francescobrivio, @bsunanda, @Dr15Jones, @tjavaid, @consuegs, @perrotta, @rvenditti, @makortel, @civanch, @syuvivida can you please review it and eventually sign? Thanks.
@mtosi, @thomreis, @jandrea, @wang0jin, @mmusich, @VinInn, @rsreds, @robervalwalsh, @rchatter, @venturia, @PonIlya, @bsunanda, @JanChyczynski, @fabiocos, @argiro, @seemasharmafnal, @yuanchao, @fabferro, @tocheng, @grzanka, @echabert, @JanFSchulte, @ReyerBand, @VourMa, @threus this is something you requested to watch as well.
@sextonkennedy, @antoniovilela, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-44469/39569

  • This PR adds an extra 304KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-44469/39571

  • This PR adds an extra 268KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

@cmsbuild
Copy link
Contributor

@iarspider iarspider closed this Mar 20, 2024
@iarspider
Copy link
Contributor Author

I think it's better to split it into several PRs.

@makortel
Copy link
Contributor

I think the alternative approach of converting enums to constexpr constants should be considered too (where it makes sense).

@iarspider iarspider deleted the cpp20-no-enum-arithmetics branch April 2, 2024 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment