From dc122c0fb3802061bc2fdb4abd50bf02a224cfdc Mon Sep 17 00:00:00 2001 From: Bruno Donassolo Date: Tue, 7 Dec 2021 11:44:11 +0100 Subject: [PATCH] Sonar code smells --- examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp | 2 +- include/smpi/smpi.h | 2 +- src/smpi/include/smpi_host.hpp | 2 +- src/smpi/internals/smpi_host.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp b/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp index ee4f0539da..a4be7c2363 100644 --- a/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp +++ b/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp @@ -19,7 +19,7 @@ namespace sg4 = simgrid::s4u; * @param src Source host (set by simgrid) * @param dst Source host (set by simgrid) */ -static double smpi_cost_cb(SmpiOperation op, double size, sg4::Host* src, sg4::Host* dst) +static double smpi_cost_cb(SmpiOperation op, size_t /*size*/, const sg4::Host* src, const sg4::Host* dst) { /* some dummy cost that depends on the operation and host */ static std::unordered_map read_cost = {{"Tremblay", 1}, {"Jupiter", 2}}; diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 895aab6360..0322577b82 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -1265,7 +1265,7 @@ XBT_PUBLIC void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommIm * @param source Source host * @param dst Destination host */ -using SmpiOpCostCb = std::function; +using SmpiOpCostCb = std::function; /** @brief SMPI functions that accept cost functions */ enum class SmpiOperation { RECV = 2, SEND = 1, ISEND = 0 }; /** diff --git a/src/smpi/include/smpi_host.hpp b/src/smpi/include/smpi_host.hpp index f8cc8d5ae1..2b2d7a30eb 100644 --- a/src/smpi/include/smpi_host.hpp +++ b/src/smpi/include/smpi_host.hpp @@ -25,7 +25,7 @@ class Host { * @brief Generates warning message if user's config is conflicting (callback vs command line/xml) * @param op String with config name (smpi/os, smpi/or, smpi/ois) */ - void check_factor_configs(const std::string op) const; + void check_factor_configs(const std::string& op) const; public: static xbt::Extension EXTENSION_ID; diff --git a/src/smpi/internals/smpi_host.cpp b/src/smpi/internals/smpi_host.cpp index 0f1cb3e2be..443c6859f8 100644 --- a/src/smpi/internals/smpi_host.cpp +++ b/src/smpi/internals/smpi_host.cpp @@ -120,7 +120,7 @@ double Host::oisend(size_t size, s4u::Host* src, s4u::Host* dst) return current; } -void Host::check_factor_configs(const std::string op) const +void Host::check_factor_configs(const std::string& op) const { static const std::unordered_map name_to_op_enum{ {"smpi/or", SmpiOperation::RECV}, {"smpi/os", SmpiOperation::SEND}, {"smpi/ois", SmpiOperation::ISEND}}; -- 2.20.1