Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11
Date: 2026-03-15 18:05:06
Message-ID: 2055744.1773597906@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-03-15 19:24:10 pgsql: Fix small memory leak in get_dbname_oid_list_from_mfile().
Previous Message Tom Lane 2026-03-15 16:15:38 Re: pgsql: Make typeof and typeof_unqual fallback definitions work on C++11