Re: [PATCH] Define alignof_slot using _Alignof when using C11 or newer

2023-01-14 Thread Paul Eggert
On 2023-01-14 16:17, Bruno Haible wrote: What's (quasi) normative is * n3047.pdf = C23, which says in 7.21.(3) "If the specified type defines a new type or if the specified member is a bit-field, the behavior is undefined." I'm afraid this wording in n3047 is unclear. Ordinarily

Re: [PATCH] Define alignof_slot using _Alignof when using C11 or newer

2023-01-14 Thread Khem Raj
On Sat, Jan 14, 2023 at 4:17 PM Bruno Haible wrote: > > Khem Raj wrote: > > [2] https://reviews.llvm.org/D133574 > > Thanks for the heads-up. > > > WG14 N2350 made very clear that it is an UB having type definitions > > within "offsetof" [1]. > > [1] https://www.open-std.org/jtc1/sc22/wg14/www/doc

Re: [PATCH] Define alignof_slot using _Alignof when using C11 or newer

2023-01-14 Thread Bruno Haible
Khem Raj wrote: > [2] https://reviews.llvm.org/D133574 Thanks for the heads-up. > WG14 N2350 made very clear that it is an UB having type definitions > within "offsetof" [1]. > [1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm This document is not normative; it is merely a discussio

[PATCH] Define alignof_slot using _Alignof when using C11 or newer

2023-01-14 Thread Khem Raj
WG14 N2350 made very clear that it is an UB having type definitions within "offsetof" [1]. This patch enhances the implementation of macro alignof_slot to use builtin "_Alignof" to avoid undefined behavior on when using std=c11 or newer clang 16+ has started to flag this [2] Fixes build when usin