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] 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

Merge request reports

Loading