Re: [PATCH v2] macros: do not use more type safe CONTAINEROF version if not requested

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

 



Looks good to me, ACK.

Christophe

On Wed, Mar 02, 2016 at 11:26:05AM +0000, Frediano Ziglio wrote:
> This prevents incompatibility if users (like old spice-server/spice-gtk)
> are not expected to have this additional restriction.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  spice/macros.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> Changes since v1:
> - macro name;
> - added code comment.
> 
> diff --git a/spice/macros.h b/spice/macros.h
> index 2efbaff..a0413f3 100644
> --- a/spice/macros.h
> +++ b/spice/macros.h
> @@ -143,7 +143,12 @@
>      ((long) ((uint8_t*) &((struct_type*) 0)->member))
>  #endif
>  
> -#if    __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
> +/* The SPICE_USE_SAFER_CONTAINEROF macro is used to avoid
> + * compilation breakage with older spice-server releases which
> + * triggered some errors without an additional patch.
> + */
> +#if defined(__GNUC__) && defined(SPICE_USE_SAFER_CONTAINEROF) && \
> +    (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
>  #define SPICE_CONTAINEROF(ptr, struct_type, member) ({ \
>      const typeof( ((struct_type *)0)->member ) *__mptr = (ptr);    \
>      ((struct_type *)(void *)((uint8_t *)(__mptr) - SPICE_OFFSETOF(struct_type, member))); })
> -- 
> 2.5.0
> 
> _______________________________________________
> 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]