Skip to content

Switch from C99 to C11 standard

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

We need to start using _Alignof consistently as the fallback implementation which uses types within offsetof is UB as per WG14 N2350 [1], moreover newer compilers like clang 16+ have started to error on such use.

Fixes errors like below with clang 16+

| ../glib-2.74.4/glib/ghash.c:299:18: error: 'struct (unnamed at ../glib-2.74.4/glib/ghash.c:299:1)' cannot be defined in '__builtin_offsetof' | G_STATIC_ASSERT (G_ALIGNOF (GHashTableIter) >= G_ALIGNOF (RealIter));

[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