From 2b4f2809ce5c54961bcae43131fcab00dd161a3d Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 29 Aug 2018 15:19:17 +0200 Subject: [PATCH] sonar --- include/simgrid/forward.h | 2 -- include/smpi/smpi_helpers_internal.h | 2 +- src/kernel/context/Context.hpp | 3 ++- src/msg/msg_gos.cpp | 38 ++++++++++------------------ 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index c95d3ff53c..38d662dfb2 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -176,7 +176,6 @@ typedef simgrid::kernel::actor::ActorImpl* smx_actor_t; typedef simgrid::kernel::activity::ConditionVariableImpl* smx_cond_t; typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t; typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t; -typedef simgrid::surf::StorageImpl* surf_storage_t; #else @@ -195,7 +194,6 @@ typedef struct s_smx_actor* smx_actor_t; typedef struct s_smx_cond_t* smx_cond_t; typedef struct s_smx_mutex* smx_mutex_t; typedef struct s_smx_mailbox* smx_mailbox_t; -typedef struct s_surf_storage* surf_storage_t; #endif diff --git a/include/smpi/smpi_helpers_internal.h b/include/smpi/smpi_helpers_internal.h index 0c78541146..8977aa2d08 100644 --- a/include/smpi/smpi_helpers_internal.h +++ b/include/smpi/smpi_helpers_internal.h @@ -6,6 +6,7 @@ #ifndef SMPI_HELPERS_INTERNAL_H #define SMPI_HELPERS_INTERNAL_H +#include #include #include @@ -25,7 +26,6 @@ int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp); unsigned int smpi_sleep(unsigned int secs); int smpi_gettimeofday(struct timeval* tv, struct timezone* tz); -struct option; int smpi_getopt_long_only(int argc, char* const* argv, const char* options, const struct option* long_options, int* opt_index); int smpi_getopt_long(int argc, char* const* argv, const char* options, const struct option* long_options, diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index ac073aba41..082677c08c 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -63,7 +63,8 @@ public: */ public: StopRequest() = default; - StopRequest(std::string msg) : msg_(msg) { } + explicit StopRequest(std::string msg) : msg_(msg) {} + private: std::string msg_; }; diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 97781b9468..3c8121b2d3 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -83,13 +83,10 @@ msg_error_t MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeo } catch (simgrid::TimeoutError& e) { status = MSG_TIMEOUT; } catch (xbt_ex& e) { - switch (e.category) { - case cancel_error: + if (e.category == cancel_error) status = MSG_TASK_CANCELED; - break; - default: + else throw; - } } /* action ended, set comm and compute = nullptr, the actions is already destroyed in the main function */ @@ -486,13 +483,11 @@ int MSG_comm_test(msg_comm_t comm) finished = true; } catch (xbt_ex& e) { - switch (e.category) { - case network_error: - comm->status = MSG_TRANSFER_FAILURE; - finished = true; - break; - default: - throw; + if (e.category == network_error) { + comm->status = MSG_TRANSFER_FAILURE; + finished = true; + } else { + throw; } } @@ -584,13 +579,10 @@ msg_error_t MSG_comm_wait(msg_comm_t comm, double timeout) comm->status = MSG_TIMEOUT; } catch (xbt_ex& e) { - switch (e.category) { - case network_error: + if (e.category == network_error) comm->status = MSG_TRANSFER_FAILURE; - break; - default: + else throw; - } } return comm->status; @@ -638,13 +630,11 @@ int MSG_comm_waitany(xbt_dynar_t comms) status = MSG_TIMEOUT; } catch(xbt_ex& e) { - switch (e.category) { - case network_error: - finished_index = e.value; - status = MSG_TRANSFER_FAILURE; - break; - default: - throw; + if (e.category == network_error) { + finished_index = e.value; + status = MSG_TRANSFER_FAILURE; + } else { + throw; } } -- 2.20.1