pgsql: Fix for C++ compatibility

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix for C++ compatibility
Date: 2026-01-21 07:54:51
Message-ID: E1viT3C-001kPC-1Q@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix for C++ compatibility

After commit 476b35d4e31, some buildfarm members are complaining about
not recognizing _Noreturn when building the new C++ module
test_cplusplusext. This is not a C++ feature, but it was gated like

#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define pg_noreturn _Noreturn

But apparently that was not sufficient. Some platforms define
__STDC_VERSION__ even in C++ mode. (In this particular case, it was
g++ on Solaris, but apparently this is also done by some other
platforms, and it is allowed by the C++ standard.) To fix, add a

... && !defined(__cplusplus)

Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg(at)mail(dot)gmail(dot)com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b4555cb070f134c04328df54ce31d4ef1970f3bb

Modified Files
--------------
src/include/c.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2026-01-21 08:50:44 Re: pgsql: tests: Add a test C++ extension module
Previous Message John Naylor 2026-01-21 07:13:08 pgsql: Update some comments for fasthash