Use C11 alignas in pg_atomic_uint64 definitions
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 27 Nov 2025 06:39:25 +0000 (07:39 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 27 Nov 2025 06:53:34 +0000 (07:53 +0100)
They were already using pg_attribute_aligned.  This replaces that with
alignas and moves that into the required syntactic position.  This
ends up making these three atomics implementations appear a bit more
consistent, but shouldn't change anything otherwise.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/46f05236-d4d4-4b4e-84d4-faa500f14691%40eisentraut.org

src/include/port/atomics/arch-ppc.h
src/include/port/atomics/generic-gcc.h
src/include/port/atomics/generic-msvc.h

index b93f6766d299fc913a178de0390e6408bb45b431..2b3c32834696d37bf7c7e0f48988806d8e555b9d 100644 (file)
@@ -36,7 +36,7 @@ typedef struct pg_atomic_uint32
 #define PG_HAVE_ATOMIC_U64_SUPPORT
 typedef struct pg_atomic_uint64
 {
-   volatile uint64 value pg_attribute_aligned(8);
+   alignas(8) volatile uint64 value;
 } pg_atomic_uint64;
 
 #endif
index a0751f2286a81990a3abbb4c9d62c9ddf6854a7c..ee65647c53f90f998c888a975dd980e2f54f83e3 100644 (file)
@@ -100,10 +100,9 @@ typedef struct pg_atomic_uint32
    && (defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS))
 
 #define PG_HAVE_ATOMIC_U64_SUPPORT
-
 typedef struct pg_atomic_uint64
 {
-   volatile uint64 value pg_attribute_aligned(8);
+   alignas(8) volatile uint64 value;
 } pg_atomic_uint64;
 
 #endif /* defined(HAVE_GCC__ATOMIC_INT64_CAS) || defined(HAVE_GCC__SYNC_INT64_CAS) */
index a6ea5f1c2e76728b2394208881ab426053cd7138..3d3c5363446dbd4c8e0a7d5133f518eb7d3c0386 100644 (file)
@@ -37,9 +37,9 @@ typedef struct pg_atomic_uint32
 } pg_atomic_uint32;
 
 #define PG_HAVE_ATOMIC_U64_SUPPORT
-typedef struct pg_attribute_aligned(8) pg_atomic_uint64
+typedef struct pg_atomic_uint64
 {
-   volatile uint64 value;
+   alignas(8) volatile uint64 value;
 } pg_atomic_uint64;