Re: [PATCH spice-gtk] Adjust include header to new location of macros

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

 



Hi,

On Tue, Nov 01, 2016 at 05:08:01PM +0100, Pavel Grunt wrote:
> minor & major macros were moved to sysmacros.h
>
> usbutil.c: In function ‘spice_usbutil_get_sysfs_attribute’:
> usbutil.c:110:14: warning: ‘__major_from_sys_types’ is deprecated:
>   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>.
>   [-Wdeprecated-declarations]
>               major(stat_buf.st_rdev), minor(stat_buf.st_rdev), attribute);
> ---
>  src/usbutil.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/usbutil.c b/src/usbutil.c
> index 7bfbe44..c4dd17c 100644
> --- a/src/usbutil.c
> +++ b/src/usbutil.c
> @@ -30,7 +30,10 @@
>  #ifdef __linux__
>  #include <stdio.h>
>  #include <unistd.h>
> +#include <sys/sysmacros.h>
> +#ifndef major /* major and minor macros were moved to sys/sysmacros from sys/types.h */
>  #include <sys/types.h>
> +#endif

So, sys/types.h was included only for major macro?
The patch removes the include if major is defined.

Well, it builds without warnings with your patch so I think it is fine
but I would consider using #undef after <sys/types.h> as the warning
suggests.

Should be fine either way.

Acked-by: Victor Toso <victortoso@xxxxxxxxxx>

>  #include <sys/stat.h>
>  #endif
>  #include "usbutil.h"
> -- 
> 2.10.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]