diff options
author | Eric Blake <eblake@redhat.com> | 2012-08-14 14:11:35 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-08-15 13:30:21 -0600 |
commit | 42af2167a42447009f1786ed4cddddc73c2d73dd (patch) | |
tree | 6b89ecbf33791e0b17c01dfa939f9b26bf201a11 /m4 | |
parent | network: make network driver vlan-aware (diff) | |
download | libvirt-42af2167a42447009f1786ed4cddddc73c2d73dd.tar.gz libvirt-42af2167a42447009f1786ed4cddddc73c2d73dd.tar.bz2 libvirt-42af2167a42447009f1786ed4cddddc73c2d73dd.zip |
build: avoid warnings on older gcc
A previous patch (c606671a) pulled in a newer version of
stat-time.h from gnulib, which causes some warnings in older gcc:
CC libvirt_driver_storage_la-storage_backend.lo
cc1: warnings being treated as errors
In file included from ../../src/storage/storage_backend.c:59:
../../gnulib/lib/stat-time.h:55: error: no previous prototype for 'get_stat_atime_ns' [-Wmissing-prototypes]
Upstream gnulib argues that these warnings are stupid (and I agree;
see <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>), and has
used a modern gcc feature (#pragma GCC diagnostic push) to avoid the
warning. But we still aim to compile on RHEL 6.3, with gcc 4.4.6
(not to mention even older platforms like RHEL 5), and therefore
the warning trips up our default of development with -Werror.
It took me a while to figure out how to make our set of warnings
smaller on older gcc without losing the benefit of the warnings
when using newer gcc (such as the one on Fedora 17), but this
should do the trick.
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Avoid
warnings that gnulib can't silence on older gcc.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/virt-compile-warnings.m4 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4 index 9dee000f6..26f613459 100644 --- a/m4/virt-compile-warnings.m4 +++ b/m4/virt-compile-warnings.m4 @@ -58,6 +58,24 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[ # Gnulib's stat-time.h violates this dontwarn="$dontwarn -Waggregate-return" + # Gnulib uses '#pragma GCC diagnostic push' to silence some + # warnings, but older gcc doesn't support this. + AC_CACHE_CHECK([whether pragma GCC diagnostic push works], + [lv_cv_gcc_pragma_push_works], [ + save_CFLAGS=$CFLAGS + CFLAGS='-Wunknown-pragmas -Werror' + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #pragma GCC diagnostic push + #pragma GCC diagnostic pop + ]])], + [lv_cv_gcc_pragma_push_works=yes], + [lv_cv_gcc_pragma_push_works=no]) + CFLAGS=$save_CFLAGS]) + if test $lv_cv_gcc_pragma_push_works = no; then + dontwarn="$dontwarn -Wmissing-prototypes" + dontwarn="$dontwarn -Wmissing-declarations" + fi + # We might fundamentally need some of these disabled forever, but # ideally we'd turn many of them on dontwarn="$dontwarn -Wfloat-equal" |