From 56339de8502e8838b825453668c7388bbc0d448b Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Thu, 2 Mar 2023 08:35:45 +1000 Subject: build: define _GNU_SOURCE only on the command line Not in source files See https://ariadne.space/2021/12/21/stop-defining-feature-test-macros-in-your-code/ Signed-off-by: Steve Bennett --- auto.def | 2 ++ jim-aio.c | 3 --- jim-clock.c | 12 ------------ jim-exec.c | 3 --- jim-tty.c | 3 --- jim.c | 3 --- 6 files changed, 2 insertions(+), 24 deletions(-) diff --git a/auto.def b/auto.def index e9d6002..36ab1e3 100644 --- a/auto.def +++ b/auto.def @@ -209,6 +209,8 @@ cc-check-sizeof int # Default optimisation define-append AS_CPPFLAGS -O2 +define-append AS_CPPFLAGS -D_GNU_SOURCE + # check, but don't add to -cflags cc-with {} { cc-check-flags -fno-unwind-tables -fno-asynchronous-unwind-tables diff --git a/jim-aio.c b/jim-aio.c index cb56826..487f2c3 100644 --- a/jim-aio.c +++ b/jim-aio.c @@ -39,9 +39,6 @@ #include "jimautoconf.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include #include diff --git a/jim-clock.c b/jim-clock.c index 43d7f74..1b03935 100644 --- a/jim-clock.c +++ b/jim-clock.c @@ -6,18 +6,6 @@ #include "jimautoconf.h" -/* For strptime() - currently nothing sets this */ -#ifdef STRPTIME_NEEDS_XOPEN_SOURCE -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 500 -#endif -#endif - -/* For timegm() */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - #include #include #include diff --git a/jim-exec.c b/jim-exec.c index 36edb92..69a7841 100644 --- a/jim-exec.c +++ b/jim-exec.c @@ -20,9 +20,6 @@ * express or implied warranty. */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include diff --git a/jim-tty.c b/jim-tty.c index 6fbb346..b3faaba 100644 --- a/jim-tty.c +++ b/jim-tty.c @@ -6,9 +6,6 @@ */ /* termios support is required */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include diff --git a/jim.c b/jim.c index ea60e10..f4fd955 100644 --- a/jim.c +++ b/jim.c @@ -41,9 +41,6 @@ * official policies, either expressed or implied, of the Jim Tcl Project. **/ #define JIM_OPTIMIZATION /* comment to avoid optimizations and reduce size */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE /* Mostly just for environ */ -#endif #include #include -- cgit v1.1