Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce scope for variables.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 8 Feb 2023 10:10:09 +0000 (11:10 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 8 Feb 2023 10:10:09 +0000 (11:10 +0100)
src/smpi/bindings/smpi_mpi.cpp
src/surf/network_ns3.cpp

index 0957079..16e8250 100644 (file)
@@ -26,13 +26,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, "Logging specific to SMPI ,(mpi)
 
 #define NOT_YET_IMPLEMENTED_NOFAIL                                                                                     \
   {                                                                                                                    \
-    static bool warning_todo = true;                                                                                   \
-    if (warning_todo)                                                                                                  \
+    if (static bool warned_todo = false; not warned_todo) {                                                            \
       XBT_WARN("Not yet implemented: %s. "                                                                             \
                "Please contact the SimGrid team if support is needed. "                                                \
                "Run with --log=smpi_mpi.thresh:error to hide",                                                         \
                __func__);                                                                                              \
-    warning_todo = false;                                                                                              \
+      warned_todo = true;                                                                                              \
+    }                                                                                                                  \
     return MPI_SUCCESS;                                                                                                \
   }
 
index 6e84927..5ab5965 100644 (file)
@@ -262,16 +262,13 @@ static void routeCreation_cb(bool symmetrical, const simgrid::kernel::routing::N
     XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->get_cname(), link->get_bandwidth(), link->get_latency());
 
     ns3_add_direct_route(src, dst, link->get_bandwidth(), link->get_latency(), link->get_sharing_policy());
-  } else {
-    static bool warned_about_long_routes = false;
-
-    if (not warned_about_long_routes)
-      XBT_WARN("Ignoring a route between %s and %s of length %zu: Only routes of length 1 are considered with ns-3.\n"
-               "WARNING: You can ignore this warning if your hosts can still communicate when only considering routes "
-               "of length 1.\n"
-               "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently "
-               "ignored.",
-               src->get_cname(), dst->get_cname(), link_list.size());
+  } else if (static bool warned_about_long_routes = false; not warned_about_long_routes) {
+    XBT_WARN("Ignoring a route between %s and %s of length %zu: Only routes of length 1 are considered with ns-3.\n"
+             "WARNING: You can ignore this warning if your hosts can still communicate when only considering routes "
+             "of length 1.\n"
+             "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently "
+             "ignored.",
+             src->get_cname(), dst->get_cname(), link_list.size());
     warned_about_long_routes = true;
   }
 }