From e908a2c0e2b0a9d8a6915f60439f75adfe885b66 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Tue, 24 Feb 2026 09:55:36 +0000
Subject: [PATCH v1 2/2] Use C11 alignas in more tricky typedef definition

Same as commit "xxx" but the alignas has to be guarded because it makes sense
if used together with pg_attribute_packed().

Suggested-by: Peter Eisentraut <peter@eisentraut.org>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/d7a788fa-e609-4894-a8be-2f70e135424f%40eisentraut.org
---
 src/include/storage/itemptr.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
 100.0% src/include/storage/

diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h
index 8b3392dbefe..a70c543dac3 100644
--- a/src/include/storage/itemptr.h
+++ b/src/include/storage/itemptr.h
@@ -35,14 +35,17 @@
  */
 typedef struct ItemPointerData
 {
+/* If compiler understands packed pragma, use alignas with it */
+#if defined(pg_attribute_packed)
+	alignas(2)
+#endif
 	BlockIdData ip_blkid;
 	OffsetNumber ip_posid;
 }
 
-/* If compiler understands packed and aligned pragmas, use those */
-#if defined(pg_attribute_packed) && defined(pg_attribute_aligned)
+/* If compiler understands packed pragma, use it with alignas */
+#if defined(pg_attribute_packed)
 			pg_attribute_packed()
-			pg_attribute_aligned(2)
 #endif
 ItemPointerData;
 
-- 
2.34.1

