From: degomme Date: Sat, 18 Jun 2016 21:01:15 +0000 (+0200) Subject: fix compilation on macos and with MC X-Git-Tag: v3_14~947 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/eee8d7058d768987a5024f85a7b2038e9acf96a3 fix compilation on macos and with MC --- diff --git a/include/smpi/mpi.h b/include/smpi/mpi.h index ee9e433c69..58ccde0d6d 100644 --- a/include/smpi/mpi.h +++ b/include/smpi/mpi.h @@ -10,8 +10,8 @@ #define SEED 221238 #define sleep(x) smpi_sleep(x) -#if _POSIX_TIMERS -#define nanosleep(x,y) smpi_nanosleep(x,NULL) +#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L +#define nanosleep(x, y) smpi_nanosleep(x, y) #endif #define usleep(x) smpi_usleep(x) @@ -23,7 +23,7 @@ #include /* Load it before the define next line to not mess with the system headers */ #define gettimeofday(x, y) smpi_gettimeofday(x, NULL) -#if _POSIX_TIMERS +#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L #define clock_gettime(x, y) smpi_clock_gettime(x, y) #endif #if HAVE_MC diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 73fdb682d8..c04940d2d0 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -806,9 +806,8 @@ XBT_PUBLIC(int) smpi_get_host_pstate(void); XBT_PUBLIC(double) smpi_get_host_consumed_energy(void); XBT_PUBLIC(int) smpi_usleep(useconds_t usecs); -#if _POSIX_TIMERS - -XBT_PUBLIC(int) smpi_nanosleep(struct timespec *tp, void* t); +#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L +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); diff --git a/src/smpi/smpi_bench.cpp b/src/smpi/smpi_bench.cpp index 91be166949..1079ca4e93 100644 --- a/src/smpi/smpi_bench.cpp +++ b/src/smpi/smpi_bench.cpp @@ -307,8 +307,8 @@ int smpi_usleep(useconds_t usecs) return static_cast(private_sleep(static_cast(usecs) / 1000000.0)); } -#if _POSIX_TIMERS -int smpi_nanosleep(struct timespec *tp, void* t) +#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L +int smpi_nanosleep(const struct timespec *tp, struct timespec * t) { return static_cast(private_sleep(static_cast(tp->tv_sec + tp->tv_nsec / 1000000000.0))); } @@ -331,7 +331,7 @@ int smpi_gettimeofday(struct timeval *tv, void* tz) return 0; } -#if _POSIX_TIMERS +#if _POSIX_TIMERS && _POSIX_C_SOURCE >= 199309L int smpi_clock_gettime(clockid_t clk_id, struct timespec *tp) { //there is only one time in SMPI, so clk_id is ignored.