diff options
author | Simon McVittie <smcv@collabora.com> | 2023-01-16 12:23:20 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2023-01-16 12:23:20 +0000 |
commit | cca6c046374a2e6a849cc73c809b17b32a26dd30 (patch) | |
tree | c55dc8024e513addf31c8c1351db00d605a8144d | |
parent | 218b35a57cdeab667c75d6ef34f901b8ead00056 (diff) | |
parent | c3e2c873ffa8e89b5f83dccc4e4e35dfcea633cb (diff) | |
download | dbus-cca6c046374a2e6a849cc73c809b17b32a26dd30.tar.gz |
Merge branch 'alignof' into 'master'
Define _DBUS_ALIGNOF using _Alignof when using C11 or newer
See merge request dbus/dbus!389
-rw-r--r-- | dbus/dbus-internals.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index cc98c92a..2387752d 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -201,8 +201,12 @@ void _dbus_real_assert_not_reached (const char *explanation, ((intptr_t) ((unsigned char*) &((struct_type*) 0)->member)) #endif +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus) +#define _DBUS_ALIGNOF(type) _Alignof(type) +#else #define _DBUS_ALIGNOF(type) \ (_DBUS_STRUCT_OFFSET (struct { char _1; type _2; }, _2)) +#endif #if defined(DBUS_DISABLE_CHECKS) || defined(DBUS_DISABLE_ASSERT) /* this is an assert and not an error, but in the typical --disable-checks case (you're trying |