From 6f5199d14e3f1b6505d3e264257bfe64bd991ca7 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 19 Apr 2018 09:21:13 +0200 Subject: [PATCH 1/1] Remove redundant variable. Fix static initialization order fiasco when _sg_mc_record_path was initialized before MC_record_path. --- src/mc/mc_config.cpp | 5 ++--- src/mc/mc_config.hpp | 1 + src/mc/mc_record.cpp | 2 -- src/mc/mc_replay.hpp | 4 +++- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mc/mc_config.cpp b/src/mc/mc_config.cpp index fbe43122f6..4aebb9bd62 100644 --- a/src/mc/mc_config.cpp +++ b/src/mc/mc_config.cpp @@ -43,9 +43,8 @@ static void _mc_cfg_cb_check(const char* spec, bool more_check = true) } /* Replay (this part is enabled even if MC it disabled) */ -static simgrid::config::Flag _sg_mc_record_path{ - "model-check/replay", "Model-check path to replay (as reported by SimGrid when a violation is reported)", "", - [](const std::string& value) { MC_record_path = value; }}; +simgrid::config::Flag _sg_mc_record_path{ + "model-check/replay", "Model-check path to replay (as reported by SimGrid when a violation is reported)", ""}; simgrid::config::Flag _sg_mc_timeout{ "model-check/timeout", "Whether to enable timeouts for wait requests", false, diff --git a/src/mc/mc_config.hpp b/src/mc/mc_config.hpp index 0068a2c6e9..2402e5a869 100644 --- a/src/mc/mc_config.hpp +++ b/src/mc/mc_config.hpp @@ -10,6 +10,7 @@ /********************************** Configuration of MC **************************************/ extern "C" XBT_PUBLIC int _sg_do_model_check; +extern XBT_PUBLIC simgrid::config::Flag _sg_mc_record_path; extern XBT_PRIVATE simgrid::config::Flag _sg_do_model_check_record; extern XBT_PRIVATE simgrid::config::Flag _sg_mc_checkpoint; extern XBT_PUBLIC simgrid::config::Flag _sg_mc_sparse_checkpoint; diff --git a/src/mc/mc_record.cpp b/src/mc/mc_record.cpp index 07fb8d2ff3..51a699d486 100644 --- a/src/mc/mc_record.cpp +++ b/src/mc/mc_record.cpp @@ -36,8 +36,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_record, mc, " Logging specific to MC record/replay facility"); -std::string MC_record_path; - namespace simgrid { namespace mc { diff --git a/src/mc/mc_replay.hpp b/src/mc/mc_replay.hpp index 8be909989e..eb50e3f1d4 100644 --- a/src/mc/mc_replay.hpp +++ b/src/mc/mc_replay.hpp @@ -9,11 +9,13 @@ #include "xbt/base.h" #include +#include "src/mc/mc_config.hpp" + /** Replay path (if any) in string representation * * This is using the format generated by traceToString(). */ -XBT_PUBLIC_DATA std::string MC_record_path; +#define MC_record_path (_sg_mc_record_path.get()) /** Whether the replay mode is enabled */ static inline int MC_record_replay_is_active() -- 2.20.1