Makefile: false positive on _FORTIFY_SOURCE
authorRobin H. Johnson <robbat2@gentoo.org>
Wed, 3 Feb 2016 16:19:52 +0000 (08:19 -0800)
committerRobin H. Johnson <robbat2@gentoo.org>
Wed, 3 Feb 2016 16:19:52 +0000 (08:19 -0800)
If the compiler is very pedantic and includes _FORTIFY_SOURCE, then you
get the following warning about redefinition:
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined

To prevent it, undefine and redefine _FORTIFY_SOURCE.

Gentoo's gcc does this for -O2.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Makefile

index 9b15afeb2ecfa0a55a99ed68d7e4802d3ba82c21..684b565d4e04971e6e6356df2c195d0a7b084374 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ all:
 include config-host.mak
 endif
 
-DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
+DEBUGFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
 CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS)
 OPTFLAGS= -g -ffast-math
 CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS) -I. -I$(SRCDIR)