pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Simplifying our Trap/Assert infrastructure
Date: Mon, 31 Oct 2022 10:02:35 +0100
Message-ID: <f64365b1-d5f9-ef83-41fe-404810f10e5a@enterprisedb.com> (raw)
In-Reply-To: <Y18RCGE+Lyl07HyN@paquier.xyz>
References: <3928703.1665345117@sss.pgh.pa.us>
	<20221009210148.GA900071@nathanxps13>
	<20221012183620.GA1447761@nathanxps13>
	<fe8a3770-1256-cf96-f3fa-db526fd09568@enterprisedb.com>
	<Y1oyCXhg/6Odn6L/@paquier.xyz>
	<572ed6f8-a137-0a52-a35e-a48df95af6ed@enterprisedb.com>
	<Y18RCGE+Lyl07HyN@paquier.xyz>

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.

Attachments:

0001-Make-AssertPointerAlignment-available-to-frontend-co.patch (text/plain, 1.4K) download From b11de03185e6e2f2f2d0b2b3a18adb019aade610 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@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

view thread (13+ messages)  latest in thread

Message-ID: <f64365b1-d5f9-ef83-41fe-404810f10e5a@enterprisedb.com>
Permalink:  ../f64365b1-d5f9-ef83-41fe-404810f10e5a@enterprisedb.com/
Also on:    postgresql.org/message-id/f64365b1-d5f9-ef83-41fe-404810f10e5a@enterprisedb.com

 ·  · 

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: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, michael@paquier.xyz, nathandbossart@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: Simplifying our Trap/Assert infrastructure
  In-Reply-To: <f64365b1-d5f9-ef83-41fe-404810f10e5a@enterprisedb.com>

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

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