[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: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH] build: handle deprecation of major() in sys/types.h |
Date: |
Thu, 22 Sep 2016 21:09:06 +0000 |
Hi
On Fri, Sep 23, 2016 at 12:58 AM Radim Krčmář <address@hidden> wrote:
> GCC 6.2.1 stops the build of qga/commands-posix.c with:
>
>
It would not be only qga, but at least:
hw/9pfs/9p.c: major(stbuf->st_rdev), minor(stbuf->st_rdev));
linux-user/strace.c: print_raw_param("makedev(%d", major(arg2), 0);
linux-user/strace.c: print_raw_param("makedev(%d", major(arg3), 0);
qga/commands-posix.c: *devmajor = major(st.st_rdev);
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>
>
I doubt this will work with mingw (I didn't try, but it is not in my mingw
prefix), perhaps better in include/sysemu/os-posix.h?
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> --
> 2.10.0
>
>
> --
Marc-André Lureau