[libvirt] [libvirt-sandbox][PATCH] Don't redefine _FORTIFY_SOURCE macro

If the _FORTIFY_SOURCE has been already defined, we unconditionally redefine it, leaving us with warning/error thrown at compilation time. --- m4/virt-compile-warnings.m4 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index cdcbad9..894ab59 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -84,8 +84,13 @@ AC_DEFUN([LIBVIRT_SANDBOX_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, + without upsetting newer glibc. */ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + ]) # Extra special flags dnl -fstack-protector stuff passes gl_WARN_ADD with gcc -- 1.8.0.2

On Tue, Jan 29, 2013 at 10:39:08AM +0100, Michal Privoznik wrote:
If the _FORTIFY_SOURCE has been already defined, we unconditionally redefine it, leaving us with warning/error thrown at compilation time. --- m4/virt-compile-warnings.m4 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index cdcbad9..894ab59 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -84,8 +84,13 @@ AC_DEFUN([LIBVIRT_SANDBOX_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, + without upsetting newer glibc. */ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + ])
# Extra special flags dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 29.01.2013 11:26, Daniel P. Berrange wrote:
On Tue, Jan 29, 2013 at 10:39:08AM +0100, Michal Privoznik wrote:
If the _FORTIFY_SOURCE has been already defined, we unconditionally redefine it, leaving us with warning/error thrown at compilation time. --- m4/virt-compile-warnings.m4 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index cdcbad9..894ab59 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -84,8 +84,13 @@ AC_DEFUN([LIBVIRT_SANDBOX_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, + without upsetting newer glibc. */ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + ])
# Extra special flags dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
ACK
Daniel
Thanks, pushed. Michal
participants (2)
-
Daniel P. Berrange
-
Michal Privoznik