From 80dd9a61a11fcc5b46fc44c8565511797ecb8d40 Mon Sep 17 00:00:00 2001 From: Bruno Donassolo Date: Mon, 7 Jun 2021 10:08:30 +0200 Subject: [PATCH] Please sonar --- examples/platforms/griffon.cpp | 9 +++++---- examples/platforms/routing_cluster.cpp | 6 +++--- src/s4u/s4u_Engine.cpp | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/platforms/griffon.cpp b/examples/platforms/griffon.cpp index c821a4f606..d326305dd1 100644 --- a/examples/platforms/griffon.cpp +++ b/examples/platforms/griffon.cpp @@ -19,10 +19,11 @@ namespace sg4 = simgrid::s4u; * @return netzone,router the created netzone and its router */ static std::pair -create_cabinet(sg4::NetZone* root, const std::string& name, const std::vector& radicals) +create_cabinet(const sg4::NetZone* root, const std::string& name, const std::vector& radicals) { auto* cluster = sg4::create_star_zone(name); - std::string prefix = "griffon-", suffix = ".nancy.grid5000.fr"; + std::string prefix = "griffon-"; + std::string suffix = ".nancy.grid5000.fr"; cluster->set_parent(root); /* create the backbone link */ @@ -32,7 +33,7 @@ create_cabinet(sg4::NetZone* root, const std::string& name, const std::vectorcreate_host(hostname, "286.087kf"); + const sg4::Host* host = cluster->create_host(hostname, "286.087kf"); /* create UP/DOWN link */ sg4::Link* l_up = cluster->create_link(hostname + "_up", "125MBps")->set_latency("24us")->seal(); sg4::Link* l_down = cluster->create_link(hostname + "_down", "125MBps")->set_latency("24us")->seal(); @@ -52,7 +53,7 @@ create_cabinet(sg4::NetZone* root, const std::string& name, const std::vector& hosts, - const std::string& single_link_host) +static void create_cluster(const sg4::NetZone* root, const std::string& cluster_suffix, + const std::vector& hosts, const std::string& single_link_host) { auto* cluster = sg4::create_star_zone("cluster" + cluster_suffix); cluster->set_parent(root); @@ -29,7 +29,7 @@ static void create_cluster(sg4::NetZone* root, const std::string& cluster_suffix /* create all hosts and connect them to outside world */ for (const auto& hostname : hosts) { /* create host */ - sg4::Host* host = cluster->create_host(hostname, std::vector{1e9}); + const sg4::Host* host = cluster->create_host(hostname, std::vector{1e9}); /* create UP link */ sg4::Link* l_up = cluster->create_link(hostname + "_up", std::vector{1.25e8})->set_latency(0.0001)->seal(); /* create DOWN link, if needed */ diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index bc91b662b6..51975c0bd6 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -119,9 +119,9 @@ void Engine::load_platform(const std::string& platf) const #else void* handle = dlopen(platf.c_str(), RTLD_LAZY); xbt_assert(handle, "Impossible to open platform file: %s", platf.c_str()); - typedef void (*load_fct_t)(const Engine&); + using load_fct_t = void (*)(const Engine&); dlerror(); - load_fct_t callable = (load_fct_t)dlsym(handle, "load_platform"); + auto callable = (load_fct_t)dlsym(handle, "load_platform"); const char* dlsym_error = dlerror(); xbt_assert(not dlsym_error, "Error: %s", dlsym_error); callable(*this); -- 2.20.1