Skip to content

Commit a371106

Browse files
authored
Merge pull request #46358 from iarspider/iarspider-patches-20241011-2
[LLVM Analyzer][DB] Cleanup LLVM analyzer warnings
2 parents 47f5ec0 + 3d8512f commit a371106

File tree

7 files changed

+25
-32
lines changed

7 files changed

+25
-32
lines changed

CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "CondCore/CondDB/interface/Auth.h"
33
//
44
#include <cstdlib>
5+
#include <cassert>
56

67
namespace cond {
78

@@ -10,7 +11,9 @@ namespace cond {
1011
const std::string& authPath) {
1112
std::string ap = authPath;
1213
if (ap.empty()) {
13-
ap = std::string(std::getenv(cond::auth::COND_AUTH_PATH));
14+
char* auth_path_env = std::getenv(cond::auth::COND_AUTH_PATH);
15+
assert(auth_path_env);
16+
ap = std::string(auth_path_env);
1417
}
1518
auto ret = std::make_tuple(std::string(""), std::string(""), std::string(""));
1619
if (!ap.empty()) {

CondCore/CondDB/src/CoralMsgReporter.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ cond::persistency::CoralMsgReporter::CoralMsgReporter()
2626
// Use a non-default message level?
2727
if (getenv("CORAL_MSGLEVEL")) {
2828
// Check only the first char of the environment variable
29+
[[clang::suppress]]
2930
switch (*getenv("CORAL_MSGLEVEL")) {
3031
case '0':
3132
case 'n':

CondFormats/JetMETObjects/bin/JetResolution_t.cc

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
////////////////////////////////////////////////////////////////////////////////
88

99
#include "CondFormats/JetMETObjects/interface/JetResolution.h"
10+
#include "FWCore/ParameterSet/interface/FileInPath.h"
1011

1112
#include <TROOT.h>
1213
#include <TApplication.h>
@@ -61,20 +62,12 @@ int main(int argc, char** argv) {
6162
cout << "nevts: " << nevts << endl;
6263
cout << "gaussian: " << doGaussian << endl << endl;
6364

64-
string cmssw_base(std::getenv("CMSSW_BASE"));
65-
string cmssw_release_base(std::getenv("CMSSW_RELEASE_BASE"));
66-
string path = cmssw_base + "/src/CondFormats/JetMETObjects/data";
67-
struct stat st;
68-
if (stat(path.c_str(), &st) != 0)
69-
path = cmssw_release_base + "/src/CondFormats/JetMETObjects/data";
70-
if (stat(path.c_str(), &st) != 0) {
71-
cerr << "ERROR: tried to set path but failed, abort." << endl;
72-
return 0;
73-
}
74-
75-
string ptFileName = path + "/" + era + "_PtResolution_" + alg + ".txt";
76-
string etaFileName = path + "/" + era + "_EtaResolution_" + alg + ".txt";
77-
string phiFileName = path + "/" + era + "_PhiResolution_" + alg + ".txt";
65+
string ptFileName =
66+
edm::FileInPath("CondFormats/JetMETObjects/data/" + era + "_PtResolution_" + alg + ".txt").fullPath();
67+
string etaFileName =
68+
edm::FileInPath("CondFormats/JetMETObjects/data/" + era + "_EtaResolution_" + alg + ".txt").fullPath();
69+
string phiFileName =
70+
edm::FileInPath("CondFormats/JetMETObjects/data/" + era + "_PhiResolution_" + alg + ".txt").fullPath();
7871

7972
cout << ptFileName << endl;
8073
cout << etaFileName << endl;

CondTools/DT/src/DTPerformanceHandler.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ void DTPerformanceHandler::getNewObjects() {
7878
std::map<std::string, popcon::PayloadIOV>::iterator itag =
7979
mp.find( dataTag );
8080
*/
81+
if (runNumber <= last) {
82+
std::cout << "More recent data already present - skipped" << std::endl;
83+
return;
84+
}
8185

8286
DTPerformance* dtPerf = new DTPerformance(dataTag);
8387

@@ -125,13 +129,7 @@ void DTPerformanceHandler::getNewObjects() {
125129
*/
126130

127131
//for each payload provide IOV information (say in this case we use since)
128-
cond::Time_t snc = runNumber;
129-
if (runNumber > last)
130-
m_to_transfer.push_back(std::make_pair(dtPerf, snc));
131-
else
132-
std::cout << "More recent data already present - skipped" << std::endl;
133-
134-
return;
132+
m_to_transfer.emplace_back(dtPerf, runNumber);
135133
}
136134

137135
std::string DTPerformanceHandler::id() const { return dataTag; }

CondTools/DT/src/DTStatusFlagHandler.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ void DTStatusFlagHandler::getNewObjects() {
7676
std::map<std::string, popcon::PayloadIOV>::iterator itag =
7777
mp.find( dataTag );
7878
*/
79+
if (runNumber <= last) {
80+
std::cout << "More recent data already present - skipped" << std::endl;
81+
return;
82+
}
7983

8084
DTStatusFlag* stFlag = new DTStatusFlag(dataTag);
8185

@@ -122,13 +126,7 @@ void DTStatusFlagHandler::getNewObjects() {
122126
*/
123127

124128
//for each payload provide IOV information (say in this case we use since)
125-
cond::Time_t snc = runNumber;
126-
if (runNumber > last)
127-
m_to_transfer.push_back(std::make_pair(stFlag, snc));
128-
else
129-
std::cout << "More recent data already present - skipped" << std::endl;
130-
131-
return;
129+
m_to_transfer.emplace_back(stFlag, runNumber);
132130
}
133131

134132
std::string DTStatusFlagHandler::id() const { return dataTag; }

CondTools/SiPixel/plugins/SiPixelDynamicInefficiencyReader.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ void SiPixelDynamicInefficiencyReader::analyze(const edm::Event& e, const edm::E
197197
}
198198

199199
//DB PU factor calculation
200-
unsigned int pu_iterator = 0;
201-
for (it_pu = map_pufactor.begin(); it_pu != map_pufactor.end(); it_pu++, pu_iterator++) {
200+
it_pu = map_pufactor.begin();
201+
for (unsigned int pu_iterator = 0; pu_iterator < pu_det; it_pu++, pu_iterator++) {
202202
const DetId mapid = DetId(it_pu->first);
203203
if (mapid.subdetId() != detid.subdetId())
204204
continue;

CondTools/SiPixel/plugins/SiPixelGainCalibrationRejectNoisyAndDead.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase(const edm::EventSetu
225225
float gainforthiscol[2];
226226
float pedforthiscol[2];
227227
int nusedrows[2];
228-
int nrowsrocsplit;
228+
int nrowsrocsplit = 0;
229229
if (record_ == "SiPixelGainCalibrationOfflineRcd")
230230
nrowsrocsplit = theGainCalibrationDbInputOffline_->getNumberOfRowsToAverageOver();
231231
if (record_ == "SiPixelGainCalibrationForHLTRcd")

0 commit comments

Comments
 (0)