Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use a local variable, and hope to fix PVS-studio warning.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 26 Nov 2020 20:58:48 +0000 (21:58 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 26 Nov 2020 22:43:57 +0000 (23:43 +0100)
E.g., at smpi_pmpi_request.cpp:50
V501 There are identical sub-expressions to the left and to the right of the '!=' operator: ((MPI_SUCCESS)) != MPI_SUCCESS

src/smpi/include/private.hpp

index c2bc108..c9635c4 100644 (file)
@@ -515,12 +515,12 @@ XBT_PUBLIC smpi_trace_call_location_t* smpi_trace_get_call_location();
 
 XBT_PRIVATE void private_execute_flops(double flops);
 
-
 #define CHECK_ARGS(test, errcode, ...)                                                                                 \
   if (test) {                                                                                                          \
-    if((errcode) != MPI_SUCCESS)                                                                                       \
+    int error_code_ = (errcode);                                                                                       \
+    if (error_code_ != MPI_SUCCESS)                                                                                    \
       XBT_WARN(__VA_ARGS__);                                                                                           \
-    return (errcode);                                                                                                  \
+    return error_code_;                                                                                                \
   }
 
 #define CHECK_MPI_NULL(num, val, err, ptr)                                                                             \