Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Factorize duplicated declarations.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 18 Jun 2018 15:27:19 +0000 (17:27 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 18 Jun 2018 19:40:02 +0000 (21:40 +0200)
include/smpi/smpi_helpers.h
include/smpi/smpi_helpers_internal.h [new file with mode: 0644]
src/smpi/include/private.hpp
tools/cmake/DefinePackages.cmake

index 3a87fde..1d92e4a 100644 (file)
@@ -1,32 +1,16 @@
-#ifndef MPI_HELPERS_H
-#define MPI_HELPERS_H
+/* Copyright (c) 2018. The SimGrid Team.  All rights reserved.              */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <unistd.h>
-#include <sys/time.h> /* Load it before the define next line to not mess with the system headers */
-#if _POSIX_TIMERS
-#include <time.h>
-#endif
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef SMPI_HELPERS_H
+#define SMPI_HELPERS_H
 
-int smpi_usleep(useconds_t usecs);
-#if _POSIX_TIMERS > 0
-int smpi_nanosleep(const struct timespec* tp, struct timespec* t);
-int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp);
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
 #endif
-unsigned int smpi_sleep(unsigned int secs);
-int smpi_gettimeofday(struct timeval* tv, struct timezone* tz);
 
-struct option;
-int smpi_getopt_long_only (int argc,  char *const *argv,  const char *options,  const struct option *long_options, int *opt_index);
-int smpi_getopt_long (int argc,  char *const *argv,  const char *options,  const struct option *long_options, int *opt_index);
-int smpi_getopt (int argc,  char *const *argv,  const char *options);
+#include <smpi/smpi_helpers_internal.h>
 
 #define sleep(x) smpi_sleep(x)
 #define usleep(x) smpi_usleep(x)
@@ -40,7 +24,4 @@ int smpi_getopt (int argc,  char *const *argv,  const char *options);
 #define getopt_long(x,y,z,a,b) smpi_getopt_long(x,y,z,a,b)
 #define getopt_long_only(x,y,z,a,b) smpi_getopt_long_only(x,y,z,a,b)
 
-#ifdef __cplusplus
-} // extern "C"
-#endif
 #endif
diff --git a/include/smpi/smpi_helpers_internal.h b/include/smpi/smpi_helpers_internal.h
new file mode 100644 (file)
index 0000000..0c78541
--- /dev/null
@@ -0,0 +1,38 @@
+/* Copyright (c) 2018. The SimGrid Team.  All rights reserved.              */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SMPI_HELPERS_INTERNAL_H
+#define SMPI_HELPERS_INTERNAL_H
+
+#include <unistd.h>
+
+#include <sys/time.h>
+#if _POSIX_TIMERS
+#include <time.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int smpi_usleep(useconds_t usecs);
+#if _POSIX_TIMERS > 0
+int smpi_nanosleep(const struct timespec* tp, struct timespec* t);
+int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp);
+#endif
+unsigned int smpi_sleep(unsigned int secs);
+int smpi_gettimeofday(struct timeval* tv, struct timezone* tz);
+
+struct option;
+int smpi_getopt_long_only(int argc, char* const* argv, const char* options, const struct option* long_options,
+                          int* opt_index);
+int smpi_getopt_long(int argc, char* const* argv, const char* options, const struct option* long_options,
+                     int* opt_index);
+int smpi_getopt(int argc, char* const* argv, const char* options);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+#endif
index cd267eb..2556f4c 100644 (file)
@@ -8,14 +8,11 @@
 
 #include "simgrid/msg.h" // msg_bar_t
 #include "smpi/smpi.h"
+#include "smpi/smpi_helpers_internal.h"
 #include "src/instr/instr_smpi.hpp"
 #include "src/internal_config.h"
 #include <unordered_map>
 #include <vector>
-#include <sys/time.h>
-#if _POSIX_TIMERS
-#include <time.h>
-#endif
 
 #define MPI_REQ_PERSISTENT 0x1
 #define MPI_REQ_NON_PERSISTENT 0x2
@@ -408,21 +405,6 @@ void mpi_file_set_view_(int* fh, long long int* offset, int* etype, int* filetyp
 void mpi_file_read_(int* fh, void* buf, int* count, int* datatype, MPI_Status* status, int* ierr);
 void mpi_file_write_(int* fh, void* buf, int* count, int* datatype, MPI_Status* status, int* ierr);
 
-
-XBT_PUBLIC int smpi_usleep(useconds_t usecs);
-#if _POSIX_TIMERS > 0
-XBT_PUBLIC int smpi_nanosleep(const struct timespec* tp, struct timespec* t);
-XBT_PUBLIC int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp);
-#endif
-XBT_PUBLIC unsigned int smpi_sleep(unsigned int secs);
-XBT_PUBLIC int smpi_gettimeofday(struct timeval* tv, struct timezone* tz);
-
-
-struct option;
-XBT_PUBLIC int smpi_getopt_long_only (int argc,  char *const *argv,  const char *options,  const struct option *long_options, int *opt_index);
-XBT_PUBLIC int smpi_getopt_long (int argc,  char *const *argv,  const char *options,  const struct option *long_options, int *opt_index);
-XBT_PUBLIC int smpi_getopt (int argc,  char *const *argv,  const char *options);
-
 } // extern "C"
 
 struct s_smpi_privatization_region_t {
index 6bd826b..0d0ed04 100644 (file)
@@ -719,6 +719,7 @@ set(headers_to_install
   include/smpi/smpi.h
   include/smpi/smpi_main.h
   include/smpi/smpi_helpers.h
+  include/smpi/smpi_helpers_internal.h
   include/smpi/smpi_extended_traces.h
   include/smpi/smpi_extended_traces_fortran.h
   include/smpi/forward.hpp