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

[LLVM 9] Fixed build errors #28810

Merged
merged 1 commit into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class MillePedeFileReader {

const std::array<std::string, 8> coord_str = {{"X", "Y", "Z", "theta_X", "theta_Y", "theta_Z", "extra_DOF", "none"}};
inline std::ostream& operator<<(std::ostream& os, const AlignPCLThresholds::coordType& c) {
if (c >= AlignPCLThresholds::endOfTypes || c < 0)
if (c >= AlignPCLThresholds::endOfTypes || c < AlignPCLThresholds::X)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can drop || c<0 part as it is always false

Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h:172:48: error: result of comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-unsigned-enum-zero-compare]

Copy link
Contributor

@makortel makortel Jan 29, 2020

Choose a reason for hiding this comment

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

In principle the whole if statement seems to be redundant (unless something casts an integer into the enumeration without bounds checking)

enum coordType { X, Y, Z, theta_X, theta_Y, theta_Z, extra_DOF, endOfTypes };

return os << "unrecongnized coordinate";
return os << coord_str[c];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class EnergyScaleCorrection_class {
void ReadSmearingFromFile(TString filename); ///< File structure: category constTerm alpha;
public:
inline void SetSmearingType(fileFormat_t value) {
if (value >= 0 && value <= 1) {
if (value <= 1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

value >= 0 is always true as value is of type fileFormat_t enum.

EgammaAnalysis/ElectronTools/interface/EnergyScaleCorrection_class.h:195:15: error: result of comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-unsigned-enum-zero-compare]

smearingType_ = value;
} else {
smearingType_ = UNKNOWN;
Expand Down
2 changes: 1 addition & 1 deletion HLTrigger/JetMET/src/HLTJetSortedVBFFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ bool HLTJetSortedVBFFilter<T>::hltFilter(edm::Event& event,
nJet++;
// cout << "jetPt=" << jet->pt() << "\tjetEta=" << jet->eta() << "\tjetCSV=" << value << endl;
}
if (b1_idx >= sorted.size() || b1_idx < 0)
if (b1_idx >= sorted.size())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

b1_idx is unsigned int so b1_idx < 0 is always false

HLTrigger/JetMET/src/HLTJetSortedVBFFilter.cc:165:43: error: result of comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-unsigned-zero-compare]

edm::LogError("OutOfRange") << "b1 index out of range.";
sorted.erase(sorted.begin() + b1_idx); //remove the most b-tagged jet from "sorted"
sort(sorted.begin(), sorted.end(), comparator); //sort "sorted" by eta
Expand Down
2 changes: 1 addition & 1 deletion RecoEgamma/EgammaTools/src/EnergyScaleCorrection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void EnergyScaleCorrection::addSmearing(const std::string& category,
}

void EnergyScaleCorrection::setSmearingType(FileFormat value) {
if (value >= 0 && value <= 1) {
if (value <= 1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

value >= 0 is always true as value is of type FileFormat enum.

RecoEgamma/EgammaTools/src/EnergyScaleCorrection.cc:174:13: error: result of comparison of unsigned enum expression >= 0 is always true [-Werror,-Wtautological-unsigned-enum-zero-compare]

smearingType_ = value;
} else {
smearingType_ = UNKNOWN;
Expand Down
2 changes: 0 additions & 2 deletions RecoTauTag/RecoTau/plugins/DPFIsolation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ class DPFIsolation : public deep_tau::DeepTauBase {

if (p.pt() < 0.5)
continue;
if (p.fromPV() < 0)
continue;
Copy link
Contributor Author

@smuzaffar smuzaffar Jan 28, 2020

Choose a reason for hiding this comment

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

p.fromPV() returns PVAssoc enum which is always >=0 ( https://cmssdt.cern.ch/lxr/source/DataFormats/PatCandidates/interface/PackedCandidate.h#0703 )

RecoTauTag/RecoTau/plugins/DPFIsolation.cc:171:24: error: result of comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-unsigned-enum-zero-compare]

Copy link
Contributor

Choose a reason for hiding this comment

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

unless the check was supposed to be p.fromPV() == 0 (and p.fromPV() <= 1 below) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ocolegrove @MRD2F @mbluj
It appears that a check "p.fromPV() < 0" is redundant.
please double-check that we are not hiding some problem in your original code.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it is fine the remove the p.fromPV() < 0 redundant check.

if (deltaR_tau_p > 0.5)
continue;
if (p.fromPV() < 1 && p.charge() != 0)
Expand Down