Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make global variables "const".
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 11 Feb 2023 10:45:54 +0000 (11:45 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 13 Feb 2023 13:09:38 +0000 (14:09 +0100)
Even if it has no importance, take the special values from smpi.h

src/smpi/include/private.hpp
src/smpi/mpi/smpi_f2c.cpp

index 7174872..4440cc7 100644 (file)
@@ -54,14 +54,12 @@ constexpr int SMPI_RMA_TAG            = -6666;
 #define MPI_REQUEST_IGNORED ((MPI_Request*)-100)
 
 /* Bindings for MPI special values */
-extern XBT_PUBLIC int mpi_in_place_;
-extern XBT_PUBLIC int mpi_bottom_;
-extern XBT_PUBLIC int mpi_status_ignore_;
-extern XBT_PUBLIC int mpi_statuses_ignore_;
+extern XBT_PUBLIC const int mpi_in_place_;
+extern XBT_PUBLIC const int mpi_bottom_;
+extern XBT_PUBLIC const int mpi_status_ignore_;
+extern XBT_PUBLIC const int mpi_statuses_ignore_;
 /* Convert between Fortran and C */
-#define FORT_ADDR(addr, val, val2)                                         \
-  (((void *)(addr) == (void*) &(val2))                  \
-   ? (val) : (void *)(addr))
+#define FORT_ADDR(addr, val, val2) (((const void*)(addr) == (const void*)&(val2)) ? (val) : (void*)(addr))
 #define FORT_BOTTOM(addr) FORT_ADDR((addr), MPI_BOTTOM, mpi_bottom_)
 #define FORT_IN_PLACE(addr) FORT_ADDR((addr), MPI_IN_PLACE, mpi_in_place_)
 #define FORT_STATUS_IGNORE(addr) static_cast<MPI_Status*>(FORT_ADDR((addr), MPI_STATUS_IGNORE, mpi_status_ignore_))
index dc4c5f5..bdec55b 100644 (file)
@@ -8,10 +8,10 @@
 #include "src/smpi/include/smpi_actor.hpp"
 #include "src/instr/instr_smpi.hpp"
 
-int mpi_in_place_;
-int mpi_bottom_;
-int mpi_status_ignore_;
-int mpi_statuses_ignore_;
+const int mpi_in_place_        = -222;
+const int mpi_bottom_          = -111;
+const int mpi_status_ignore_   = 0;
+const int mpi_statuses_ignore_ = 0;
 
 namespace simgrid::smpi {