Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
various sonar cleanups
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 24 Aug 2018 12:46:47 +0000 (14:46 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 24 Aug 2018 12:46:47 +0000 (14:46 +0200)
examples/msg/platform-failures/platform-failures.c
examples/s4u/exec-basic/s4u-exec-basic.cpp
examples/s4u/platform-properties/s4u-platform-properties.cpp
include/simgrid/s4u/Mutex.hpp

index f7656af..9da8dcd 100644 (file)
@@ -13,8 +13,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example")
 
 static int master(int argc, char *argv[])
 {
-  int i;
-
   long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
   double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
   double task_comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s");
@@ -22,7 +20,7 @@ static int master(int argc, char *argv[])
 
   XBT_INFO("Got %ld workers and %ld tasks to process", workers_count, number_of_tasks);
 
-  for (i = 0; i < number_of_tasks; i++) {
+  for (int i = 0; i < number_of_tasks; i++) {
     char mailbox[256];
     snprintf(mailbox, 255, "worker-%ld", i % workers_count);
     XBT_INFO("Send a message to %s", mailbox);
@@ -58,7 +56,7 @@ static int master(int argc, char *argv[])
   }
 
   XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
-  for (i = 0; i < workers_count; i++) {
+  for (int i = 0; i < workers_count; i++) {
     char mailbox[256];
     snprintf(mailbox, 255, "worker-%ld", i % workers_count);
     msg_task_t task = MSG_task_create("finalize", 0, 0, FINALIZE);
@@ -101,7 +99,6 @@ static int worker(int argc, char *argv[])
   snprintf(mailbox, 79,"worker-%ld", id);
 
   while (1) {
-    double time1 = MSG_get_clock();
     msg_task_t task = NULL;
     XBT_INFO("Waiting a message on %s", mailbox);
     int retcode = MSG_task_receive( &(task), mailbox);
@@ -110,8 +107,6 @@ static int worker(int argc, char *argv[])
         MSG_task_destroy(task);
         break;
       }
-      if (time1 < *((double *) task->data))
-        time1 = *((double *) task->data);
       XBT_INFO("Start execution...");
       retcode = MSG_task_execute(task);
       if (retcode == MSG_OK) {
index c27bb2d..d23af26 100644 (file)
@@ -38,7 +38,6 @@ static void privileged()
 int main(int argc, char* argv[])
 {
   simgrid::s4u::Engine e(&argc, argv);
-  std::vector<std::string> args;
   xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
 
   e.load_platform(argv[1]);
index 085464e..b0298ce 100644 (file)
@@ -51,30 +51,27 @@ static void test_host(std::string hostname)
   thehost->set_property(exist, "180");
 }
 
-static int alice(int argc, char* argv[])
+static void alice(std::vector<std::string> /*args*/)
 {
   /* Dump what we have on the current host */
   test_host("host1");
-  return 0;
 }
 
-static int carole(int argc, char* argv[])
+static void carole(std::vector<std::string> /*args*/)
 {
   /* Dump what we have on a remote host */
   simgrid::s4u::this_actor::sleep_for(1); // Wait for alice to be done with its experiment
   test_host("host1");
-  return 0;
 }
 
-static int david(int argc, char* argv[])
+static void david(std::vector<std::string> /*args*/)
 {
   /* Dump what we have on a remote host */
   simgrid::s4u::this_actor::sleep_for(2); // Wait for alice and carole to be done with its experiment
   test_host("node-0.acme.org");
-  return 0;
 }
 
-static int bob(int argc, char* argv[])
+static void bob(std::vector<std::string> /*args*/)
 {
   /* this host also tests the properties of the AS*/
   simgrid::s4u::NetZone* root = simgrid::s4u::Engine::get_instance()->get_netzone_root();
@@ -96,7 +93,6 @@ static int bob(int argc, char* argv[])
 
   value = simgrid::s4u::Actor::self()->get_property(noexist);
   xbt_assert(not value, "The property is defined (it should not)");
-  return 0;
 }
 
 int main(int argc, char* argv[])
index 5feed70..60c4525 100644 (file)
@@ -12,8 +12,6 @@
 namespace simgrid {
 namespace s4u {
 
-class ConditionVariable;
-
 /** @brief A classical mutex, but blocking in the simulation world
  *  @ingroup s4u_api
  *