diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2016-02-15 13:45:49 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2016-03-02 18:15:12 +0000 |
commit | ca9ea25e1122b33eaf15c63e4c34ebc157c39f6f (patch) | |
tree | f8af9b3a22057b8ac9d7e9d01b82d38bc0125faf | |
parent | 9abba2d935f360d7c220c654b5b7ef00b49ddbea (diff) |
dbus-internals: add _DBUS_ALIGNOF
This is useful when making static assertions about our types'
properties.
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94136
-rw-r--r-- | dbus/dbus-internals.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 3eb8749f..df8e9643 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -195,6 +195,9 @@ extern const char *_dbus_return_if_fail_warning_format; #define _DBUS_STRUCT_OFFSET(struct_type, member) \ ((intptr_t) ((unsigned char*) &((struct_type*) 0)->member)) +#define _DBUS_ALIGNOF(type) \ + (_DBUS_STRUCT_OFFSET (struct { char _1; type _2; }, _2)) + #ifdef DBUS_DISABLE_CHECKS /* this is an assert and not an error, but in the typical --disable-checks case (you're trying * to really minimize code size), disabling these assertions makes sense. |