[PATCH v6 1/3] Move -D_GNU_SOURCE to CPPFLAGS

Luca Boccassi
2020-12-21T23:25:37Z

Ensures it is actually defined before any include is preprocessed.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v6: split from mingw patch

Makefile | 2 +-
lib/utils.c | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index bfe83c4..f1ba956 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ override CFLAGS := -Wall -Wundef \
$(call cc-option,-Wvla) \
$(CFLAGS)

-override CPPFLAGS := -Iinclude -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)
+override CPPFLAGS := -Iinclude -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $(CPPFLAGS)

ifneq ($(V),1)
QUIET_CC = @echo ' CC ' $@;
diff --git a/lib/utils.c b/lib/utils.c
index 8b5d6cb..13e3b35 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -9,8 +9,6 @@
* https://opensource.org/licenses/MIT.
*/

-#define _GNU_SOURCE /* for asprintf() and strerror_r() */
-
#include "lib_private.h"

#include <stdio.h>
--
2.29.2