public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
Subject: [PATCH v1 2/2] Use C11 alignas in more tricky typedef definition
Date: Tue, 24 Feb 2026 09:55:36 +0000

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 <[email protected]>
Author: Bertrand Drouvot <[email protected]>
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


--fe1S3SCuJMoalI5t--





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v1 2/2] Use C11 alignas in more tricky typedef definition
  In-Reply-To: <no-message-id-494@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox