Re: [PATCH] build: avoid warnings on older gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 14, 2012 at 04:42:24PM -0600, Eric Blake wrote:
> The previous patch pulled in a newer version of stat-time.h from
> gnulib, which tries to suppress some stupid gcc warnings (see
> <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>) by exploiting
> a feature of newer gcc.  But we still aim to compile on RHEL 6.3,
> with gcc 4.4.6 (not to mention even older devel platforms like
> RHEL 5), which fails to build thanks to our development -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.
> ---
> 
> If I don't get a review by tomorrow, I will go ahead and push this
> under the build-breaker rule.
> 
>  m4/virt-compile-warnings.m4 | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index 9dee000..702506d 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -58,6 +58,23 @@ 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_VAL([lv_cv_gcc_pragma_push_works], [
> +      save_CFLAGS=$CFLAGS
> +      CFLAGS=-Wunknown-pragmas
> +      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"

  Looks reasonable, ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]