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] Fix compilation error with LLVM 9.0.1 #28795

Merged
merged 1 commit into from
Jan 27, 2020
Merged

Conversation

smuzaffar
Copy link
Contributor

Fix compilation error [a] which we see while using LLVM 9.0.1

[a]

In file included from CMSSW_11_1_CLANG_X_2020-01-17-2300/src/SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h:47:
  CMSSW_11_1_CLANG_X_2020-01-17-2300/src/DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h:25:17: error: result of comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-unsigned-enum-zero-compare]
     if (hitType >= 0 && hitType <= 2)
        ~~~~~~~ ^  ~

@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-28795/13480

  • This PR adds an extra 8KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @smuzaffar (Malik Shahzad Muzaffar) for master.

It involves the following packages:

DataFormats/TrackerRecHit2D

@perrotta, @cmsbuild, @slava77 can you please review it and eventually sign? Thanks.
@makortel, @gpetruc, @rovere, @VinInn this is something you requested to watch as well.
@davidlange6, @silviodonato, @fabiocos you are the release manager for this.

cms-bot commands are listed here

@perrotta
Copy link
Contributor

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 27, 2020

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-run-pr-tests/4357/console Started: 2020/01/27 09:32

@cmsbuild
Copy link
Contributor

+1
Tested at: e7a3d83
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-39c678/4357/summary.html
CMSSW: CMSSW_11_1_X_2020-01-26-2300
SCRAM_ARCH: slc7_amd64_gcc820

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-39c678/4357/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 34
  • DQMHistoTests: Total histograms compared: 2697090
  • DQMHistoTests: Total failures: 1
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2696743
  • DQMHistoTests: Total skipped: 346
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 33 files compared)
  • Checked 147 log files, 16 edm output root files, 34 DQM output files

@perrotta
Copy link
Contributor

+1

  • Trivial fix
  • Jenkins tests pass

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

@@ -22,7 +22,7 @@ namespace fastTrackerRecHitType {
siStripProjectedStereo2D = 5,
};
inline trackerHitRTTI::RTTI rtti(HitType hitType) {
if (hitType >= 0 && hitType <= 2)
if (hitType >= siPixel && hitType <= siStrip2D)
Copy link
Contributor

Choose a reason for hiding this comment

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

So comparing to literal 0 is bad, but comparing to siPixel that has a value 0 is fine? I mean, hitType >= siPixel is still a tautology assuming the caller passes only valid HitType values.

(I'm not objecting the proposed fix, just wondering out loud)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes @makortel , at least llvm does not complain any more. May be the check should be change to

if (hitType <= siStrip2D)
or
if (hitType <= 2)

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree this behavior looks a bit weird. However, since LLVM does not complain anymore, I would keep if (hitType >= siPixel && hitType <= siStrip2D). It seems more clear to me.

@silviodonato
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 8b29196 into master Jan 27, 2020
@smuzaffar smuzaffar deleted the smuzaffar-patch-2 branch February 13, 2020 13:35
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.

5 participants