From: Simon McVittie Date: Wed, 14 Sep 2022 12:32:47 +0000 (+0100) Subject: dbus-marshal-basic: Use _DBUS_ALIGNOF to compare alignments X-Git-Tag: dbus-1.15.4~20^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0805bc3f1ce4ff6fe9dd072b1ceb08e854e206e;p=thirdparty%2Fdbus.git dbus-marshal-basic: Use _DBUS_ALIGNOF to compare alignments This means we get the alignment comparisons even on non-gcc compilers. Signed-off-by: Simon McVittie --- diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c index 938e29230..1f5d54a4e 100644 --- a/dbus/dbus-marshal-basic.c +++ b/dbus/dbus-marshal-basic.c @@ -30,19 +30,10 @@ #include -#if defined(__GNUC__) && (__GNUC__ >= 4) -# define _DBUS_ASSERT_ALIGNMENT(type, op, val) \ - _DBUS_STATIC_ASSERT (__extension__ __alignof__ (type) op val) -# define _DBUS_ASSERT_CMP_ALIGNMENT(left, op, right) \ - _DBUS_STATIC_ASSERT (__extension__ __alignof__ (left) op __extension__ __alignof__ (right)) -#else - /* not gcc, so probably no alignof operator: just use a no-op statement - * that's valid in the same contexts */ -# define _DBUS_ASSERT_ALIGNMENT(type, op, val) \ - _DBUS_STATIC_ASSERT (TRUE) -# define _DBUS_ASSERT_CMP_ALIGNMENT(left, op, right) \ - _DBUS_STATIC_ASSERT (TRUE) -#endif +#define _DBUS_ASSERT_ALIGNMENT(type, op, val) \ + _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (type) op val) +#define _DBUS_ASSERT_CMP_ALIGNMENT(left, op, right) \ + _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (left) op _DBUS_ALIGNOF (right)) /* True by definition, but just for completeness... */ _DBUS_STATIC_ASSERT (sizeof (char) == 1);