Re: Change copyObject() to use typeof_unqual
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jelte Fennema-Nio <postgres@jeltef.nl>,
Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-03-16T22:28:07Z
Lists: pgsql-hackers
Hi,
On Mon, Mar 16, 2026 at 8:32 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Jelte Fennema-Nio <postgres@jeltef.nl> writes:
> > On Mon, 16 Mar 2026 at 13:47, Peter Eisentraut <peter@eisentraut.org> wrote:
> >> I'm tempted to go with my proposed patch of a version-based override for
> >> the time being.
>
> > Sounds good to me.
>
> I confirmed that Peter's
> 0001-Hardcode-override-of-typeof_unqual-for-clang-for-bit.patch
> fixes the problem on my Fedora 40 system.
I'm still encountering the following error while building from source
at commit f4af7849b3d when using autoconf:
execParallel.c:154:9: error: call to undeclared function
'typeof_unqual'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
154 | plan = copyObject(plan);
| ^
../../../src/include/nodes/nodes.h:230:27: note: expanded from macro
'copyObject'
230 | #define copyObject(obj) ((typeof_unqual(*(obj)) *) copyObjectImpl(obj))
| ^
execParallel.c:154:9: error: expected expression
../../../src/include/nodes/nodes.h:230:50: note: expanded from macro
'copyObject'
230 | #define copyObject(obj) ((typeof_unqual(*(obj)) *) copyObjectImpl(obj))
| ^
analyze.c:3213:27: error: call to undeclared function 'typeof_unqual';
ISO C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
3213 | stmt->into->viewQuery = copyObject(query);
| ^
../../../src/include/nodes/nodes.h:230:27: note: expanded from macro
'copyObject'
230 | #define copyObject(obj) ((typeof_unqual(*(obj)) *) copyObjectImpl(obj))
| ^
analyze.c:3213:27: error: expected expression
../../../src/include/nodes/nodes.h:230:50: note: expanded from macro
'copyObject'
230 | #define copyObject(obj) ((typeof_unqual(*(obj)) *) copyObjectImpl(obj))
| ^
2 errors generated.
:
(many similar errors)
I'm using Fedora 43 and gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7).
The issue doesn't happen when using meson+ninja.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add some const qualifiers enabled by typeof_unqual change on copyObject
- 7724cb9935a9 19 (unreleased) landed
-
Hardcode typeof_unqual to __typeof_unqual__ for clang
- 2eb6cd327cae 19 (unreleased) landed
-
Clean up postgres_fdw/t/010_subscription.pl.
- f4af7849b3db 19 (unreleased) cited
-
Hardcode override of typeof_unqual for clang-for-bitcode
- 63275ce84d2f 19 (unreleased) landed
-
Make typeof and typeof_unqual fallback definitions work on C++11
- cd083b54bd67 19 (unreleased) landed
-
Change copyObject() to use typeof_unqual
- 59292f7aac72 19 (unreleased) landed
- 4cfce4e62c8f 19 (unreleased) landed
-
Fixes for C++ typeof implementation
- 9c05f152b5dd 19 (unreleased) landed
-
Support using copyObject in standard C++
- 1887d822f142 19 (unreleased) cited