On 31.10.22 01:04, Michael Paquier wrote:
On Fri, Oct 28, 2022 at 09:36:23AM +0200, Peter Eisentraut wrote:
Would there be a use for that?  It's currently only used in the atomics
code.

Yep, but they would not trigger when using atomics in the frontend
code.  We don't have any use for that in core on HEAD, still that
could be useful for some external frontend code?  Please see the
attached.

I don't think we need separate definitions for frontend and backend, since the contained Assert() will take care of the difference. So the attached would be simpler.
From b11de03185e6e2f2f2d0b2b3a18adb019aade610 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Mon, 31 Oct 2022 10:00:44 +0100
Subject: [PATCH] Make AssertPointerAlignment available to frontend code

---
 src/include/c.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/include/c.h b/src/include/c.h
index d70ed84ac58e..98cdd285dd98 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -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
-- 
2.37.3

Reply via email to