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

Marc-André Lureau mlureau at redhat.com
Wed Sep 16 06:53:03 PDT 2015


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