diff mbox series

[v7,1/3] Move -D_GNU_SOURCE to CPPFLAGS

Message ID 20201222001033.302274-1-bluca@debian.org (mailing list archive)
State Accepted
Headers show
Series [v7,1/3] Move -D_GNU_SOURCE to CPPFLAGS | expand

Commit Message

Luca Boccassi Dec. 22, 2020, 12:10 a.m. UTC
Use _GNU_SOURCE consistently in every file rather than just one file.
This is needed for the Windows build in order to consistently get the MinGW
version of printf.

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

v7: adjust commit message and add CPPFLAG to run-sparse.sh as well

 Makefile              | 2 +-
 lib/utils.c           | 2 --
 scripts/run-sparse.sh | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

Comments

Eric Biggers Dec. 22, 2020, 8:21 a.m. UTC | #1
On Tue, Dec 22, 2020 at 12:10:31AM +0000, Luca Boccassi wrote:
> Use _GNU_SOURCE consistently in every file rather than just one file.
> This is needed for the Windows build in order to consistently get the MinGW
> version of printf.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>

Is this the email address you wanted to use in the Author and Signed-off-by?
v5 and earlier (and your other patches) had "luca.boccassi@microsoft.com".

- Eric
Eric Biggers Dec. 22, 2020, 6:40 p.m. UTC | #2
On Tue, Dec 22, 2020 at 12:10:31AM +0000, Luca Boccassi wrote:
> Use _GNU_SOURCE consistently in every file rather than just one file.
> This is needed for the Windows build in order to consistently get the MinGW
> version of printf.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v6: split from mingw patch
> 
> v7: adjust commit message and add CPPFLAG to run-sparse.sh as well
> 
>  Makefile              | 2 +-
>  lib/utils.c           | 2 --
>  scripts/run-sparse.sh | 2 +-
>  3 files changed, 2 insertions(+), 4 deletions(-)
> 

Applied, thanks.

- Eric
diff mbox series

Patch

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>
diff --git a/scripts/run-sparse.sh b/scripts/run-sparse.sh
index 30730b2..f75b837 100755
--- a/scripts/run-sparse.sh
+++ b/scripts/run-sparse.sh
@@ -10,5 +10,5 @@  set -e -u -o pipefail
 
 find . -name '*.c' | while read -r file; do
 	sparse "$file" -gcc-base-dir "$(gcc --print-file-name=)"	\
-		-Iinclude -D_FILE_OFFSET_BITS=64 -Wbitwise
+		-Iinclude -D_FILE_OFFSET_BITS=64 -Wbitwise -D_GNU_SOURCE
 done