Re: pg_attribute_noreturn(), MSVC, C11

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org, Thomas Munro <thomas.munro@gmail.com>
Date: 2025-01-06T14:52:15Z
Lists: pgsql-hackers
On 03.01.25 21:51, Dagfinn Ilmari Mannsåker wrote:
> Peter Eisentraut <peter@eisentraut.org> writes:
> 
>> I suggest we define pg_noreturn as
>>
>> 1. If C11 is supported, then _Noreturn, else
>> 2. If GCC-compatible, then __attribute__((noreturn)), else
> 
> Would it be worth also checking __has_attribute(noreturn)?  Or do all
> compilers that have __attribute__((noreturn)) claim to be GCC?

I don't think that would expand the set of supported compilers in a 
significant way.  We can always add it if we find one, of course.

>> 3. If MSVC, then __declspec((noreturn))



Commits

  1. Use standard C23 and C++ attributes if available

  2. Swap order of extern/static and pg_nodiscard

  3. pg_noreturn to replace pg_attribute_noreturn()