agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
Subject: [PATCH v2 2/4] Deprecate XLogRecPtrIsInvalid()
Date: Wed, 29 Oct 2025 10:57:17 +0000

Emit a warning message at compilation time if XLogRecPtrIsInvalid() is in use in
the code base.
---
 src/include/access/xlogdefs.h | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
 100.0% src/include/access/

diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h
index 33b9913e71e..6eebf86342e 100644
--- a/src/include/access/xlogdefs.h
+++ b/src/include/access/xlogdefs.h
@@ -26,9 +26,27 @@ typedef uint64 XLogRecPtr;
  * record can begin at zero.
  */
 #define InvalidXLogRecPtr	0
-#define XLogRecPtrIsInvalid(r)	((r) == InvalidXLogRecPtr)
 #define XLogRecPtrIsValid(r) ((r) != InvalidXLogRecPtr)
 
+/*
+ * XLogRecPtrIsInvalid
+ *
+ * Deprecated: Use XLogRecPtrIsValid() instead.
+ */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L || defined(__cplusplus) && __cplusplus >= 201402L
+[[deprecated("use XLogRecPtrIsValid() instead")]]
+#elif defined(__GNUC__) || defined(__clang__)
+__attribute__((deprecated("use XLogRecPtrIsValid() instead")))
+#elif defined(_MSC_VER)
+__declspec(deprecated("use XLogRecPtrIsValid() instead"))
+#endif
+
+static inline bool
+XLogRecPtrIsInvalid(XLogRecPtr ptr)
+{
+	return ptr == InvalidXLogRecPtr;
+}
+
 /*
  * First LSN to use for "fake" LSNs.
  *
-- 
2.34.1


--RP3OEw+JChfNR0gk
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="v2-0003-Replace-InvalidXLogRecPtr-comparisons-with-XLogRe.patch"



view thread (2+ messages)

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 v2 2/4] Deprecate XLogRecPtrIsInvalid()
  In-Reply-To: <no-message-id-25949@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