]> git.ipfire.org Git - thirdparty/dbus.git/commit
Define _DBUS_ALIGNOF using _Alignof when using C11 or newer
authorKhem Raj <raj.khem@gmail.com>
Sat, 14 Jan 2023 20:39:43 +0000 (12:39 -0800)
committerKhem Raj <raj.khem@gmail.com>
Sat, 14 Jan 2023 20:43:15 +0000 (12:43 -0800)
commitc3e2c873ffa8e89b5f83dccc4e4e35dfcea633cb
treec55dc8024e513addf31c8c1351db00d605a8144d
parent218b35a57cdeab667c75d6ef34f901b8ead00056
Define _DBUS_ALIGNOF using _Alignof when using C11 or newer

WG14 N2350 made very clear that it is an UB having type definitions
within "offsetof" [1]. This patch changes the implementation of macro
_DBUS_ALIGNOF to builtin "_Alignof" to avoid undefined behavior.

clang 16+ has started to diagnose this [2]

Fixes build when using -std >= gnu11 and using clang16+

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
[2] https://reviews.llvm.org/D133574

Signed-off-by: Khem Raj <raj.khem@gmail.com>
dbus/dbus-internals.h