diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2016-03-02 11:25:09 +0000 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2016-03-02 12:05:55 +0000 |
commit | 0721716bb8c29f7d9abf1942182ad072fa0cc248 (patch) | |
tree | 9556a28313415788667111de6771eb5cf8fecb11 | |
parent | 47076559628d71c128e14e11147ce36b92677885 (diff) | |
download | spice-protocol-0721716bb8c29f7d9abf1942182ad072fa0cc248.tar.gz spice-protocol-0721716bb8c29f7d9abf1942182ad072fa0cc248.tar.xz spice-protocol-0721716bb8c29f7d9abf1942182ad072fa0cc248.zip |
macros: do not use more type safe CONTAINEROF version if not requested
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@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
-rw-r--r-- | spice/macros.h | 7 |
1 files changed, 6 insertions, 1 deletions
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))); }) |