[PATCH] build-sys: Eliminate _FORTIFY_SOURCE warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2014-04-29 at 21:26 +0600, Alexander E. Patrakov wrote:
> 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 ####

This doesn't work on my machine. I have Fedora 20. I compile PulseAudio
from git, with -O0. With this patch, I get this warning for pretty much
every compilation unit:

  CC       tests/sync_playback-sync-playback.o
In file included from /usr/include/signal.h:28:0,
                 from tests/sync-playback.c:24:
/usr/include/features.h:327:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux