mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
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.
This commit is contained in:
parent
4cfdbfc46f
commit
75da320087
@ -116,6 +116,14 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
|
||||
gl_WARN_ADD([-fdiagnostics-show-option])
|
||||
gl_WARN_ADD([-funit-at-a-time])
|
||||
|
||||
# Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
|
||||
# fire even without -O.
|
||||
gl_WARN_ADD([-fipa-pure-const])
|
||||
# We should eventually enable this, but right now there are at
|
||||
# least 75 functions triggering warnings.
|
||||
gl_WARN_ADD([-Wno-suggest-attribute=pure])
|
||||
gl_WARN_ADD([-Wno-suggest-attribute=const])
|
||||
|
||||
if test "$enable_compile_warnings" = "error"
|
||||
then
|
||||
gl_WARN_ADD([-Werror])
|
||||
|
Loading…
x
Reference in New Issue
Block a user