Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use auto return type deduction.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 25 Jan 2021 12:21:17 +0000 (13:21 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 25 Jan 2021 13:49:10 +0000 (14:49 +0100)
src/mc/mc_replay.hpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
src/xbt/log.cpp

index 4d09362..823d93e 100644 (file)
@@ -13,7 +13,7 @@
  *  This is using the format generated by traceToString().
  *  Use a function to avoid static initialization order fiasco.
  */
-inline std::string& MC_record_path()
+inline auto& MC_record_path()
 {
   static std::string value;
   return value;
index fd6fc5e..2f74981 100644 (file)
@@ -34,13 +34,6 @@ std::vector<simgrid::kernel::resource::Model*> all_existing_models; /* to destro
 simgrid::kernel::profile::FutureEvtSet future_evt_set;
 std::vector<std::string> surf_path;
 
-/** set of hosts for which one want to be notified if they ever restart */
-std::set<std::string, std::less<>>& watched_hosts() // avoid static initialization order fiasco
-{
-  static std::set<std::string, std::less<>> value;
-  return value;
-}
-
 extern std::map<std::string, simgrid::kernel::resource::StorageType*, std::less<>> storage_types;
 
 std::vector<surf_model_description_t>* surf_plugin_description = nullptr;
index 0845b54..82137d8 100644 (file)
@@ -30,7 +30,13 @@ extern XBT_PRIVATE double sg_bandwidth_factor;
 extern XBT_PRIVATE double sg_weight_S_parameter;
 extern XBT_PRIVATE std::vector<std::string> surf_path;
 extern XBT_PRIVATE std::unordered_map<std::string, simgrid::kernel::profile::Profile*> traces_set_list;
-XBT_PRIVATE std::set<std::string, std::less<>>& watched_hosts();
+
+/** set of hosts for which one want to be notified if they ever restart */
+inline auto& watched_hosts() // avoid static initialization order fiasco
+{
+  static std::set<std::string, std::less<>> value;
+  return value;
+}
 
 static inline void double_update(double* variable, double value, double precision)
 {
index fd8afa0..fa02f97 100644 (file)
@@ -39,7 +39,7 @@ struct xbt_log_setting_t {
 };
 
 // This function is here to avoid static initialization order fiasco
-static std::vector<xbt_log_setting_t>& xbt_log_settings()
+static auto& xbt_log_settings()
 {
   static std::vector<xbt_log_setting_t> value;
   return value;