]> granicus.if.org Git - icu/commitdiff
ICU-21513 check if TARGET_OS_SIMULATOR has been defined
authorMojca Miklavec <mojca.miklavec.lists@gmail.com>
Sun, 28 Feb 2021 08:34:30 +0000 (09:34 +0100)
committerShane F. Carr <shane@unicode.org>
Wed, 7 Apr 2021 18:47:42 +0000 (13:47 -0500)
clang 11 throws an error when using undefined variables starting with
TARGET_OS_, and TARGET_OS_SIMULATOR is missing in earlier versions
of macOS, so the code would not compile without an additional guard.

See also ICU-13440.

icu4c/source/common/putil.cpp

index 93866479ea5e1bcca892dfa91ffccc4445816529..ffcbbcce59b4018ca47192462eb405490c545f80 100644 (file)
@@ -1361,7 +1361,7 @@ uprv_pathIsAbsolute(const char *path)
 
 /* Backup setting of ICU_DATA_DIR_PREFIX_ENV_VAR
    (needed for some Darwin ICU build environments) */
-#if U_PLATFORM_IS_DARWIN_BASED && TARGET_OS_SIMULATOR
+#if U_PLATFORM_IS_DARWIN_BASED && defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
 # if !defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
 #  define ICU_DATA_DIR_PREFIX_ENV_VAR "IPHONE_SIMULATOR_ROOT"
 # endif