Re: cpluspluscheck vs ICU
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Andres Freund <andres@anarazel.de>, Andrew Dunstan <andrew@dunslane.net>,
Jeff Davis <pgsql@j-davis.com>
Cc: pgsql-hackers@postgresql.org
Date: 2023-08-08T07:20:03Z
Lists: pgsql-hackers
On 08.08.23 01:35, Andres Freund wrote: > Hi, > > On 2023-03-10 20:10:30 -0800, Andres Freund wrote: >> On 2023-03-10 19:37:27 -0800, Andres Freund wrote: >>> I just hit this once more - and I figured out a fairly easy fix: >>> >>> We just need a >>> #ifndef U_DEFAULT_SHOW_DRAFT >>> #define U_DEFAULT_SHOW_DRAFT 0 >>> #endif >>> before including unicode/ucol.h. >>> >>> At first I was looking at >>> #define U_SHOW_CPLUSPLUS_API 0 >>> and >>> #define U_HIDE_INTERNAL_API 1 >>> which both work, but they are documented to be internal. >> >> Err. Unfortunately only the U_SHOW_CPLUSPLUS_API approach actually works. The >> others don't, not quite sure what I was doing earlier. >> >> So it's either relying on a define marked as internal, or the below: >> >>> Alternatively we could emit U_DEFAULT_SHOW_DRAFT 0 into pg_config.h to avoid >>> that issue. >>> >>> >>> The only other thing I see is to do something like: >>> [ugly] >>> which seems mighty ugly. > > The ICU docs talk about it like it's not really internal: > https://github.com/unicode-org/icu/blob/720e5741ccaa112c4faafffdedeb7459b66c5673/docs/processes/release/tasks/healthy-code.md#test-icu4c-headers > > So I'm inclined to go with that solution. This looks sensible to me. Perhaps undef U_SHOW_CPLUSPLUS_API after including the headers, so that if extensions want to use the ICU C++ APIs, they are not tripped up by this?
Commits
-
Hide ICU C++ APIs from pg_locale.h
- ed26c4e25a44 19 (unreleased) landed
-
ci: test headerscheck, cpluspluscheck as part of CompilerWarnings task.
- 81b9f23c9c83 15.0 landed