From c0805bc3f1ce4ff6fe9dd072b1ceb08e854e206e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 14 Sep 2022 13:32:47 +0100 Subject: 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 --- dbus/dbus-marshal-basic.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c index 938e2923..1f5d54a4 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); -- cgit v1.2.1