From: Andre Noll Date: Sun, 27 Mar 2016 02:22:40 +0000 (+0000) Subject: Remove explicit uses of _GNU_SOURCE. X-Git-Tag: v0.5.6~17 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=850d5bca5d6a1be6a63e3fca8aea83fe0c1290c8 Remove explicit uses of _GNU_SOURCE. The best way to add these flags is to use the autoconf helper AC_USE_SYSTEM_EXTENSIONS. This macro adds defines to config.h, so we must include config.h (via para.h) before anything else. The two files for which this matters are fixed by moving the include directive for para.h to the top. The AC_USE_SYSTEM_EXTENSIONS macro was introduced in Autoconf 2.60, which was released ten years ago. The existing AC_PREREQ([2.61]) check in configure.ac makes sure the macro is defined. --- diff --git a/configure.ac b/configure.ac index 360d76c6..953a9d21 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,7 @@ AC_DEFUN([LIB_SUBST_FLAGS], [ AC_SUBST($1_ldflags) ]) +AC_USE_SYSTEM_EXTENSIONS AC_C_BIGENDIAN() AC_PATH_PROG([GENGETOPT], [gengetopt]) @@ -197,7 +198,6 @@ AC_SUBST(nsl_ldflags) ########################################################################### ucred AC_MSG_CHECKING(for struct ucred) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #define _GNU_SOURCE #include #include ]], [[ diff --git a/net.c b/net.c index 42418e5f..1b142a3c 100644 --- a/net.c +++ b/net.c @@ -6,11 +6,7 @@ /** \file net.c Networking-related helper functions. */ -/* - * Since glibc 2.8, the _GNU_SOURCE feature test macro must be defined in order - * to obtain the definition of the ucred structure. - */ -#define _GNU_SOURCE +#include "para.h" #include #include @@ -32,7 +28,6 @@ #include -#include "para.h" #include "error.h" #include "net.h" #include "string.h" diff --git a/string.c b/string.c index e731bb49..86e77538 100644 --- a/string.c +++ b/string.c @@ -6,19 +6,16 @@ /** \file string.c Memory allocation and string handling functions. */ -#define _GNU_SOURCE +#include "para.h" #include #include /* uname() */ - #include #include - #include #include #include -#include "para.h" #include "string.h" #include "error.h"