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

[clang][c++20] Fixed ambiguous-reversed-operator for PixelModuleName #45492

Merged

Conversation

smuzaffar
Copy link
Contributor

This PR should fix the clang IBs warnings [a].
@makortel @Dr15Jones , I don't know if this is the correct way to fix these warnings ... let me know if there is correct/better way

[a] https://cmssdt.cern.ch/SDT/cgi-bin/buildlogs/el8_amd64_gcc12/CMSSW_14_1_CLANG_X_2024-07-17-1700/CondFormats/SiPixelObjects

  src/CondFormats/SiPixelObjects/src/PixelFEDLink.cc:76:16: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'PixelBarrelName' and 'PixelBarrelName') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
    76 |       if (curr == prev) {
      |           ~~~~ ^  ~~~~
src/DataFormats/TrackerCommon/interface/PixelBarrelName.h:65:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
   65 |   bool operator==(const PixelModuleName&) const override;
      |        ^
  src/CondFormats/SiPixelObjects/src/PixelFEDLink.cc:81:18: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'PixelBarrelName' and 'PixelBarrelName') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
    81 |       if (!(curr == prev)) {
      |             ~~~~ ^  ~~~~
src/DataFormats/TrackerCommon/interface/PixelBarrelName.h:65:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
   65 |   bool operator==(const PixelModuleName&) const override;
      |        ^
  src/CondFormats/SiPixelObjects/src/PixelFEDLink.cc:108:18: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'PixelEndcapName' and 'PixelEndcapName') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
   108 |       if (!(curr == prev))
      |             ~~~~ ^  ~~~~
src/DataFormats/TrackerCommon/interface/PixelEndcapName.h:67:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
   67 |   bool operator==(const PixelModuleName&) const override;

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 18, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45492/40961

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

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • DataFormats/TrackerCommon (reconstruction)

@cmsbuild, @jfernan2, @mandrenguyen can you please review it and eventually sign? Thanks.
@JanFSchulte, @VinInn, @VourMa, @gpetruc, @missirol, @mmusich, @mtosi, @rovere 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

@smuzaffar
Copy link
Contributor Author

please test for CMSSW_14_1_CLANG_X

@makortel
Copy link
Contributor

Adding this overload is the right way to fix the "ambiguity", but looking at the implementation of operator==(const PixelModuleName& o) functions

bool PixelBarrelName::operator==(const PixelModuleName& o) const {
if (o.isBarrel()) {
const PixelBarrelName* other = dynamic_cast<const PixelBarrelName*>(&o);
return (other && thePart == other->thePart && theLayer == other->theLayer && theModule == other->theModule &&
theLadder == other->theLadder);
} else
return false;
}

bool PixelEndcapName::operator==(const PixelModuleName& o) const {
if (!o.isBarrel()) {
const PixelEndcapName* other = dynamic_cast<const PixelEndcapName*>(&o);
return (other && thePart == other->thePart && theDisk == other->theDisk && theBlade == other->theBlade &&
thePannel == other->thePannel && thePlaquette == other->thePlaquette);
} else
return false;
}

it would be better to have the overloads added in this PR to have the actual implementation of the comparison, and then have the "generic" comparison operator to call these overloads depending on PixelModuleName::isBarrel().

(I somewhat wonder though if the "generic" operator is actually being used after the addition of these overloads)

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45492/40969

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

@smuzaffar smuzaffar force-pushed the ambiguous-reversed-operator-PixelModuleName branch from f4f9d45 to 45fe07d Compare July 19, 2024 07:57
@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Pull request #45492 was updated. @civanch, @cmsbuild, @jfernan2, @mandrenguyen, @mdhildreth can you please check and sign again.

@smuzaffar
Copy link
Contributor Author

please test

@smuzaffar
Copy link
Contributor Author

please test for CMSSW_14_1_CLANG_X

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 28KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-504be8/40491/summary.html
COMMIT: 45fe07d
CMSSW: CMSSW_14_1_X_2024-07-18-2300/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45492/40491/install.sh to create a dev area with all the needed externals and cmssw changes.

  • DAS Queries: The DAS query tests failed, see the summary page for details.

Comparison Summary

Summary:

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-504be8/40492/summary.html
COMMIT: 45fe07d
CMSSW: CMSSW_14_1_CLANG_X_2024-07-18-2300/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45492/40492/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 709 lines to the logs
  • Reco comparison results: 37763 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3451730
  • DQMHistoTests: Total failures: 35567
  • DQMHistoTests: Total nulls: 120
  • DQMHistoTests: Total successes: 3416023
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.05 KiB( 48 files compared)
  • DQMHistoSizes: changed ( 140.043 ): -0.008 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 140.063 ): 0.004 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.042 ): 0.023 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.044 ): 0.043 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.046 ): -0.012 KiB JetMET/SUSYDQM
  • Checked 206 log files, 170 edm output root files, 49 DQM output files
  • TriggerResults: found differences in 7 / 47 workflows

@civanch
Copy link
Contributor

civanch commented Jul 19, 2024

@smuzaffar , is the warning fixed? Why we have too many difference in comparisons?

@smuzaffar
Copy link
Contributor Author

@civanch , yes warnings are gone https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-504be8/40492/build-logs/.

comparison diff here #45492 (comment) are due to CLANG vs Default IB, so these are expected.
Comparison differences here #45492 (comment) are due to dd4hep workflow

@civanch
Copy link
Contributor

civanch commented Jul 19, 2024

+1

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

@rappoccio
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit d6691c0 into cms-sw:master Jul 22, 2024
17 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.

6 participants