Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix getopt for BSD systems
authordegomme <adegomme@users.noreply.github.com>
Fri, 5 Apr 2019 15:29:29 +0000 (17:29 +0200)
committerdegomme <adegomme@users.noreply.github.com>
Fri, 5 Apr 2019 15:29:29 +0000 (17:29 +0200)
optind should be set to 1, not 0. GNU was just more resilient.

src/smpi/include/smpi_actor.hpp
teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong.c

index 264507b..97d4d2b 100644 (file)
@@ -31,7 +31,7 @@ class ActorExt {
   smpi_trace_call_location_t trace_call_loc_;
   s4u::ActorPtr actor_                           = nullptr;
   smpi_privatization_region_t privatized_region_ = nullptr;
   smpi_trace_call_location_t trace_call_loc_;
   s4u::ActorPtr actor_                           = nullptr;
   smpi_privatization_region_t privatized_region_ = nullptr;
-  int optind                                     = 0; /*for getopt replacement */
+  int optind                                     = 1; /*for getopt replacement */
   std::string tracing_category_                  = "";
 
 #if HAVE_PAPI
   std::string tracing_category_                  = "";
 
 #if HAVE_PAPI
index 468bcc6..6ddb623 100644 (file)
@@ -10,7 +10,6 @@
 #include <mpi.h>
 
 static void test_opts(int* argc, char **argv[]){
 #include <mpi.h>
 
 static void test_opts(int* argc, char **argv[]){
-#if defined __linux__
   int found = 0, ret;
   while ((ret = getopt(*argc, *argv, "s")) >= 0)
   {
   int found = 0, ret;
   while ((ret = getopt(*argc, *argv, "s")) >= 0)
   {
@@ -23,7 +22,6 @@ static void test_opts(int* argc, char **argv[]){
   if (found!=1){
     printf("(smpi_)getopt failed ! \n");
   }
   if (found!=1){
     printf("(smpi_)getopt failed ! \n");
   }
-#endif
 }
 
 int main(int argc, char *argv[])
 }
 
 int main(int argc, char *argv[])