From 7a99910faad9adbbc01f4e4cccb504a53bed1af6 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 6 Apr 2019 13:48:37 +0200 Subject: [PATCH 1/1] please sonar in various trivial ways --- src/smpi/bindings/smpi_pmpi_coll.cpp | 4 ++-- teshsuite/smpi/privatization/privatization.c | 3 ++- teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c | 3 ++- teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c | 8 +++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index 415f12692c..09324ed52b 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -417,7 +417,7 @@ int PMPI_Ireduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; - } if ((sendbuf == nullptr && count > 0) || ((comm->rank() == root) && recvbuf == nullptr)) { + } else if ((sendbuf == nullptr && count > 0) || ((comm->rank() == root) && recvbuf == nullptr)) { return MPI_ERR_BUFFER; } else if (datatype == MPI_DATATYPE_NULL || not datatype->is_valid()){ return MPI_ERR_TYPE; @@ -475,7 +475,7 @@ int PMPI_Iallreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype dataty { if (comm == MPI_COMM_NULL) { return MPI_ERR_COMM; - } if ((sendbuf == nullptr && count > 0) || (recvbuf == nullptr)) { + } else if ((sendbuf == nullptr && count > 0) || (recvbuf == nullptr)) { return MPI_ERR_BUFFER; } else if (datatype == MPI_DATATYPE_NULL || not datatype->is_valid()) { return MPI_ERR_TYPE; diff --git a/teshsuite/smpi/privatization/privatization.c b/teshsuite/smpi/privatization/privatization.c index 9a9e963627..25668c8116 100644 --- a/teshsuite/smpi/privatization/privatization.c +++ b/teshsuite/smpi/privatization/privatization.c @@ -6,7 +6,8 @@ static int myvalue = 0; static void test_opts(int* argc, char **argv[]){ - int found = 0, ret; + int found = 0; + int ret; static struct option long_options[] = { {"long", no_argument, 0, 0 }, {0, 0, 0, 0 } diff --git a/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c b/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c index b2fbc2148d..84217e9ea9 100644 --- a/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c +++ b/teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.c @@ -12,7 +12,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(dsend,"the dsend test"); static void test_opts(int* argc, char **argv[]){ - int found = 0, ret; + int found = 0; + int ret; int option_index = 0; static struct option long_options[] = { {"long", no_argument, 0, 0 }, diff --git a/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c b/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c index 6ddb623680..c46ea3395b 100644 --- a/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c +++ b/teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c @@ -10,14 +10,12 @@ #include static void test_opts(int* argc, char **argv[]){ - int found = 0, ret; + int found = 0; + int ret; while ((ret = getopt(*argc, *argv, "s")) >= 0) { - switch (ret) { - case 's': + if (ret == 's') found = 1; - break; - } } if (found!=1){ printf("(smpi_)getopt failed ! \n"); -- 2.20.1