[libvirt] [PATCH 1/6] config-post.h: define __GNUC_PREREQ if not defined

Roman Bogorodskiy bogorodskiy at gmail.com
Tue Jul 5 00:43:35 UTC 2016


  Fabian Freyer wrote:

> (resent due to mail client line mangling)
> 
> Several gnulib headers rely on features.h being included by ctype.h to provide
> __GNUC_PREREQ, but on systems without glibc, this is not provided. In these
> cases __GNUC_PREREQ gets redefined to 0, which causes build errors from checks
> in src/internal.h.
> Therefore, define __GNUC_PREREQ as early as possible. config.h is probably the
> first header that is included, before any other headers.
> ---
>  config-post.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/config-post.h b/config-post.h
> index f43521b..74d7bf2 100644
> --- a/config-post.h
> +++ b/config-post.h
> @@ -69,3 +69,21 @@
>  # undef WITH_SECDRIVER_APPARMOR
>  # undef WITH_CAPNG
>  #endif /* LIBVIRT_NSS */
> +
> +/*
> + * Define __GNUC__ to a sane default if it isn't yet defined.
> + * This is done here so that it's included as early as possible; gnulib relies
> + * on this to be defined in features.h, which should be included from ctype.h.
> + * This doesn't happen on many non-glibc systems.
> + * When __GNUC__ is not defined, gnulib defines it to 0, which breaks things.
> + */

Nit: there was a trailing whitespace here.

ACK

Please don't forget to report this issue to bug-gnulib at gnu.org.

> +#ifdef __GNUC__
> +# ifndef __GNUC_PREREQ
> +#  if defined __GNUC__ && defined __GNUC_MINOR__
> +#   define __GNUC_PREREQ(maj, min)                                        \
> +   ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
> +#  else
> +#   define __GNUC_PREREQ(maj, min) 0
> +#  endif
> +# endif
> +#endif
> -- 
> 2.5.5
> 
> 
> 
> 




> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160705/62b38765/attachment-0001.sig>


More information about the libvir-list mailing list