From 6d688fbbcc6a2bbca495f55c9059ca55e0b5eb98 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 12 Apr 2021 12:06:14 +0200 Subject: [PATCH] Minor Sonar smells. --- src/s4u/s4u_Host.cpp | 3 ++- src/surf/sg_platf.cpp | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 39fbe16c0d..72dcc0f2c7 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -319,13 +319,14 @@ Disk* Host::create_disk(const std::string& name, double read_bandwidth, double w Disk* Host::create_disk(const std::string& name, const std::string& read_bandwidth, const std::string& write_bandwidth) { - double d_read, d_write; + double d_read; try { d_read = xbt_parse_get_bandwidth("", 0, read_bandwidth.c_str(), nullptr, ""); } catch (const simgrid::ParseError&) { throw std::invalid_argument(std::string("Impossible to create disk: ") + name + std::string(". Invalid read bandwidth: ") + read_bandwidth); } + double d_write; try { d_write = xbt_parse_get_bandwidth("", 0, write_bandwidth.c_str(), nullptr, ""); } catch (const simgrid::ParseError&) { diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index eef11b53d6..b3e76c3a00 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -196,12 +196,13 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster std::string loopback_name = link_id + "_loopback"; XBT_DEBUG("", loopback_name.c_str(), cluster->loopback_bw); - simgrid::s4u::Link* loopback = current_zone->create_link(loopback_name, std::vector{cluster->loopback_bw}) - ->set_sharing_policy(simgrid::s4u::Link::SharingPolicy::FATPIPE) - ->set_latency(cluster->loopback_lat) - ->seal(); + auto* loopback = current_zone->create_link(loopback_name, std::vector{cluster->loopback_bw}) + ->set_sharing_policy(simgrid::s4u::Link::SharingPolicy::FATPIPE) + ->set_latency(cluster->loopback_lat) + ->seal() + ->get_impl(); - current_zone->add_private_link_at(current_zone->node_pos(rankId), {loopback->get_impl(), loopback->get_impl()}); + current_zone->add_private_link_at(current_zone->node_pos(rankId), {loopback, loopback}); } // add a limiter link (shared link to account for maximal bandwidth of the node) @@ -209,11 +210,10 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster std::string limiter_name = std::string(link_id) + "_limiter"; XBT_DEBUG("", limiter_name.c_str(), cluster->limiter_link); - simgrid::s4u::Link* limiter = - current_zone->create_link(limiter_name, std::vector{cluster->limiter_link})->seal(); + auto* limiter = + current_zone->create_link(limiter_name, std::vector{cluster->limiter_link})->seal()->get_impl(); - current_zone->add_private_link_at(current_zone->node_pos_with_loopback(rankId), - {limiter->get_impl(), limiter->get_impl()}); + current_zone->add_private_link_at(current_zone->node_pos_with_loopback(rankId), {limiter, limiter}); } // call the cluster function that adds the others links @@ -238,12 +238,13 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster std::string backbone_name = std::string(cluster->id) + "_backbone"; XBT_DEBUG("", backbone_name.c_str(), cluster->bb_bw, cluster->bb_lat); - simgrid::s4u::Link* backbone = current_zone->create_link(backbone_name, std::vector{cluster->bb_bw}) - ->set_sharing_policy(cluster->bb_sharing_policy) - ->set_latency(cluster->bb_lat) - ->seal(); + auto* backbone = current_zone->create_link(backbone_name, std::vector{cluster->bb_bw}) + ->set_sharing_policy(cluster->bb_sharing_policy) + ->set_latency(cluster->bb_lat) + ->seal() + ->get_impl(); - routing_cluster_add_backbone(backbone->get_impl()); + routing_cluster_add_backbone(backbone); } XBT_DEBUG(""); -- 2.20.1