Re: cpluspluscheck vs ICU again

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: John Naylor <johncnaylorls@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-07-04T15:11:49Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2025-07-02 14:01:13 +0700, John Naylor wrote:
>> I came up with the attached -- Andres, Peter, does this match your recollection?

> I think the proper fix here would be to not expose ucol.h to the world,
> i.e. not include it from something like pg_locale.h.

The stumbling block to that is that pg_locale_struct has a field of
type UCollator.  Of course there are workarounds, but I think all of
them are strictly worse than including <ucol.h> here.

>> +/* restore so that extensions can include the C++ APIs */
>> +#undef U_SHOW_CPLUSPLUS_API

> Does the #undef U_SHOW_CPLUSPLUS_API thing actually work, given that ucol.h
> presumably won't be included again due to #ifdef protection?

Good point.  If a .cpp file wants access to the C++ APIs, it'd have
to include <unicode/ucol.h> before not after including pg_locale.h.
That should work AFAICS, but this #undef doesn't help.

			regards, tom lane



Commits

  1. Update ICU C++ API symbols

  2. Hide ICU C++ APIs from pg_locale.h

  3. Remove implicit cast from 'void *'

  4. Inline CRC computation for small fixed-length input on x86