Re: alignas (C11)

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-12T14:02:42Z
Lists: pgsql-hackers
Hi,

On 2025-11-12 12:39:19 +0100, Peter Eisentraut wrote:
> - You cannot use alignas on a typedef.  So some uses of the attribute
> pg_attribute_aligned() like for PgAioUringContext or the whole int128
> business cannot be converted directly.  The solution for cases like
> PgAioUringContext could be to move the alignas into the struct, but I
> haven't studied this code closely enough, so I'm leaving it.  For int128,
> there is no straightforward solution, so I'm also leaving that as is.

Maybe I'm confused, but the aligned attribute for PgAioUringContext is on the
struct, not the typedef, no?

Greetings,

Andres Freund



Commits

  1. Further fix extended alignment for older g++.

  2. Disable extended alignment uses on older g++

  3. Work around buggy alignas in older g++

  4. Use C11 alignas in pg_atomic_uint64 definitions

  5. C11 alignas instead of unions -- extended alignments

  6. C11 alignas instead of unions

  7. Add <stdalign.h> to c.h