[Spice-devel] [win32-qxl]Undefine commonly named macros to avoid 'macro redefinition' warning.

Sandy Stutsman sstutsma at redhat.com
Wed Sep 16 07:03:44 PDT 2015


Only one or two of the macro's are causing the warnings right but if spice/macros.h should add/remove macros, this would break the build again.

----- Original Message -----
> From: "Marc-André Lureau" <mlureau at redhat.com>
> To: "Sandy Stutsman" <sstutsma at redhat.com>
> Cc: spice-devel at lists.freedesktop.org
> Sent: Wednesday, September 16, 2015 9:53:03 AM
> Subject: Re: [Spice-devel] [win32-qxl]Undefine commonly named macros to avoid 'macro redefinition' warning.
> 
> Hi
> 
> ----- Original Message -----
> > 
> > A change to spice-protocol adds spice/macros.h to the QXL driver build,
> > causing some macros to be redefined. The resulting compiler warnings
> > break the build.  Adding undef statements before the actual macro
> > definitions fixes the warnings.
> > ---
> 
> Why not just remove those define?
> 
> >  xddm/display/quic.c  | 1 +
> >  xddm/display/utils.h | 9 ++++++++-
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/xddm/display/quic.c b/xddm/display/quic.c
> > index ee12fab..8976962 100644
> > --- a/xddm/display/quic.c
> > +++ b/xddm/display/quic.c
> > @@ -60,6 +60,7 @@
> >  #define QUIC_VERSION_MINOR 1U
> >  #define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MAJOR &
> >  0xffff))
> >  
> > +#undef ABS
> >  #define ABS(a) ((a) >= 0 ? (a) : -(a))
> >  
> >  #ifdef ASSERT
> > diff --git a/xddm/display/utils.h b/xddm/display/utils.h
> > index a8d0de6..c69f9f9 100644
> > --- a/xddm/display/utils.h
> > +++ b/xddm/display/utils.h
> > @@ -22,12 +22,19 @@
> >  #ifndef _H_UTILS
> >  #define _H_UTILS
> >  
> > +#undef MIN
> >  #define MIN(x, y) (((x) <= (y)) ? (x) : (y))
> > +
> > +#undef MAX
> >  #define MAX(x, y) (((x) >= (y)) ? (x) : (y))
> > -#define ALIGN(a, b) (((a) + ((b) - 1)) & ~((b) - 1))
> >  
> > +#undef ALIGN
> > +#define ALIGN(a, b) (((a) + ((b) - 1)) & ~((b) - 1))
> >  
> > +#undef OFFSETOF
> >  #define OFFSETOF(type, member) ((UINT64)&((type *)0)->member)
> > +
> > +#undef CONTAINEROF
> >  #define CONTAINEROF(ptr, type, member) \
> >      ((type *) ((UINT8 *)(ptr) - OFFSETOF(type, member)))
> >  
> > --
> > 1.9.5.msysgit.0
> > 
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> > 
> 


More information about the Spice-devel mailing list