Skip to content

Commit

Permalink
Merge pull request #35577 from Dr15Jones/constCorrectFWCoreGlobals
Browse files Browse the repository at this point in the history
Improved const-correctness of FWCore/Services globals
  • Loading branch information
cmsbuild authored Oct 8, 2021
2 parents 515458c + 93855a5 commit ac1544c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions FWCore/Services/plugins/InitRootHandlers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ namespace edm {
static std::atomic<std::size_t> nextModule_, doneModules_;

private:
static char* const* getPstackArgv();
static char const* const* getPstackArgv();
void enableWarnings_() override;
void ignoreWarnings_(edm::RootHandlers::SeverityLevel level) override;
void willBeUsingThreads() override;

void cachePidInfo();
static void stacktraceHelperThread();

static const int pidStringLength_ = 200;
static constexpr int pidStringLength_ = 200;
static char pidString_[pidStringLength_];
static char* const pstackArgv_[];
static char const* const pstackArgv_[];
static int parentToChild_[2];
static int childToParent_[2];
static std::unique_ptr<std::thread> helperThread_;
Expand Down Expand Up @@ -156,7 +156,7 @@ namespace edm {
namespace {
thread_local edm::RootHandlers::SeverityLevel s_ignoreWarnings = edm::RootHandlers::SeverityLevel::kInfo;

bool s_ignoreEverything = false;
constexpr bool s_ignoreEverything = false;

template <std::size_t SIZE>
bool find_if_string(const std::string& search, const std::array<const char* const, SIZE>& substrs) {
Expand Down Expand Up @@ -735,7 +735,7 @@ namespace edm {
int cmssw_stacktrace(void* /*arg*/) {
set_default_signals();

char* const* argv = edm::service::InitRootHandlers::getPstackArgv();
char const* const* argv = edm::service::InitRootHandlers::getPstackArgv();
// NOTE: this is NOT async-signal-safe at CERN's lxplus service.
// CERN uses LD_PRELOAD to replace execv with a function from libsnoopy which
// calls dlsym.
Expand All @@ -748,10 +748,10 @@ namespace edm {
return 1;
}

static char pstackName[] = "(CMSSW stack trace helper)";
static char dashC[] = "-c";
static constexpr char pstackName[] = "(CMSSW stack trace helper)";
static constexpr char dashC[] = "-c";
char InitRootHandlers::pidString_[InitRootHandlers::pidStringLength_] = {};
char* const InitRootHandlers::pstackArgv_[] = {pstackName, dashC, InitRootHandlers::pidString_, nullptr};
char const* const InitRootHandlers::pstackArgv_[] = {pstackName, dashC, InitRootHandlers::pidString_, nullptr};
int InitRootHandlers::parentToChild_[2] = {-1, -1};
int InitRootHandlers::childToParent_[2] = {-1, -1};
std::unique_ptr<std::thread> InitRootHandlers::helperThread_;
Expand Down Expand Up @@ -909,7 +909,7 @@ namespace edm {
descriptions.add("InitRootHandlers", desc);
}

char* const* InitRootHandlers::getPstackArgv() { return pstackArgv_; }
char const* const* InitRootHandlers::getPstackArgv() { return pstackArgv_; }

void InitRootHandlers::enableWarnings_() { s_ignoreWarnings = edm::RootHandlers::SeverityLevel::kInfo; }

Expand Down
2 changes: 1 addition & 1 deletion FWCore/Services/plugins/StallMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ namespace edm {
} // namespace edm

namespace {
constexpr char const* filename_default{""};
constexpr char const* const filename_default{""};
constexpr double threshold_default{0.1}; //default threashold in seconds
std::string const space{" "};
} // namespace
Expand Down

0 comments on commit ac1544c

Please sign in to comment.