From 48124d170635f4abcd7440c5beeb6ea9878de32b Mon Sep 17 00:00:00 2001 From: Cyndy Ishida Date: Thu, 23 Jun 2022 06:50:39 -0700 Subject: [PATCH] ICU-22072 Update Darwin Specific Macros * Update `U_PF_IPHONE` to be 0 when building for macOS/macCatalyst. * add macro definition for `attribute((visibility("hidden")))` for cases where internal structs exist within exposed classes. --- icu4c/source/common/unicode/platform.h | 10 +++++++++- icu4c/source/i18n/unicode/dtitvinf.h | 2 +- icu4c/source/i18n/unicode/dtptngen.h | 6 +++--- icu4c/source/i18n/unicode/listformatter.h | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/icu4c/source/common/unicode/platform.h b/icu4c/source/common/unicode/platform.h index b7e514442ce..6d370efc31f 100644 --- a/icu4c/source/common/unicode/platform.h +++ b/icu4c/source/common/unicode/platform.h @@ -168,7 +168,7 @@ # define U_PLATFORM U_PF_LINUX #elif defined(__APPLE__) && defined(__MACH__) # include -# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */ +# if (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && (defined(TARGET_OS_MACCATALYST) && !TARGET_OS_MACCATALYST) /* variant of TARGET_OS_MAC */ # define U_PLATFORM U_PF_IPHONE # else # define U_PLATFORM U_PF_DARWIN @@ -847,6 +847,14 @@ namespace std { # define U_IMPORT #endif +#ifdef U_HIDDEN + /* Use the predefined value. */ +#elif defined(__GNUC__) +# define U_HIDDEN __attribute__((visibility("hidden"))) +#else +# define U_HIDDEN +#endif + /** * \def U_CALLCONV * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary diff --git a/icu4c/source/i18n/unicode/dtitvinf.h b/icu4c/source/i18n/unicode/dtitvinf.h index b5afc064678..a1f4f426a1c 100644 --- a/icu4c/source/i18n/unicode/dtitvinf.h +++ b/icu4c/source/i18n/unicode/dtitvinf.h @@ -343,7 +343,7 @@ private: /** * Internal struct used to load resource bundle data. */ - struct DateIntervalSink; + struct U_HIDDEN DateIntervalSink; /** * Following is for saving the interval patterns. diff --git a/icu4c/source/i18n/unicode/dtptngen.h b/icu4c/source/i18n/unicode/dtptngen.h index e70d1923c98..6d2351ffca8 100644 --- a/icu4c/source/i18n/unicode/dtptngen.h +++ b/icu4c/source/i18n/unicode/dtptngen.h @@ -658,9 +658,9 @@ private: static void U_CALLCONV loadAllowedHourFormatsData(UErrorCode &status); void getAllowedHourFormats(const Locale &locale, UErrorCode &status); - struct AppendItemFormatsSink; - struct AppendItemNamesSink; - struct AvailableFormatsSink; + struct U_HIDDEN AppendItemFormatsSink; + struct U_HIDDEN AppendItemNamesSink; + struct U_HIDDEN AvailableFormatsSink; } ;// end class DateTimePatternGenerator U_NAMESPACE_END diff --git a/icu4c/source/i18n/unicode/listformatter.h b/icu4c/source/i18n/unicode/listformatter.h index af94a9f2319..0277afd1671 100644 --- a/icu4c/source/i18n/unicode/listformatter.h +++ b/icu4c/source/i18n/unicode/listformatter.h @@ -268,7 +268,7 @@ class U_I18N_API ListFormatter : public UObject{ static void initializeHash(UErrorCode& errorCode); static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode); - struct ListPatternsSink; + struct U_HIDDEN ListPatternsSink; static ListFormatInternal* loadListFormatInternal(const Locale& locale, const char* style, UErrorCode& errorCode); ListFormatter() = delete;