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

2016-11-03 Thread Victor Toso
Hi,

On Thu, Nov 03, 2016 at 01:10:20PM +0100, Pavel Grunt wrote:
> On Thu, 2016-11-03 at 13:05 +0100, Victor Toso wrote:
> > 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 .
> > >   For historical compatibility, it is currently defined by
> > >    as well, but we plan to remove this soon.
> > >   To use `major', include  directly.
> > >   If you did not intend to use a system-defined macro `major',
> > >   you should #undef it after including .
> > >   [-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 
> > >  #include 
> > > +#include 
> > > +#ifndef major /* major and minor macros were moved to
> > > sys/sysmacros from sys/types.h */
> > >  #include 
> > > +#endif
> > 
> > So, sys/types.h was included only for major macro?
> 
> yes, for major and minor macros
> 
> > 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  as the warning
> > suggests.
> there would be no "major" macro after that

 | To use `major', include  directly.
 | If you did not intend to use a system-defined macro `major',
 | you should #undef it after including .

I mean, undef after sys/types.h and then include it from the right
header (sys/sysmacros.h) (so you don't have two macros with same
name...)

Either way is fine to me.

> 
> > 
> > Should be fine either way.
> > 
> > Acked-by: Victor Toso 
> > 
> > >  #include 
> > >  #endif
> > >  #include "usbutil.h"
> > > -- 
> > > 2.10.1
> > > 
> > > ___
> > > Spice-devel mailing list
> > > Spice-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/spice-devel


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2016-11-03 Thread Pavel Grunt
On Thu, 2016-11-03 at 13:05 +0100, Victor Toso wrote:
> 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 .
> >   For historical compatibility, it is currently defined by
> >    as well, but we plan to remove this soon.
> >   To use `major', include  directly.
> >   If you did not intend to use a system-defined macro `major',
> >   you should #undef it after including .
> >   [-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 
> >  #include 
> > +#include 
> > +#ifndef major /* major and minor macros were moved to
> > sys/sysmacros from sys/types.h */
> >  #include 
> > +#endif
> 
> So, sys/types.h was included only for major macro?

yes, for major and minor macros

> 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  as the warning
> suggests.
there would be no "major" macro after that

> 
> Should be fine either way.
> 
> Acked-by: Victor Toso 
> 
> >  #include 
> >  #endif
> >  #include "usbutil.h"
> > -- 
> > 2.10.1
> > 
> > ___
> > Spice-devel mailing list
> > Spice-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2016-11-03 Thread Victor Toso
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 .
>   For historical compatibility, it is currently defined by
>as well, but we plan to remove this soon.
>   To use `major', include  directly.
>   If you did not intend to use a system-defined macro `major',
>   you should #undef it after including .
>   [-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 
>  #include 
> +#include 
> +#ifndef major /* major and minor macros were moved to sys/sysmacros from 
> sys/types.h */
>  #include 
> +#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  as the warning
suggests.

Should be fine either way.

Acked-by: Victor Toso 

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


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk] Adjust include header to new location of macros

2016-11-01 Thread Pavel Grunt
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 .
  For historical compatibility, it is currently defined by
   as well, but we plan to remove this soon.
  To use `major', include  directly.
  If you did not intend to use a system-defined macro `major',
  you should #undef it after including .
  [-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 
 #include 
+#include 
+#ifndef major /* major and minor macros were moved to sys/sysmacros from 
sys/types.h */
 #include 
+#endif
 #include 
 #endif
 #include "usbutil.h"
-- 
2.10.1

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