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

2023-01-16 Thread Bruno Haible
Paul Eggert wrote: > The basic idea is to prefer C23 semantics in apps and the rest of Gnulib > by using the new alignasof module, whereas the existing stdalign module > is now for C11/C17 compatibility and is now deprecated. On Android (and probably some other platforms) I now see a compilation

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

2023-01-15 Thread Khem Raj
On Sun, Jan 15, 2023 at 11:52 AM Paul Eggert wrote: > On 2023-01-14 17:51, Paul Eggert wrote: > > > We already have two copies of that stuff elsewhere (in lib/stdalign.in.h > > and m4/stdalign.m4), for reasons that currently escape me. > > To try to address that in an upward-compatible way, I ins

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

2023-01-15 Thread Paul Eggert
Oh, that patch had a misspelling "alignasf"; fixed by installing the attached further patch. From 784f8c776223ba3234c7673664f1fd2a9629bcda Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 15 Jan 2023 11:53:40 -0800 Subject: [PATCH] sys_socket: fix typo Fix typo in previous change. --- mo

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

2023-01-15 Thread Paul Eggert
On 2023-01-14 17:51, Paul Eggert wrote: We already have two copies of that stuff elsewhere (in lib/stdalign.in.h and m4/stdalign.m4), for reasons that currently escape me. To try to address that in an upward-compatible way, I installed the attached. This shrinks the number of copies of that c

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

2023-01-14 Thread Paul Eggert
On 2023-01-14 17:20, Khem Raj wrote: +/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 +. + clang versions < 8.0.0 have the same bug. */ +#elif (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ + || (defi

[PATCH v2] 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. Make exceptions for gcc < 4.9 and clang < 8 where there is bu