Re: Confused static assertion implementation - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Confused static assertion implementation
Date
Msg-id f763c540-603c-4dc8-bdbd-c58878f49880@eisentraut.org
Whole thread Raw
In response to Re: Confused static assertion implementation  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
On 14.11.25 23:27, Thomas Munro wrote:
> On Fri, Nov 14, 2025 at 6:18 PM Chao Li <li.evan.chao@gmail.com> wrote:
>> As you added a semi-colon in the line, the one after the empty line can be deleted, though C allows empty statement,
butunnecessary, and may lead to confusion for code readers.
 
> 
>> You missed to replace this pgac_cv__static_assert with the new name.
> 
> Ugh, yeah, the configure change was hopeless.  It looked like it
> worked in configure's stdout, which I mistook for success and posted
> too soon, sorry about that.  I have fixed those points and verified
> that pg_config.h actually has the expected value.

I have committed this, with some light editing of the comments.

We are now down to 4 from previously 12 static assertion implementation 
variants!

Note, however, that the now committed non-statement-expression fallback 
implementation of StaticAssertExpr() does not work under C++.  (The 
compiler complains about "types may not be defined in 'sizeof' 
expressions".)  This isn't a regression in the overall sense, since, as 
you had mentioned, previously all C++ variants required statement 
expressions.  So I think this can be added to the list of C++ 
portability issues that Jelte is currently working through.




pgsql-hackers by date:

Previous
From: Amul Sul
Date:
Subject: Re: alter check constraint enforceability
Next
From: Marcos Pegoraro
Date:
Subject: Re: Get rid of "Section.N.N.N" on DOCs