Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove redundant variable.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 07:21:13 +0000 (09:21 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 07:21:13 +0000 (09:21 +0200)
Fix static initialization order fiasco when _sg_mc_record_path was initialized
before MC_record_path.

src/mc/mc_config.cpp
src/mc/mc_config.hpp
src/mc/mc_record.cpp
src/mc/mc_replay.hpp

index fbe4312..4aebb9b 100644 (file)
@@ -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<std::string> _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<std::string> _sg_mc_record_path{
+    "model-check/replay", "Model-check path to replay (as reported by SimGrid when a violation is reported)", ""};
 
 simgrid::config::Flag<bool> _sg_mc_timeout{
     "model-check/timeout", "Whether to enable timeouts for wait requests", false,
index 0068a2c..2402e5a 100644 (file)
@@ -10,6 +10,7 @@
 
 /********************************** Configuration of MC **************************************/
 extern "C" XBT_PUBLIC int _sg_do_model_check;
+extern XBT_PUBLIC simgrid::config::Flag<std::string> _sg_mc_record_path;
 extern XBT_PRIVATE simgrid::config::Flag<bool> _sg_do_model_check_record;
 extern XBT_PRIVATE simgrid::config::Flag<int> _sg_mc_checkpoint;
 extern XBT_PUBLIC simgrid::config::Flag<bool> _sg_mc_sparse_checkpoint;
index 07fb8d2..51a699d 100644 (file)
@@ -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 {
 
index 8be9099..eb50e3f 100644 (file)
@@ -9,11 +9,13 @@
 #include "xbt/base.h"
 #include <string>
 
+#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()