From 65ab3b5aa9b78d6e4e5f1d595788b6393554d565 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 24 Aug 2018 14:46:47 +0200 Subject: [PATCH] various sonar cleanups --- examples/msg/platform-failures/platform-failures.c | 9 ++------- examples/s4u/exec-basic/s4u-exec-basic.cpp | 1 - .../platform-properties/s4u-platform-properties.cpp | 12 ++++-------- include/simgrid/s4u/Mutex.hpp | 2 -- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/examples/msg/platform-failures/platform-failures.c b/examples/msg/platform-failures/platform-failures.c index f7656af2dc..9da8dcdb47 100644 --- a/examples/msg/platform-failures/platform-failures.c +++ b/examples/msg/platform-failures/platform-failures.c @@ -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) { diff --git a/examples/s4u/exec-basic/s4u-exec-basic.cpp b/examples/s4u/exec-basic/s4u-exec-basic.cpp index c27bb2d85c..d23af26aad 100644 --- a/examples/s4u/exec-basic/s4u-exec-basic.cpp +++ b/examples/s4u/exec-basic/s4u-exec-basic.cpp @@ -38,7 +38,6 @@ static void privileged() int main(int argc, char* argv[]) { simgrid::s4u::Engine e(&argc, argv); - std::vector 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]); diff --git a/examples/s4u/platform-properties/s4u-platform-properties.cpp b/examples/s4u/platform-properties/s4u-platform-properties.cpp index 085464e95a..b0298ce0f8 100644 --- a/examples/s4u/platform-properties/s4u-platform-properties.cpp +++ b/examples/s4u/platform-properties/s4u-platform-properties.cpp @@ -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 /*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 /*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 /*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 /*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[]) diff --git a/include/simgrid/s4u/Mutex.hpp b/include/simgrid/s4u/Mutex.hpp index 5feed70146..60c452520c 100644 --- a/include/simgrid/s4u/Mutex.hpp +++ b/include/simgrid/s4u/Mutex.hpp @@ -12,8 +12,6 @@ namespace simgrid { namespace s4u { -class ConditionVariable; - /** @brief A classical mutex, but blocking in the simulation world * @ingroup s4u_api * -- 2.20.1