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

Christophe Fergeau cfergeau at redhat.com
Wed Sep 16 07:35:56 PDT 2015


On Wed, Sep 16, 2015 at 09:45:49AM -0400, Sandy Stutsman wrote:
> 
> 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.

Can we just remove them from here, and add a #include <spice/macros.h>
to be 100% sure they are available in utils.h?

Christophe

> ---
>  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150916/fac7fba5/attachment.sig>


More information about the Spice-devel mailing list