Re: cpluspluscheck vs ICU again

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: John Naylor <johncnaylorls(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: cpluspluscheck vs ICU again
Date: 2025-07-04 15:11:49
Message-ID: 247061.1751641909@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2025-07-04 15:22:39 Re: Suggestion to add --continue-client-on-abort option to pgbench
Previous Message Yugo Nagata 2025-07-04 15:03:56 Re: Suggestion to add --continue-client-on-abort option to pgbench