Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sonar const's...
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 19 Apr 2021 20:02:38 +0000 (22:02 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 19 Apr 2021 20:02:38 +0000 (22:02 +0200)
src/kernel/routing/VivaldiZone.cpp
src/smpi/internals/smpi_utils.cpp
src/surf/sg_platf.cpp

index 9f27b1b..cb9beb4 100644 (file)
@@ -52,7 +52,7 @@ static inline double euclidean_dist_comp(double src_coord, double dst_coord)
 
 static const std::vector<double>& netpoint_get_coords(NetPoint* np)
 {
-  auto* coords = np->extension<vivaldi::Coords>();
+  const auto* coords = np->extension<vivaldi::Coords>();
   xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)",
              (np->is_netzone() ? "Netzone" : (np->is_host() ? "Host" : "Router")), np->get_cname(), np);
   return coords->coords;
@@ -65,8 +65,8 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out)
 
   std::string link_up        = "link_" + netpoint->get_name() + "_UP";
   std::string link_down      = "link_" + netpoint->get_name() + "_DOWN";
-  auto* linkUp               = create_link(link_up, std::vector<double>{bw_out})->seal();
-  auto* linkDown             = create_link(link_down, std::vector<double>{bw_in})->seal();
+  const auto* linkUp         = create_link(link_up, std::vector<double>{bw_out})->seal();
+  const auto* linkDown       = create_link(link_down, std::vector<double>{bw_in})->seal();
   add_route(netpoint, nullptr, nullptr, nullptr, {linkUp->get_impl()}, false);
   add_route(nullptr, netpoint, nullptr, nullptr, {linkDown->get_impl()}, false);
 }
index 67513e7..baf7373 100644 (file)
@@ -170,8 +170,8 @@ static void print_leaked_handles(){
     if (max > 0) { // we cannot trust F2C::lookup()->size() > F2C::get_num_default_handles() because some default
                    // handles are already freed at this point
       bool display_advice = false;
-      std::map<std::string, int> count;
-      for (auto & elem : handles){
+      std::map<std::string, int, std::less<>> count;
+      for (const auto& elem : handles) {
         std::string key = elem.second->name();
         if ((not xbt_log_no_loc) && (not elem.second->call_location().empty()))
           key+=" at "+ elem.second->call_location();
index 9a67956..1f6de49 100644 (file)
@@ -97,11 +97,11 @@ void sg_platf_new_peer(const simgrid::kernel::routing::PeerCreationArgs* args)
   auto* zone = dynamic_cast<simgrid::kernel::routing::VivaldiZone*>(current_routing);
   xbt_assert(zone, "<peer> tag can only be used in Vivaldi netzones.");
 
-  auto* peer = zone->create_host(args->id, std::vector<double>{args->speed})
-                   ->set_state_profile(args->state_trace)
-                   ->set_speed_profile(args->speed_trace)
-                   ->set_coordinates(args->coord)
-                   ->seal();
+  const auto* peer = zone->create_host(args->id, std::vector<double>{args->speed})
+                         ->set_state_profile(args->state_trace)
+                         ->set_speed_profile(args->speed_trace)
+                         ->set_coordinates(args->coord)
+                         ->seal();
 
   zone->set_peer_link(peer->get_netpoint(), args->bw_in, args->bw_out);
 }
@@ -290,10 +290,10 @@ void sg_platf_new_cabinet(const simgrid::kernel::routing::CabinetCreationArgs* a
     std::string id   = args->prefix + std::to_string(radical) + args->suffix;
     auto const* host = zone->create_host(id, std::vector<double>{args->speed})->seal();
 
-    auto* link_up =
+    const auto* link_up =
         zone->create_link("link_" + id + "_UP", std::vector<double>{args->bw})->set_latency(args->lat)->seal();
 
-    auto* link_down =
+    const auto* link_down =
         zone->create_link("link_" + id + "_DOWN", std::vector<double>{args->bw})->set_latency(args->lat)->seal();
 
     zone->add_private_link_at(host->get_netpoint()->id(), {link_up->get_impl(), link_down->get_impl()});