Re: pg_attribute_noreturn(), MSVC, C11

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Andres Freund <andres(at)anarazel(dot)de>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: pg_attribute_noreturn(), MSVC, C11
Date: 2025-02-13 15:34:55
Message-ID: 2d1e6393-8231-4cb5-b94c-1019ef9fe83f@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 22.01.25 19:16, Peter Eisentraut wrote:
> On 06.01.25 15:52, Peter Eisentraut wrote:
>> On 03.01.25 21:51, Dagfinn Ilmari Mannsåker wrote:
>>> Peter Eisentraut <peter(at)eisentraut(dot)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.
>
> In fact, as another thought, we could even drop #2.  Among the GCC-
> compatible compilers, both GCC and Clang have supported #1 for ages, and
> the only other candidate I could find on the build farm is the Solaris
> compiler, which also supports C11 by default, per its documentation.
>
>>>> 3. If MSVC, then __declspec((noreturn))

Here is an updated patch set that contains the above small change and
fixes some conflicts that have arisen in the meantime.

Attachment Content-Type Size
v2-0001-pg_noreturn-to-replace-pg_attribute_noreturn.patch text/plain 45.0 KB
v2-0002-Add-another-pg_noreturn.patch text/plain 1.5 KB
v2-0003-Swap-order-of-extern-static-and-pg_nodiscard.patch text/plain 9.9 KB
v2-0004-Support-pg_nodiscard-on-non-GNU-compilers-that-su.patch text/plain 2.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-02-13 15:46:03 Re: BitmapHeapScan streaming read user and prelim refactoring
Previous Message Bertrand Drouvot 2025-02-13 15:28:47 Re: Draft for basic NUMA observability