From 4c04b128260c38d0d28a1fc70cd8cf02f06c15c1 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 11 Oct 2012 16:10:14 +0200 Subject: [PATCH 1/1] Define _GNU_SOURCE in xbt/misc.h, so that it's defined across full build. --- include/simgrid_config.h.in | 9 +++------ include/xbt/misc.h | 5 +++++ src/simix/smx_user.c | 10 ---------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index a12421b3f4..c9952306f8 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -74,17 +74,14 @@ XBT_PUBLIC(void) sg_version(int *major,int *minor,int *patch); @simgrid_need_asprintf@ @simgrid_need_vasprintf@ +#include /* FILE, getline if it exists */ + /* Use that config to declare missing elements */ #ifdef SIMGRID_NEED_GETLINE #include /* size_t */ -#include /* FILE* */ XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream); -#else -#ifndef _GNU_SOURCE - #define _GNU_SOURCE -#endif -#include #endif + #include /* snprintf related functions */ diff --git a/include/xbt/misc.h b/include/xbt/misc.h index 5260bce95e..529bfc6365 100644 --- a/include/xbt/misc.h +++ b/include/xbt/misc.h @@ -9,6 +9,11 @@ #ifndef XBT_MISC_H #define XBT_MISC_H +/* Define _GNU_SOURCE for getline, isfinite, etc. */ +#ifndef _GNU_SOURCE + #define _GNU_SOURCE +#endif + /* Attributes are only in recent versions of GCC */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) # define _XBT_GNUC_PRINTF( format_idx, arg_idx ) \ diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 50b6db4fc5..2ad612d375 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -8,16 +8,6 @@ #include "smx_private.h" #include "mc/mc.h" #include "xbt/ex.h" - -#ifndef _SVID_SOURCE -# define _SVID_SOURCE /* strdup() */ -#endif -#ifndef _ISOC99_SOURCE -# define _ISOC99_SOURCE /* isfinite() */ -#endif -#ifndef _ISO_C99_SOURCE -# define _ISO_C99_SOURCE /* isfinite() */ -#endif #include /* isfinite() */ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); -- 2.20.1