Skip to content

tests/macros.c: Define check_alignof for std=c11 and newer

Khem Raj requested to merge kraj/glib:alignof into main

WG14 N2350 made very clear that it is an UB having type definitions within "offsetof" [1]. This patch changes the implementation of macro check_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

Merge request reports