summaryrefslogtreecommitdiff
path: root/dbus
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-09-14 13:32:47 +0100
committerSimon McVittie <smcv@collabora.com>2022-11-29 22:11:07 +0000
commitc0805bc3f1ce4ff6fe9dd072b1ceb08e854e206e (patch)
tree388019739e72b5c6e1f6baf73af6679a20215048 /dbus
parent721307c4014ef779c7af3276885518ebff700dd7 (diff)
downloaddbus-c0805bc3f1ce4ff6fe9dd072b1ceb08e854e206e.tar.gz
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 <smcv@collabora.com>
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-marshal-basic.c17
1 files changed, 4 insertions, 13 deletions
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 <string.h>
-#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);