[libvirt] [PATCH] maint: make it easier to copy FORTIFY_SOURCE snippet

Christophe Fergeau cfergeau at redhat.com
Thu Jun 7 17:49:59 UTC 2012


Thanks!

On Thu, Jun 07, 2012 at 10:54:10AM -0600, Eric Blake wrote:
> While libvirt intentionally avoids -Wundef (after all, C99
> guarantees sane semantics of treating undefined macros as 0),
> the glibc insanity of #warning on _FORTIFY_SOURCE coupled with
> what some people feel is the black magic of autoconf means
> that other projects are likely to copy our snippet verbatim.
> We can be nicer to other projects by making it easier to
> integrate into projects that use -Wundef.
> 
> Suggested by Christophe Fergeau.
> 
> * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Be nice
> to other projects using -Wundef.
> ---
> 
> Pushing under the trivial rule.
> 
>  m4/virt-compile-warnings.m4 |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index a91d69f..1817047 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -103,8 +103,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      AC_DEFINE([lint], [1],
>        [Define to 1 if the compiler is checking for lint.])
>      AH_VERBATIM([FORTIFY_SOURCE],
> -    [/* Enable compile-time and run-time bounds-checking, and some warnings. */
> -     #if __OPTIMIZE__
> +    [/* Enable compile-time and run-time bounds-checking, and some warnings,
> +        without upsetting newer glibc. */
> +     #if defined __OPTIMIZE__ && __OPTIMIZE__
>       # define _FORTIFY_SOURCE 2
>       #endif
>      ])
> -- 
> 1.7.10.2
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120607/05b6af21/attachment-0001.sig>


More information about the libvir-list mailing list