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

Improved const-correctness of FWCore/Services globals #35577

Merged
merged 1 commit into from
Oct 8, 2021
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
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