[pulseaudio-discuss] [PATCH] build-sys: Eliminate _FORTIFY_SOURCE warnings

Alexander E. Patrakov patrakov at gmail.com
Tue Apr 29 08:26:39 PDT 2014


The warnings were produced because the command-line flag redefined the
value of _FORTIFY_SOURCE coming from the specs on some distributions,
including Fedora and Gentoo. So, undefine this macro before defining it.

As the warnings are now eliminated, the flag becomes harmless even for
-O0. So enable it unconditionally.

AX_APPEND_FLAG cannot be used in this case, as it would leave only
-U_FORTIFY_SOURCE and omit -D_FORTIFY_SOURCE=2.
---
 configure.ac | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index e75973f..e292c38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,10 +180,7 @@ AX_APPEND_COMPILE_FLAGS(
 # Only enable fastpath asserts when doing a debug build, e.g. from bootstrap.sh.
 AS_CASE([" $CFLAGS "], [*" -O0 "*], [], [AX_APPEND_FLAG(["-DFASTPATH"], [CPPFLAGS])])
 
-# Only set _FORTIFY_SOURCE when optimizations are enabled. If optimizations
-# are disabled, _FORTIFY_SOURCE doesn't do anything, and causes tons of
-# warnings during compiling on some distributions (at least Fedora).
-AS_CASE([" $CFLAGS "], [*" -O0 "*], [], [AX_APPEND_FLAG(["-D_FORTIFY_SOURCE=2"], [CPPFLAGS])])
+AS_VAR_APPEND([CPPFLAGS],[" -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"])
 
 
 #### Linker flags ####
-- 
1.9.2



More information about the pulseaudio-discuss mailing list