diff options
author | Steve Bennett <steveb@workware.net.au> | 2023-03-02 08:35:45 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2023-03-20 08:19:51 +1000 |
commit | 56339de8502e8838b825453668c7388bbc0d448b (patch) | |
tree | a50c96fef23b29b6dfbf81a5fce99bcff2d5f5d9 | |
parent | d9b7db7fc6dfffc066b521b672b2bd7c7ff212db (diff) | |
download | jimtcl-56339de8502e8838b825453668c7388bbc0d448b.zip jimtcl-56339de8502e8838b825453668c7388bbc0d448b.tar.gz jimtcl-56339de8502e8838b825453668c7388bbc0d448b.tar.bz2 |
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 <steveb@workware.net.au>
-rw-r--r-- | auto.def | 2 | ||||
-rw-r--r-- | jim-aio.c | 3 | ||||
-rw-r--r-- | jim-clock.c | 12 | ||||
-rw-r--r-- | jim-exec.c | 3 | ||||
-rw-r--r-- | jim-tty.c | 3 | ||||
-rw-r--r-- | jim.c | 3 |
6 files changed, 2 insertions, 24 deletions
@@ -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 @@ -39,9 +39,6 @@ #include "jimautoconf.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include <stdio.h> #include <string.h> #include <errno.h> 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 <stdlib.h> #include <string.h> #include <stdio.h> @@ -20,9 +20,6 @@ * express or implied warranty. */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include <string.h> #include <ctype.h> @@ -6,9 +6,6 @@ */ /* termios support is required */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include <jim-tty.h> #include <termios.h> @@ -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 <stdio.h> #include <stdlib.h> |