Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A few Sonar smells.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 22 Mar 2022 13:52:36 +0000 (14:52 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 22 Mar 2022 14:40:38 +0000 (15:40 +0100)
include/simgrid/s4u/Barrier.hpp
src/mc/explo/DFSExplorer.cpp
src/s4u/s4u_Barrier.cpp
src/smpi/internals/smpi_utils.cpp

index 547f5d8..e066d41 100644 (file)
@@ -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 */
index 99da144..f3314fb 100644 (file)
@@ -69,7 +69,7 @@ std::vector<std::string> DFSExplorer::get_textual_trace() // override
 {
   std::vector<std::string> 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;
index d46df44..f22b711 100644 (file)
@@ -53,7 +53,7 @@ int Barrier::wait()
   }
 }
 
-std::string Barrier::to_string()
+std::string Barrier::to_string() const
 {
   return pimpl_->to_string();
 }
index 8d1fec4..95f0f0b 100644 (file)
@@ -357,9 +357,9 @@ int check_collectives_ordering(MPI_Comm comm, std::string call){
       collective_calls.emplace(comm->id(), std::vector<std::string>{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;