]> git.sesse.net Git - vlc/blobdiff - include/vlc_common.h
VLC_OBJECT: expansion safety
[vlc] / include / vlc_common.h
index 1e7bbf16b622677f1cde6b7d65eede018a8b1594..8b1c32b7f79937c1651186801113ded9333aa8a4 100644 (file)
@@ -532,8 +532,12 @@ typedef struct vlc_object_internals_t vlc_object_internals_t;
 /**@}*/                                                                     \
 
 /* VLC_OBJECT: attempt at doing a clever cast */
-#define VLC_OBJECT( x ) \
-    (((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct)
+#ifdef __GNUC__
+# define VLC_OBJECT( x ) \
+    (((vlc_object_t *)(x))+0*(((typeof(x))0)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct))
+#else
+# define VLC_OBJECT( x ) ((vlc_object_t *)(x))
+#endif
 
 #define VLC_GC_MEMBERS                                                       \
 /** \name VLC_GC_MEMBERS                                                     \