public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Andres Freund <[email protected]>
Cc: Jelte Fennema-Nio <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Thomas Munro <[email protected]>
Subject: Re: Make copyObject work in C++
Date: Tue, 20 Jan 2026 20:07:15 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <ipdfcmip7oegnw5vhvf3swoqdzku3snuvskjycniync2a54yow@vpj6i5yg77ux>
References: <CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<ipdfcmip7oegnw5vhvf3swoqdzku3snuvskjycniync2a54yow@vpj6i5yg77ux>

On 20.01.26 17:38, Andres Freund wrote:
>> I have split your first patch further.  For a start, I left out the
>> PG_MODULE_MAGIC*-related changes and disabled the module under MSVC. This
>> has been committed.  I plan to let the buildfarm run with it for a day or
>> two and then add in the basic MSVC support.
> Seems like billbug doesn't like this:
> 
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl? 
> nm=billbug&dt=2026-01-20%2016%3A00%3A02
> 
> gmake[1]: Entering directory '/home/marcel/build-farm-20/buildroot/HEAD/pgsql.build/src/test/modules/test_cplusplusext'
> g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -I. -I. -I../../../../src/include -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS  -I/usr/openssl/3/include -I/usr/include/libxml2     -c -o test_cplusplusext.o test_cplusplusext.cpp
> In file included from ../../../../src/include/postgres.h:48,
>                   from test_cplusplusext.cpp:18:
> ../../../../src/include/c.h:158:21: error: '_Noreturn' does not name a type; did you mean 'pg_noreturn'?
>    158 | #define pg_noreturn _Noreturn
>        |                     ^~~~~~~~~
> ../../../../src/include/c.h:918:1: note: in expansion of macro 'pg_noreturn'
>    918 | pg_noreturn extern void ExceptionalCondition(const char *conditionName,
>        | ^~~~~~~~~~~

It's getting confused by _Noreturn, which is defined thus:

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

But apparently on these Solaris-related platforms, g++ defines 
__STDC_VERSION__ even in C++ mode.  (Confirmed in local testing.) 
Apparently, this is even allowed by the C++ standard.

So the smallest fix is probably to gate this more like this:

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

(Eventually, we could add support for C++ attributes, but one step at a 
time.)







view thread (7+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Make copyObject work in C++
  In-Reply-To: <[email protected]>

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

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