Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] constify
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 8 Feb 2022 10:12:05 +0000 (11:12 +0100)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 8 Feb 2022 10:12:05 +0000 (11:12 +0100)
MANIFEST.in
src/kernel/EngineImpl.cpp
src/kernel/activity/ActivityImpl.cpp
src/kernel/actor/SimcallObserver.cpp

index d000497..4b721fc 100644 (file)
@@ -2335,6 +2335,7 @@ include src/mc/ModelChecker.cpp
 include src/mc/ModelChecker.hpp
 include src/mc/Session.cpp
 include src/mc/Session.hpp
+include src/mc/Transition.cpp
 include src/mc/Transition.hpp
 include src/mc/VisitedState.cpp
 include src/mc/VisitedState.hpp
index 16b2c48..4e872cf 100644 (file)
@@ -542,7 +542,7 @@ void EngineImpl::display_all_actor_status() const
   /*  List the actors and their state */
   XBT_INFO("Legend of the following listing: \"Actor <pid> (<name>@<host>): <status>\"");
   for (auto const& kv : actor_list_) {
-    actor::ActorImpl* actor = kv.second;
+    const actor::ActorImpl* actor = kv.second;
 
     if (actor->waiting_synchro_) {
       const char* synchro_description = "unknown";
index ed1f237..22402f0 100644 (file)
@@ -219,7 +219,6 @@ void ActivityImpl::handle_activity_waitany(smx_simcall_t simcall)
     if (not MC_is_active() && not MC_record_replay_is_active()) {
       auto element   = std::find(activities.begin(), activities.end(), this);
       int rank       = element != activities.end() ? static_cast<int>(std::distance(activities.begin(), element)) : -1;
-      auto* observer = dynamic_cast<kernel::actor::ActivityWaitanySimcall*>(simcall->observer_);
       observer->set_result(rank);
     }
   }
index d6795b4..d0dfbd6 100644 (file)
@@ -203,7 +203,7 @@ bool ActivityTestSimcall::depends(SimcallObserver* other)
   if (dynamic_cast<ActivityTestSimcall*>(other))
     return true;
 
-  auto* comm1 = dynamic_cast<activity::CommImpl*>(activity_);
+  const auto* comm1 = dynamic_cast<activity::CommImpl*>(activity_);
   if (comm1 == nullptr)
     return false;
 
@@ -214,8 +214,8 @@ bool ActivityTestSimcall::depends(SimcallObserver* other)
   if (comm1->src_buff_ == nullptr || comm1->dst_buff_ == nullptr)
     return false;
 
-  if (auto* test = dynamic_cast<ActivityTestSimcall*>(other)) {
-    auto* comm2 = dynamic_cast<activity::CommImpl*>(test->get_activity());
+  if (const auto* test = dynamic_cast<ActivityTestSimcall*>(other)) {
+    const auto* comm2 = dynamic_cast<activity::CommImpl*>(test->get_activity());
     if (comm2 == nullptr)
       return false;
     else if (comm2->src_buff_ == nullptr || comm2->dst_buff_ == nullptr)
@@ -264,8 +264,8 @@ std::string ActivityTestSimcall::to_string(int times_considered) const
 
 std::string ActivityTestSimcall::dot_label(int times_considered) const
 {
-  std::string res = SimcallObserver::dot_label(times_considered) + "Test ";
-  auto* comm      = dynamic_cast<activity::CommImpl*>(activity_);
+  std::string res  = SimcallObserver::dot_label(times_considered) + "Test ";
+  const auto* comm = dynamic_cast<activity::CommImpl*>(activity_);
   if (comm && (comm->src_actor_.get() == nullptr || comm->dst_actor_.get() == nullptr)) {
     res += "FALSE";
   } else {
@@ -305,11 +305,11 @@ bool ActivityWaitSimcall::depends(SimcallObserver* other)
     return irecv->depends(this);
 
   /* Timeouts in wait transitions are not considered by the independence theorem, thus assumed dependent */
-  if (auto* wait = dynamic_cast<ActivityWaitSimcall*>(other)) {
+  if (const auto* wait = dynamic_cast<ActivityWaitSimcall*>(other)) {
     if (timeout_ > 0 || wait->get_timeout() > 0)
       return true;
-    auto* comm1 = dynamic_cast<activity::CommImpl*>(activity_);
-    auto* comm2 = dynamic_cast<activity::CommImpl*>(wait->get_activity());
+    const auto* comm1 = dynamic_cast<activity::CommImpl*>(activity_);
+    const auto* comm2 = dynamic_cast<activity::CommImpl*>(wait->get_activity());
 
     if (comm1 == nullptr || comm2 == nullptr) // One wait at least in not on a Comm
       return true;
@@ -356,7 +356,7 @@ std::string ActivityWaitSimcall::dot_label(int times_considered) const
   std::string res = SimcallObserver::dot_label(times_considered);
   res += (times_considered == -1) ? "WaitTimeout " : "Wait ";
 
-  auto* comm = dynamic_cast<activity::CommImpl*>(activity_);
+  const auto* comm = dynamic_cast<activity::CommImpl*>(activity_);
   if (comm) {
     auto src = comm->src_actor_;
     auto dst = comm->dst_actor_;
@@ -424,7 +424,7 @@ bool CommIsendSimcall::depends(SimcallObserver* other)
   if (get_issuer() == other->get_issuer())
     return false;
 
-  if (auto* other_isend = dynamic_cast<CommIsendSimcall*>(other))
+  if (const auto* other_isend = dynamic_cast<CommIsendSimcall*>(other))
     return mbox_ == other_isend->get_mailbox();
 
   // FIXME: Not in the former dependency check because of the ordering but seems logical to add it
@@ -432,10 +432,10 @@ bool CommIsendSimcall::depends(SimcallObserver* other)
     return false;
 
 #if SIMGRID_HAVE_MC // FIXME needed to access mbox_cpy
-  if (auto* wait = dynamic_cast<ActivityWaitSimcall*>(other)) {
-    if (auto* comm2 = dynamic_cast<activity::CommImpl*>(wait->get_activity())) { // this is a Comm::wait_for
-      auto* mbox1 = mbox_;
-      auto* mbox2 = comm2->mbox_cpy;
+  if (const auto* wait = dynamic_cast<ActivityWaitSimcall*>(other)) {
+    if (const auto* comm2 = dynamic_cast<activity::CommImpl*>(wait->get_activity())) { // this is a Comm::wait_for
+      const auto* mbox1 = mbox_;
+      const auto* mbox2 = comm2->mbox_cpy;
 
       if (mbox1 != mbox2 && wait->get_timeout() <= 0)
         return false;
@@ -477,7 +477,7 @@ bool CommIrecvSimcall::depends(SimcallObserver* other)
   if (get_issuer() == other->get_issuer())
     return false;
 
-  if (auto* other_irecv = dynamic_cast<CommIrecvSimcall*>(other))
+  if (const auto* other_irecv = dynamic_cast<CommIrecvSimcall*>(other))
     return mbox_ == other_irecv->get_mailbox();
 
   if (auto* isend = dynamic_cast<CommIsendSimcall*>(other))
@@ -486,8 +486,8 @@ bool CommIrecvSimcall::depends(SimcallObserver* other)
 #if SIMGRID_HAVE_MC // FIXME needed to access mbox_cpy
   if (auto* wait = dynamic_cast<ActivityWaitSimcall*>(other)) {
     if (auto* comm2 = dynamic_cast<activity::CommImpl*>(wait->get_activity())) { // this is a Comm::wait_for
-      auto* mbox1 = mbox_;
-      auto* mbox2 = comm2->mbox_cpy;
+      const auto* mbox1 = mbox_;
+      const auto* mbox2 = comm2->mbox_cpy;
 
       if (mbox1 != mbox2 && wait->get_timeout() <= 0)
         return false;