From bd139aa3a2599ff9cdb686fcf9f8da9206be4134 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 22 Mar 2022 14:52:36 +0100 Subject: [PATCH] A few Sonar smells. --- include/simgrid/s4u/Barrier.hpp | 2 +- src/mc/explo/DFSExplorer.cpp | 2 +- src/s4u/s4u_Barrier.cpp | 2 +- src/smpi/internals/smpi_utils.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/simgrid/s4u/Barrier.hpp b/include/simgrid/s4u/Barrier.hpp index 547f5d82d4..e066d41225 100644 --- a/include/simgrid/s4u/Barrier.hpp +++ b/include/simgrid/s4u/Barrier.hpp @@ -35,7 +35,7 @@ public: /** Blocks into the barrier. Every waiting actors will be unlocked once the expected amount of actors reaches the barrier */ int wait(); /** Returns some debug information about the barrier */ - std::string to_string(); + std::string to_string() const; #ifndef DOXYGEN /* refcounting */ diff --git a/src/mc/explo/DFSExplorer.cpp b/src/mc/explo/DFSExplorer.cpp index 99da14492c..f3314fb3dc 100644 --- a/src/mc/explo/DFSExplorer.cpp +++ b/src/mc/explo/DFSExplorer.cpp @@ -69,7 +69,7 @@ std::vector DFSExplorer::get_textual_trace() // override { std::vector trace; for (auto const& state : stack_) { - auto* t = state->get_transition(); + const auto* t = state->get_transition(); trace.push_back(xbt::string_printf("%ld: %s", t->aid_, t->to_string().c_str())); } return trace; diff --git a/src/s4u/s4u_Barrier.cpp b/src/s4u/s4u_Barrier.cpp index d46df442b8..f22b711945 100644 --- a/src/s4u/s4u_Barrier.cpp +++ b/src/s4u/s4u_Barrier.cpp @@ -53,7 +53,7 @@ int Barrier::wait() } } -std::string Barrier::to_string() +std::string Barrier::to_string() const { return pimpl_->to_string(); } diff --git a/src/smpi/internals/smpi_utils.cpp b/src/smpi/internals/smpi_utils.cpp index 8d1fec4204..95f0f0b831 100644 --- a/src/smpi/internals/smpi_utils.cpp +++ b/src/smpi/internals/smpi_utils.cpp @@ -357,9 +357,9 @@ int check_collectives_ordering(MPI_Comm comm, std::string call){ collective_calls.emplace(comm->id(), std::vector{call}); }else{ //are we the first ? add the call - if (vec->second.size() == (count)){ + if (vec->second.size() == count) { vec->second.push_back(call); - } else if (vec->second.size() > count){ + } else if (vec->second.size() > count) { if (vec->second[count] != call){ XBT_WARN("Collective operation mismatch. For process %ld, expected %s, got %s", simgrid::s4u::this_actor::get_pid(), vec->second[count].c_str(), call.c_str()); return MPI_ERR_OTHER; -- 2.20.1