Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please clang static analyser
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 24 Aug 2021 10:47:20 +0000 (12:47 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Tue, 24 Aug 2021 10:47:20 +0000 (12:47 +0200)
examples/cpp/comm-failure/s4u-comm-failure.cpp
examples/cpp/exec-failure/s4u-exec-failure.cpp

index cc9a127..ac12fd3 100644 (file)
@@ -44,9 +44,8 @@ public:
     std::vector<sg4::CommPtr> pending_comms;
     pending_comms.push_back(comm1);
     pending_comms.push_back(comm2);
-    long index;
     try {
-      index = sg4::Comm::wait_any(pending_comms);
+      long index = sg4::Comm::wait_any(pending_comms);
       XBT_INFO("Wait any returned index %ld (comm to %s)", index, pending_comms.at(index)->get_mailbox()->get_cname());
     } catch (simgrid::NetworkFailureException& e) {
       XBT_INFO("Sender has experienced a network failure exception, so it knows that something went wrong");
@@ -63,7 +62,7 @@ public:
     }
     XBT_INFO("Wait for remaining comm, just to be nice");
     pending_comms.erase(pending_comms.begin());
-    index = simgrid::s4u::Comm::wait_any(pending_comms);
+    simgrid::s4u::Comm::wait_any(pending_comms);
   }
 };
 
index f2f9b7e..9d5d1ad 100644 (file)
@@ -33,9 +33,8 @@ static void dispatcher(sg4::Host* host1, sg4::Host* host2)
   exec2->start();
 
   XBT_INFO("Calling wait_any..");
-  long index;
   try {
-    index = sg4::Exec::wait_any(pending_execs);
+    long index = sg4::Exec::wait_any(pending_execs);
     XBT_INFO("Wait any returned index %ld (exec on %s)", index, pending_execs.at(index)->get_host()->get_cname());
   } catch (simgrid::HostFailureException& e) {
     XBT_INFO("Dispatcher has experienced a host failure exception, so it knows that something went wrong");
@@ -52,7 +51,7 @@ static void dispatcher(sg4::Host* host1, sg4::Host* host2)
   }
   pending_execs.pop_back();
   XBT_INFO("Wait for remaining exec, just to be nice");
-  index = simgrid::s4u::Exec::wait_any(pending_execs);
+  simgrid::s4u::Exec::wait_any(pending_execs);
   XBT_INFO("Dispatcher ends");
 }