Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Minor sonar smells, and other cosmetics.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 28 Feb 2022 14:38:28 +0000 (15:38 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 28 Feb 2022 15:00:43 +0000 (16:00 +0100)
examples/cpp/synchro-mutex/s4u-synchro-mutex.cpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/actor/SynchroObserver.cpp
src/mc/mc_record.cpp
src/mc/mc_record.hpp
src/mc/remote/AppSide.cpp
src/mc/transition/TransitionSynchro.cpp
src/simix/popping.cpp
teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp

index 9c7d4f6..3176526 100644 (file)
@@ -5,10 +5,10 @@
 
 #include "simgrid/s4u.hpp" /* All of S4U */
 #include "xbt/config.hpp"
-namespace sg4 = simgrid::s4u;
-
 #include <mutex> /* std::mutex and std::lock_guard */
 
+namespace sg4 = simgrid::s4u;
+
 static simgrid::config::Flag<int> cfg_actor_count("actors", "How many pairs of actors should be started?", 6);
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
index 6da6349..d2bb001 100644 (file)
@@ -90,7 +90,7 @@ public:
   // Support for the boost::intrusive_ptr<ActivityImpl> datatype
   friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
   friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
-  int get_refcount() { return refcount_; } // For debugging purpose
+  int get_refcount() const { return refcount_; } // For debugging purpose
 
   static xbt::signal<void(ActivityImpl const&)> on_suspended;
   static xbt::signal<void(ActivityImpl const&)> on_resumed;
index a1c0be4..a0bc2c4 100644 (file)
@@ -25,7 +25,7 @@ MutexObserver::MutexObserver(ActorImpl* actor, mc::Transition::Type type, activi
 
 void MutexObserver::serialize(std::stringstream& stream) const
 {
-  auto* owner = get_mutex()->get_owner();
+  const auto* owner = get_mutex()->get_owner();
   stream << (short)type_ << ' ' << get_mutex()->get_id() << ' ' << (owner != nullptr ? owner->get_pid() : -1);
 }
 
index dbc8e7c..71729c7 100644 (file)
@@ -21,11 +21,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_record, mc, "Logging specific to MC record/re
 namespace simgrid {
 namespace mc {
 
-void RecordTrace::replay()
+void RecordTrace::replay() const
 {
   simgrid::mc::execute_actors();
 
-  for (simgrid::mc::Transition* const transition : transitions_) {
+  for (const simgrid::mc::Transition* transition : transitions_) {
     XBT_DEBUG("Executing %ld$%i", transition->aid_, transition->times_considered_);
 
     // Choose a request:
index 5b162d6..e63da61 100644 (file)
@@ -39,7 +39,7 @@ public:
   void push_back(Transition* t) { transitions_.push_back(t); }
 
   /** Replay all transitions of a trace */
-  void replay();
+  void replay() const;
 
   /** Parse and replay a string representation */
   static void replay(const std::string& trace);
index ae14cf9..afca0e3 100644 (file)
@@ -121,7 +121,6 @@ void AppSide::handle_simcall_execute(const s_mc_message_simcall_execute_t* messa
 
   XBT_DEBUG("send SIMCALL_EXECUTE_ANSWER(%s) ~> '%s'", actor->get_cname(), str.c_str());
   xbt_assert(channel_.send(answer) == 0, "Could not send response");
-
 }
 
 void AppSide::handle_actor_enabled(const s_mc_message_actor_enabled_t* msg) const
index 88c27ce..363db94 100644 (file)
@@ -27,14 +27,12 @@ MutexTransition::MutexTransition(aid_t issuer, int times_considered, Type type,
 
 bool MutexTransition::depends(const Transition* o) const
 {
-
   if (o->type_ < type_)
     return o->depends(this);
 
   // type_ <= other->type_ in  MUTEX_LOCK, MUTEX_TEST, MUTEX_TRYLOCK, MUTEX_UNLOCK, MUTEX_WAIT,
 
   if (auto* other = dynamic_cast<const MutexTransition*>(o)) {
-
     // Theorem 4.4.7: Any pair of synchronization actions of distinct actors concerning distinct mutexes are independent
     if (mutex_ != other->mutex_)
       return false;
index 93544f8..74bf611 100644 (file)
@@ -42,7 +42,6 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)
 const char* SIMIX_simcall_name(const s_smx_simcall& simcall)
 {
   if (simcall.observer_ != nullptr) {
-
     static std::string name;
     name              = boost::core::demangle(typeid(*simcall.observer_).name());
     const char* cname = name.c_str();
index c680bb0..50c1f4c 100644 (file)
@@ -36,7 +36,7 @@ static simgrid::config::Flag<int> cfg_task_count{"task-count", "Amount of tasks
 int todo; // remaining amount of tasks to execute, a global variable
 sg4::Mailbox* mailbox; // as a global to reduce the amount of simcalls during actor reboot
 
-static void master()
+XBT_ATTRIB_NORETURN static void master()
 {
   double comp_size = 1e6;
   long comm_size   = 1e6;
@@ -90,7 +90,6 @@ static void worker(int id)
       todo--;
     } catch (const simgrid::TimeoutException&) {
       XBT_INFO("Timeouted while getting a task.");
-
     } catch (const simgrid::NetworkFailureException&) {
       XBT_INFO("Got a NetworkFailureException. Wait a second before starting again.");
       sg4::this_actor::sleep_for(1);
@@ -122,7 +121,7 @@ int main(int argc, char* argv[])
     }
   }
   rootzone->seal();
-  sg4::Engine::get_instance()->on_platform_created(); // FIXME this should not be necessary
+  sg4::Engine::on_platform_created(); // FIXME this should not be necessary
 
   sg4::Actor::create("master", main, master)->set_auto_restart(true);
   int id = 0;