From b485a7128bd88613ed0c65418f6d272fac621f41 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@partin.io>
Date: Wed, 23 Sep 2026 06:31:28 +0000
Subject: [PATCH v2 6/8] Give LsnReadQueue's entries a struct name

Anonymous structs are a little bit harder to read in Clang's
diagnostics:

	struct (unnamed struct at file.c:<line>:<col>)[] __counted_by(size)

With an actual struct name, the diagnostic is much more readable:

	struct LsnReadQueueEntry[] __counted_by(size)

Author: Tristan Partin <tristan@partin.io>
Signed-off-by: Tristan Partin <tristan@partin.io>
---
 src/backend/access/transam/xlogprefetcher.c | 15 ++++++++++-----
 src/tools/pgindent/typedefs.list            |  1 +
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/backend/access/transam/xlogprefetcher.c b/src/backend/access/transam/xlogprefetcher.c
index 011f0a98e74..f78656bce9e 100644
--- a/src/backend/access/transam/xlogprefetcher.c
+++ b/src/backend/access/transam/xlogprefetcher.c
@@ -97,6 +97,15 @@ typedef enum
 typedef LsnReadQueueNextStatus (*LsnReadQueueNextFun) (uintptr_t lrq_private,
 													   XLogRecPtr *lsn);
 
+/*
+ * One entry of the queue below.
+ */
+typedef struct LsnReadQueueEntry
+{
+	bool		io;
+	XLogRecPtr	lsn;
+} LsnReadQueueEntry;
+
 /*
  * A simple circular queue of LSNs, using to control the number of
  * (potentially) inflight IOs.  This stands in for a later more general IO
@@ -113,11 +122,7 @@ typedef struct LsnReadQueue
 	uint32		head;
 	uint32		tail;
 	uint32		size;
-	struct
-	{
-		bool		io;
-		XLogRecPtr	lsn;
-	}			queue[FLEXIBLE_ARRAY_MEMBER] pg_attribute_counted_by(size);
+	LsnReadQueueEntry queue[FLEXIBLE_ARRAY_MEMBER] pg_attribute_counted_by(size);
 } LsnReadQueue;
 
 /*
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index 5d432074c2c..257d0b18810 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -1704,6 +1704,7 @@ LogicalTape
 LogicalTapeSet
 LookupSet
 LsnReadQueue
+LsnReadQueueEntry
 LsnReadQueueNextFun
 LsnReadQueueNextStatus
 LtreeGistOptions
-- 
Tristan Partin
https://tristan.partin.io

