Re: Make copyObject work in C++

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Make copyObject work in C++
Date: 2026-01-20 16:38:29
Message-ID: ipdfcmip7oegnw5vhvf3swoqdzku3snuvskjycniync2a54yow@vpj6i5yg77ux
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-01-20 17:28:00 +0100, Peter Eisentraut wrote:
> On 17.01.26 16:25, Jelte Fennema-Nio wrote:
> > > AFAICT, the minimum changes to get a minimum test module to work are
> > >
> > > - fix for "restrict", recently committed
> > > - disable warning about zero-length arrays, seems trivial
> > > - named designated initializers
> >
> > Correct, I've now restructured the commits to have the module
> > introduction as the first one. Then all the other commits, both fix a
> > macro to work in C++ and add some usage of those macros as coverage to
> > the previously added module.
>
> 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,
| ^~~~~~~~~~~
../../../../src/include/lib/stringinfo.h: In function 'void initStringInfoFromString(StringInfo, char*, int)':
../../../../src/include/c.h:890:25: error: 'ExceptionalCondition' was not declared in this scope
890 | ExceptionalCondition(#condition, __FILE__, __LINE__); \\
| ^~~~~~~~~~~~~~~~~~~~
../../../../src/include/lib/stringinfo.h:177:9: note: in expansion of macro 'Assert'
177 | Assert(data[len] == '\\0');
| ^~~~~~
../../../../src/include/utils/elog.h: At global scope:
../../../../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/utils/elog.h:471:1: note: in expansion of macro 'pg_noreturn'
471 | pg_noreturn extern void ReThrowError(ErrorData *edata);
| ^~~~~~~~~~~
../../../../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/utils/elog.h:473:1: note: in expansion of macro 'pg_noreturn'
473 | pg_noreturn extern void pg_re_throw(void);
| ^~~~~~~~~~~

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-01-20 17:03:30 Re: meson: Allow disabling static libraries
Previous Message Peter Eisentraut 2026-01-20 16:28:00 Re: Make copyObject work in C++