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

Roman Bogorodskiy bogorodskiy at gmail.com
Sun Jun 12 14:05:12 UTC 2016


  Fabian Freyer wrote:

> Several gnulib headers rely on feature.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.

Just like Eric said, it's worth to report that to gnulib. Meanwhile, I
think it would be good to prepend some comment before this __GNUC_PREREQ
so readers of the code could understand easily where it's coming from.

> ---
>  config-post.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/config-post.h b/config-post.h
> index 2398d3d..0aa8271 100644
> --- a/config-post.h
> +++ b/config-post.h
> @@ -67,3 +67,14 @@
>  # undef WITH_SECDRIVER_APPARMOR
>  # undef WITH_CAPNG
>  #endif /* LIBVIRT_NSS */
> +
> +#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.7.0
> 
> --
> 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/20160612/c7201d90/attachment-0001.sig>


More information about the libvir-list mailing list