From: Arnaud Giersch Date: Wed, 8 Feb 2023 10:10:09 +0000 (+0100) Subject: Reduce scope for variables. X-Git-Tag: v3.34~566 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ab9ce434aa6e35babcf685161cdea7b4d2e1ee89 Reduce scope for variables. --- diff --git a/src/smpi/bindings/smpi_mpi.cpp b/src/smpi/bindings/smpi_mpi.cpp index 0957079e21..16e8250043 100644 --- a/src/smpi/bindings/smpi_mpi.cpp +++ b/src/smpi/bindings/smpi_mpi.cpp @@ -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; \ } diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 6e84927851..5ab5965842 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -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; } }