[libvirt] [PATCH 1/6] Ensure consistent enablement of gcc 'diagnostic' pragma
Eric Blake
eblake at redhat.com
Mon May 13 19:16:35 UTC 2013
[adding bug-gnulib]
On 05/13/2013 06:17 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> The virt-compile-warnings.m4 file would do an explicit
> check for whether the compile could use the 'diagnostic'
> pragma push/pop feature. The src/internal.h file would
> then only enable it for GCC >= 4.6
>
> This breaks with clang which supports the pragma but
> does not claim GCC 4.6 compat. Export a variable from
> the m4 check to the header file so they are consistent.
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
> m4/virt-compile-warnings.m4 | 3 +++
> src/internal.h | 2 +-
> 2 files changed, 4 insertions(+), 1 deletion(-)
ACK. Hmm, I wonder if gnulib should use something similar, for the
places where it uses pragma gcc push.
>
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index e054913..fbeb3eb 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -94,6 +94,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
> dontwarn="$dontwarn -Wmissing-prototypes"
> dontwarn="$dontwarn -Wmissing-declarations"
> dontwarn="$dontwarn -Wcast-align"
> + else
> + AC_DEFINE_UNQUOTED([WORKING_PRAGMA_PUSH], 1,
> + [Define to 1 if gcc supports pragma push/pop])
> fi
>
> dnl Check whether strchr(s, char variable) causes a bogus compile
> diff --git a/src/internal.h b/src/internal.h
> index d819aa3..03c2493 100644
> --- a/src/internal.h
> +++ b/src/internal.h
> @@ -215,7 +215,7 @@
> # endif /* __GNUC__ */
>
>
> -# if __GNUC_PREREQ (4, 6)
> +# if WORKING_PRAGMA_PUSH
> # define VIR_WARNINGS_NO_CAST_ALIGN \
> _Pragma ("GCC diagnostic push") \
> _Pragma ("GCC diagnostic ignored \"-Wcast-align\"")
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130513/bed84e86/attachment-0001.sig>
More information about the libvir-list
mailing list