Skip to content

use _Alignof to avoid UB in ALIGNOF

Khem Raj requested to merge kraj/libxcb:alignof into master

WG14 N2350 clearly says that it is an UB having type definitions within "offsetof" [1]. Clang 16+ has started diagnosing it [2]. This patch changes the implementation of macro "ALIGNOF" to builtin "_Alignof" to avoid undefined behavior.

_Alignof() return the ABI required minimum alignment.

[1] [2]

Signed-off-by: Khem Raj

Merge request reports