Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanups in smpi, mostly cosmetic stuff and indent
[simgrid.git] / src / smpi / internals / smpi_global.cpp
index 61f16b1..70def16 100644 (file)
 # ifndef MAC_OS_X_VERSION_10_12
 #   define MAC_OS_X_VERSION_10_12 101200
 # endif
-# define HAVE_WORKING_MMAP (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12)
+constexpr bool HAVE_WORKING_MMAP = (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12);
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-# define HAVE_WORKING_MMAP 0
+constexpr bool HAVE_WORKING_MMAP = false;
 #else
-# define HAVE_WORKING_MMAP 1
+constexpr bool HAVE_WORKING_MMAP = true;
 #endif
 
 #if SG_HAVE_SENDFILE
@@ -398,12 +398,10 @@ static void smpi_init_options(){
     XBT_DEBUG("Running without smpi_main(); disable smpi/privatization.");
     smpi_privatize_global_variables = SmpiPrivStrategies::NONE;
   }
-#if !HAVE_WORKING_MMAP
-  if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
+  if (not HAVE_WORKING_MMAP && smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
     XBT_INFO("mmap privatization is broken on this platform, switching to dlopen privatization instead.");
     smpi_privatize_global_variables = SmpiPrivStrategies::DLOPEN;
   }
-#endif
 
   if (smpi_cpu_threshold < 0)
     smpi_cpu_threshold = DBL_MAX;
@@ -425,7 +423,7 @@ typedef std::function<int(int argc, char *argv[])> smpi_entry_point_type;
 typedef int (* smpi_c_entry_point_type)(int argc, char **argv);
 typedef void (*smpi_fortran_entry_point_type)();
 
-static int smpi_run_entry_point(smpi_entry_point_type entry_point, const std::string& executable_path,
+static int smpi_run_entry_point(const smpi_entry_point_type& entry_point, const std::string& executable_path,
                                 std::vector<std::string> args)
 {
   // copy C strings, we need them writable
@@ -663,8 +661,6 @@ static void smpi_init_privatization_no_dlopen(const std::string& executable)
 
 int smpi_main(const char* executable, int argc, char* argv[])
 {
-  srand(SMPI_RAND_SEED);
-
   if (getenv("SMPI_PRETEND_CC") != nullptr) {
     /* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the
      * configuration tools */