|author||Eric Blake <firstname.lastname@example.org>||2011-12-02 11:56:58 -0700|
|committer||Eric Blake <email@example.com>||2011-12-02 13:00:57 -0700|
|parent||apparmor: allow tunnelled migrations. (diff)|
build: fix build at -O2 on rawhide
I had previously tested commit 059d746 with -O intentionally omitted from my CFLAGS; but that means that I missed out on this warning from gcc 4.6.2 when optimizations are enabled: util/buf.c: In function 'virBufferGetIndent': util/buf.c:86:1: error: function might be candidate for attribute 'pure' [-Werror=suggest-attribute=pure] While it is probably a good idea to add the attributes and silence this warning, it's also invasive; 'make -k' found more than 75 such complaints. And it doesn't help that gcc 4.6.2 is still buggy (coreutils reported a case where gcc 4.6.2 incorrectly suggested marking a function pure that incremented a global variable; fixed in gcc 4.7). So the best fix for now is to disable the warning. It also doesn't help that I stumbled across another problem - gcc documents that -Wsuggest-attribute=pure only warns if you use -O, or if you use -fipa-pure-const. But in practice, when I omitted -O but added -fipa-pure-const, the warnings are fickle - I got warnings for simple compilation that disappeared when I also added -fPIC. And the way libtool compiles things is with -fPIC first, then without -fPIC but with errors sent to /dev/null - which meant that without disabling -Wsuggest-attribute=pure, I got a compile error with no message. :( See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10197 * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Silence -Wsuggest-attribute warnings for now.
Diffstat (limited to 'm4')
1 files changed, 8 insertions, 0 deletions
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 213b3db70..a17e4b764 100644
@@ -116,6 +116,14 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
+ # Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
+ # fire even without -O.
+ # We should eventually enable this, but right now there are at
+ # least 75 functions triggering warnings.
if test "$enable_compile_warnings" = "error"