Make AssertPointerAlignment available to frontend code
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 3 Nov 2022 15:53:46 +0000 (11:53 -0400)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 3 Nov 2022 16:04:22 +0000 (12:04 -0400)
We don't need separate definitions for frontend and backend, since the
contained Assert() will take care of the difference.  So this also
makes it simpler overall.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/f64365b1-d5f9-ef83-41fe-404810f10e5a@enterprisedb.com

src/include/c.h

index d70ed84ac58e3367fc60bf50924ff834a193e177..98cdd285dd987368e8b0bdb67d1bbeb76861758c 100644 (file)
@@ -793,14 +793,12 @@ typedef NameData *Name;
 
 #define Assert(condition)  ((void)true)
 #define AssertMacro(condition) ((void)true)
-#define AssertPointerAlignment(ptr, bndr)  ((void)true)
 
 #elif defined(FRONTEND)
 
 #include <assert.h>
 #define Assert(p) assert(p)
 #define AssertMacro(p) ((void) assert(p))
-#define AssertPointerAlignment(ptr, bndr)  ((void)true)
 
 #else                          /* USE_ASSERT_CHECKING && !FRONTEND */
 
@@ -824,14 +822,14 @@ typedef NameData *Name;
    ((void) ((condition) || \
             (ExceptionalCondition(#condition, __FILE__, __LINE__), 0)))
 
+#endif                         /* USE_ASSERT_CHECKING && !FRONTEND */
+
 /*
  * Check that `ptr' is `bndr' aligned.
  */
 #define AssertPointerAlignment(ptr, bndr) \
    Assert(TYPEALIGN(bndr, (uintptr_t)(ptr)) == (uintptr_t)(ptr))
 
-#endif                         /* USE_ASSERT_CHECKING && !FRONTEND */
-
 /*
  * ExceptionalCondition is compiled into the backend whether or not
  * USE_ASSERT_CHECKING is defined, so as to support use of extensions