Re: [PATCH 1/2] build: allow building with newer glibc-headers and -O0

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

 



On 12.09.2012 17:42, Christophe Fergeau wrote:
> Fix copied from libvirt, commit by Eric Blake.
> 
> glibc 2.15 (on Fedora 17) coupled with explicit disabling of
> optimization during development dies a painful death:
> 
> /usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires
> compiling with optimization (-O) [-Werror=cpp]
> 
> Work around this by only conditionally defining _FORTIFY_SOURCE,
> in the case where glibc can actually use it.  The trick is using
> AH_VERBATIM instead of AC_DEFINE.
> ---
>  m4/virt-compile-warnings.m4 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index d403587..913abca 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -84,8 +84,12 @@ AC_DEFUN([LIBVIRT_DESIGNER_COMPILE_WARNINGS],[
>      gl_WARN_ADD([-Wframe-larger-than=4096])
>  
>      # Use improved glibc headers
> -    AC_DEFINE([_FORTIFY_SOURCE], [2],
> -      [enable compile-time and run-time bounds-checking, and some warnings])
> +    AH_VERBATIM([FORTIFY_SOURCE],
> +    [/* Enable compile-time and run-time bounds-checking, and some warnings. */
> +     #if defined __OPTIMIZE__ && __OPTIMIZE__
> +     # define _FORTIFY_SOURCE 2
> +     #endif
> +    ])
>  
>      # Extra special flags
>      dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
> 

ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]