qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] build: handle deprecation of major() in sys/typ


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] build: handle deprecation of major() in sys/types.h
Date: Thu, 22 Sep 2016 16:09:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

On 09/22/2016 03:56 PM, Radim Krčmář wrote:
> GCC 6.2.1 stops the build of qga/commands-posix.c with:
> 
>   In the GNU C Library, `major' is defined by <sys/sysmacros.h>.
>   For historical compatibility, it is currently defined by
>   <sys/types.h> as well, but we plan to remove this soon.
> 
>   To use `major', include <sys/sysmacros.h> directly.
>   If you did not intend to use a system-defined macro `major',
>   you should #undef it after including <sys/types.h>.
> 
> Include <sys/sysmacros.h> for all users of <sys/types.h>.
> 
> Signed-off-by: Radim Krčmář <address@hidden>
> ---
>  include/qemu/osdep.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 9e9fa6154642..fad31c3d5b56 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -64,6 +64,7 @@ extern int daemon(int, int);
>  #include <stdbool.h>
>  #include <stdint.h>
>  #include <sys/types.h>
> +#include <sys/sysmacros.h>

Works for glibc; but <sys/sysmacros.h> is non-standard and not present
on some other systems, so this may fail to build elsewhere.  You'll
probably need a configure probe.  Autoconf also says that some platforms
have <sys/mkdev.h> instead of <sys/sysmacros.h> (per its AC_HEADER_MAJOR
macro).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]