pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Make typeof and typeof_unqual fallback definitions work on C++11
5+ messages / 3 participants
[nested] [flat]

* pgsql: Make typeof and typeof_unqual fallback definitions work on C++11
@ 2026-03-15 06:48  Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2026-03-15 06:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Make typeof and typeof_unqual fallback definitions work on C++11

These macros were unintentionally using C++14 features. This replaces
them with valid C++11 code.

Tested locally by compiling with -std=c++11 (which reproduced the
original issue).

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org

Branch
------
master

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

Modified Files
--------------
src/include/c.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11
@ 2026-03-15 15:28  Melanie Plageman <melanieplageman@gmail.com>
  parent: Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 2 replies; 5+ messages in thread

From: Melanie Plageman @ 2026-03-15 15:28 UTC (permalink / raw)
  To: Peter Eisentraut <peter@eisentraut.org>; +Cc: pgsql-committers@lists.postgresql.org

On Sun, Mar 15, 2026 at 2:48 AM Peter Eisentraut <peter@eisentraut.org> wrote:
>
> Make typeof and typeof_unqual fallback definitions work on C++11
>
> These macros were unintentionally using C++14 features. This replaces
> them with valid C++11 code.

Seems like this broke at least canebrake [1]

/home/bf/bf-build/canebrake/HEAD/pgsql.build/../pgsql/src/backend/bootstrap/bootstrap.c:1150:3:
error: call to undeclared function '__typeof_unqual__'; ISO C99 and
later do not support implicit function declarations
[-Wimplicit-function-declaration]
/home/bf/bf-build/canebrake/HEAD/pgsql.build/../pgsql/src/backend/bootstrap/bootstrap.c:1150:3:
error: expected expression

- Melanie

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?dt=2026-03-13+20%3A54%3A31&nm=canebrake





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11
@ 2026-03-15 16:15  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Melanie Plageman <melanieplageman@gmail.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Tom Lane @ 2026-03-15 16:15 UTC (permalink / raw)
  To: Melanie Plageman <melanieplageman@gmail.com>; +Cc: Peter Eisentraut <peter@eisentraut.org>; pgsql-committers@lists.postgresql.org

Melanie Plageman <melanieplageman@gmail.com> writes:
> On Sun, Mar 15, 2026 at 2:48 AM Peter Eisentraut <peter@eisentraut.org> wrote:
>> Make typeof and typeof_unqual fallback definitions work on C++11

> Seems like this broke at least canebrake [1]

Doesn't appear to have satisfied any of the previously-broken animals
either.  It looks like the C compiler is okay but building bitcode
with clang is not okay.  We're really going to need separate
definitions for the two cases.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11
@ 2026-03-15 18:05  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2026-03-15 18:05 UTC (permalink / raw)
  To: Peter Eisentraut <peter@eisentraut.org>; +Cc: Melanie Plageman <melanieplageman@gmail.com>; pgsql-committers@lists.postgresql.org

I wrote:
> Doesn't appear to have satisfied any of the previously-broken animals
> either.  It looks like the C compiler is okay but building bitcode
> with clang is not okay.  We're really going to need separate
> definitions for the two cases.

After noting that ladybug is one of the failing animals, I was
able to reproduce the failure locally on a Fedora 40 installation.
This system has

$ gcc --version
gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)
$ g++ --version
g++ (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)
$ clang --version
clang version 18.1.8 (Fedora 18.1.8-2.fc40)

So far as I can tell, this version of clang does not recognize
__typeof_unqual__ at all.  It will take typeof_unqual, but only
with -std=c23 which we are not passing it.  So the short answer
is that this is not good enough:

    We test the underscore variant first so that there is a higher chance
    that clang used for bitcode also supports it, since we don't test that
    separately.

We could get away with not checking clang separately as long as
we weren't using any bleeding-edge C features, but this patch
is trying to do exactly that.  I think we are going to have to
explicitly check all three of CC, CXX, CLANG and cope with the
case that they're all different on this point.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11
@ 2026-03-15 20:52  Peter Eisentraut <peter@eisentraut.org>
  parent: Melanie Plageman <melanieplageman@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2026-03-15 20:52 UTC (permalink / raw)
  To: Melanie Plageman <melanieplageman@gmail.com>; +Cc: pgsql-committers@lists.postgresql.org

On 15.03.26 16:28, Melanie Plageman wrote:
> On Sun, Mar 15, 2026 at 2:48 AM Peter Eisentraut <peter@eisentraut.org> wrote:
>>
>> Make typeof and typeof_unqual fallback definitions work on C++11
>>
>> These macros were unintentionally using C++14 features. This replaces
>> them with valid C++11 code.
> 
> Seems like this broke at least canebrake [1]
> 
> /home/bf/bf-build/canebrake/HEAD/pgsql.build/../pgsql/src/backend/bootstrap/bootstrap.c:1150:3:
> error: call to undeclared function '__typeof_unqual__'; ISO C99 and
> later do not support implicit function declarations
> [-Wimplicit-function-declaration]
> /home/bf/bf-build/canebrake/HEAD/pgsql.build/../pgsql/src/backend/bootstrap/bootstrap.c:1150:3:
> error: expected expression

Please see discussion here: 
https://www.postgresql.org/message-id/ff129805-1516-478a-a438-145880165c58%40eisentraut.org






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2026-03-15 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-15 06:48 pgsql: Make typeof and typeof_unqual fallback definitions work on C++11 Peter Eisentraut <peter@eisentraut.org>
2026-03-15 15:28 ` Melanie Plageman <melanieplageman@gmail.com>
2026-03-15 16:15   ` Tom Lane <tgl@sss.pgh.pa.us>
2026-03-15 18:05     ` Tom Lane <tgl@sss.pgh.pa.us>
2026-03-15 20:52   ` Peter Eisentraut <peter@eisentraut.org>

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