diff --git a/CMakeLists.txt b/CMakeLists.txt index aad9e525e5892..5ed53d82786c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1018,37 +1018,6 @@ endif() # Find required dependencies. # -function(swift_icu_variables_set sdk arch result) - string(TOUPPER "${sdk}" sdk) - - set(icu_var_ICU_UC_INCLUDE ${SWIFT_${sdk}_${arch}_ICU_UC_INCLUDE}) - set(icu_var_ICU_UC ${SWIFT_${sdk}_${arch}_ICU_UC}) - set(icu_var_ICU_I18N_INCLUDE ${SWIFT_${sdk}_${arch}_ICU_I18N_INCLUDE}) - set(icu_var_ICU_I18N ${SWIFT_${sdk}_${arch}_ICU_I18N}) - - if(icu_var_ICU_UC_INCLUDE AND icu_var_ICU_UC AND - icu_var_ICU_I18N_INCLUDE AND icu_var_ICU_I18N) - set(${result} TRUE PARENT_SCOPE) - else() - set(${result} FALSE PARENT_SCOPE) - endif() -endfunction() - -# ICU is provided through CoreFoundation on Darwin. On other hosts, if the ICU -# unicode and i18n include and library paths are not defined, perform a standard -# package lookup. Otherwise, rely on the paths specified by the user. These -# need to be defined when cross-compiling. -if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY) - swift_icu_variables_set("${SWIFT_PRIMARY_VARIANT_SDK}" - "${SWIFT_PRIMARY_VARIANT_ARCH}" - ICU_CONFIGURED) - if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "" AND NOT ${ICU_CONFIGURED}) - find_package(ICU REQUIRED COMPONENTS uc i18n) - endif() - endif() -endif() - find_package(Python3 COMPONENTS Interpreter REQUIRED) # diff --git a/cmake/modules/FindICU.cmake b/cmake/modules/FindICU.cmake deleted file mode 100644 index 611773c4a2d05..0000000000000 --- a/cmake/modules/FindICU.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# Find libicu's libraries - -include(FindPackageHandleStandardArgs) - -find_package(PkgConfig) - -set(ICU_REQUIRED) -foreach(MODULE ${ICU_FIND_COMPONENTS}) - string(TOUPPER "${MODULE}" MODULE) - string(TOLOWER "${MODULE}" module) - list(APPEND ICU_REQUIRED - ICU_${MODULE}_INCLUDE_DIRS ICU_${MODULE}_LIBRARIES) - - pkg_check_modules(PC_ICU_${MODULE} QUIET icu-${module}) - if(NOT PKG_CONFIG_FOUND) - # PkgConfig doesn't exist on this system, so we manually provide hints via CMake. - set(PC_ICU_${MODULE}_INCLUDE_DIRS "${ICU_${MODULE}_INCLUDE_DIRS}") - set(PC_ICU_${MODULE}_LIBRARY_DIRS "${ICU_${MODULE}_LIBRARY_DIRS}") - endif() - - find_path(ICU_${MODULE}_INCLUDE_DIRS unicode - HINTS ${PC_ICU_${MODULE}_INCLUDE_DIRS}) - find_library(ICU_${MODULE}_LIBRARIES NAMES icu${module} ${ICU_${MODULE}_LIB_NAME} - HINTS ${PC_ICU_${MODULE}_LIBRARY_DIRS}) -endforeach() - -foreach(sdk ANDROID;FREEBSD;OPENBSD;LINUX;WINDOWS;HAIKU) - foreach(MODULE ${ICU_FIND_COMPONENTS}) - string(TOUPPER "${MODULE}" MODULE) - if("${SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE}_INCLUDE}" STREQUAL "") - set(SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE}_INCLUDE ${ICU_${MODULE}_INCLUDE_DIRS} CACHE STRING "" FORCE) - endif() - if("${SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE}}" STREQUAL "") - set(SWIFT_${sdk}_${SWIFT_HOST_VARIANT_ARCH}_ICU_${MODULE} ${ICU_${MODULE}_LIBRARIES} CACHE STRING "" FORCE) - endif() - endforeach() -endforeach() - -find_package_handle_standard_args(ICU DEFAULT_MSG ${ICU_REQUIRED}) -mark_as_advanced(${ICU_REQUIRED}) diff --git a/cmake/modules/SwiftConfigureSDK.cmake b/cmake/modules/SwiftConfigureSDK.cmake index 1a21ad74c68df..115b2769c53e1 100644 --- a/cmake/modules/SwiftConfigureSDK.cmake +++ b/cmake/modules/SwiftConfigureSDK.cmake @@ -65,14 +65,6 @@ function(_report_sdk prefix) message(STATUS " ${arch} libc header path: ${SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY}") message(STATUS " ${arch} libc architecture specific header path: ${SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY}") endforeach() - if(SWIFT_BUILD_STDLIB) - foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES}) - message(STATUS " ${arch} ICU i18n INCLUDE: ${SWIFT_${prefix}_${arch}_ICU_I18N_INCLUDE}") - message(STATUS " ${arch} ICU i18n LIB: ${SWIFT_${prefix}_${arch}_ICU_I18N}") - message(STATUS " ${arch} ICU unicode INCLUDE: ${SWIFT_${prefix}_${arch}_ICU_UC_INCLUDE}") - message(STATUS " ${arch} ICU unicode LIB: ${SWIFT_${prefix}_${arch}_ICU_UC}") - endforeach() - endif() endif() message(STATUS "") diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake index 4f452e5c03825..0c6d35594c252 100644 --- a/stdlib/cmake/modules/AddSwiftStdlib.cmake +++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake @@ -441,11 +441,6 @@ function(_add_target_variant_link_flags) # link against the custom C++ library swift_android_cxx_libraries_for_arch(${LFLAGS_ARCH} cxx_link_libraries) list(APPEND link_libraries ${cxx_link_libraries}) - - # link against the ICU libraries - list(APPEND link_libraries - ${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N} - ${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC}) else() # If lto is enabled, we need to add the object path flag so that the LTO code # generator leaves the intermediate object file in a place where it will not @@ -461,17 +456,6 @@ function(_add_target_variant_link_flags) endif() endif() - if(NOT "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC}" STREQUAL "") - get_filename_component(SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC_LIBDIR - "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC}" DIRECTORY) - list(APPEND library_search_directories "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_UC_LIBDIR}") - endif() - if(NOT "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_I18N}" STREQUAL "") - get_filename_component(SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_I18N_LIBDIR - "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_I18N}" DIRECTORY) - list(APPEND library_search_directories "${SWIFT_${LFLAGS_SDK}_${LFLAGS_ARCH}_ICU_I18N_LIBDIR}") - endif() - if(SWIFT_USE_LINKER AND NOT SWIFT_COMPILER_IS_MSVC_LIKE) # The linker is normally chosen based on the host, but the Android NDK only # uses lld now. @@ -1313,9 +1297,6 @@ function(add_swift_target_library_single target name) "SHELL:-Xclang --dependent-lib=msvcrt$<$:d>") endif() endif() - target_include_directories(${target} SYSTEM PRIVATE - ${SWIFT_${SWIFTLIB_SINGLE_SDK}_${SWIFTLIB_SINGLE_ARCHITECTURE}_ICU_UC_INCLUDE} - ${SWIFT_${SWIFTLIB_SINGLE_SDK}_${SWIFTLIB_SINGLE_ARCHITECTURE}_ICU_I18N_INCLUDE}) target_compile_options(${target} PRIVATE ${c_compile_flags}) target_link_options(${target} PRIVATE diff --git a/stdlib/public/SwiftShims/CMakeLists.txt b/stdlib/public/SwiftShims/CMakeLists.txt index 9b7dcd50460d7..fa1296fb9ef17 100644 --- a/stdlib/public/SwiftShims/CMakeLists.txt +++ b/stdlib/public/SwiftShims/CMakeLists.txt @@ -20,7 +20,6 @@ set(sources Target.h ThreadLocalStorage.h UnicodeData.h - UnicodeShims.h Visibility.h _SwiftConcurrency.h _SwiftDistributed.h diff --git a/stdlib/public/SwiftShims/UnicodeShims.h b/stdlib/public/SwiftShims/UnicodeShims.h deleted file mode 100644 index c97b4c3541d8f..0000000000000 --- a/stdlib/public/SwiftShims/UnicodeShims.h +++ /dev/null @@ -1,282 +0,0 @@ -//===--- UnicodeShims.h - Access to Unicode data for the core stdlib ------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// -// -// Data structures required for Unicode support in Swift that are -// statically initialized in its runtime's C++ source. -// -//===----------------------------------------------------------------------===// -#ifndef SWIFT_STDLIB_SHIMS_UNICODESHIMS_H_ -#define SWIFT_STDLIB_SHIMS_UNICODESHIMS_H_ - -#include "SwiftStdint.h" -#include "SwiftStdbool.h" -#include "Visibility.h" - -#if __has_feature(nullability) -#pragma clang assume_nonnull begin -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum __swift_stdlib_UProperty { - __swift_stdlib_UCHAR_GENERAL_CATEGORY = 0x1005, - __swift_stdlib_UCHAR_NUMERIC_TYPE = 0x1009, -} __swift_stdlib_UProperty; - -typedef enum __swift_stdlib_UErrorCode { - __swift_stdlib_U_USING_FALLBACK_WARNING = -128, - __swift_stdlib_U_ERROR_WARNING_START = -128, - __swift_stdlib_U_USING_DEFAULT_WARNING = -127, - __swift_stdlib_U_SAFECLONE_ALLOCATED_WARNING = -126, - __swift_stdlib_U_STATE_OLD_WARNING = -125, - __swift_stdlib_U_STRING_NOT_TERMINATED_WARNING = -124, - __swift_stdlib_U_SORT_KEY_TOO_SHORT_WARNING = -123, - __swift_stdlib_U_AMBIGUOUS_ALIAS_WARNING = -122, - __swift_stdlib_U_DIFFERENT_UCA_VERSION = -121, - __swift_stdlib_U_PLUGIN_CHANGED_LEVEL_WARNING = -120, - __swift_stdlib_U_ERROR_WARNING_LIMIT, - __swift_stdlib_U_ZERO_ERROR = 0, - __swift_stdlib_U_ILLEGAL_ARGUMENT_ERROR = 1, - __swift_stdlib_U_MISSING_RESOURCE_ERROR = 2, - __swift_stdlib_U_INVALID_FORMAT_ERROR = 3, - __swift_stdlib_U_FILE_ACCESS_ERROR = 4, - __swift_stdlib_U_INTERNAL_PROGRAM_ERROR = 5, - __swift_stdlib_U_MESSAGE_PARSE_ERROR = 6, - __swift_stdlib_U_MEMORY_ALLOCATION_ERROR = 7, - __swift_stdlib_U_INDEX_OUTOFBOUNDS_ERROR = 8, - __swift_stdlib_U_PARSE_ERROR = 9, - __swift_stdlib_U_INVALID_CHAR_FOUND = 10, - __swift_stdlib_U_TRUNCATED_CHAR_FOUND = 11, - __swift_stdlib_U_ILLEGAL_CHAR_FOUND = 12, - __swift_stdlib_U_INVALID_TABLE_FORMAT = 13, - __swift_stdlib_U_INVALID_TABLE_FILE = 14, - __swift_stdlib_U_BUFFER_OVERFLOW_ERROR = 15, - __swift_stdlib_U_UNSUPPORTED_ERROR = 16, - __swift_stdlib_U_RESOURCE_TYPE_MISMATCH = 17, - __swift_stdlib_U_ILLEGAL_ESCAPE_SEQUENCE = 18, - __swift_stdlib_U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, - __swift_stdlib_U_NO_SPACE_AVAILABLE = 20, - __swift_stdlib_U_CE_NOT_FOUND_ERROR = 21, - __swift_stdlib_U_PRIMARY_TOO_LONG_ERROR = 22, - __swift_stdlib_U_STATE_TOO_OLD_ERROR = 23, - __swift_stdlib_U_TOO_MANY_ALIASES_ERROR = 24, - __swift_stdlib_U_ENUM_OUT_OF_SYNC_ERROR = 25, - __swift_stdlib_U_INVARIANT_CONVERSION_ERROR = 26, - __swift_stdlib_U_INVALID_STATE_ERROR = 27, - __swift_stdlib_U_COLLATOR_VERSION_MISMATCH = 28, - __swift_stdlib_U_USELESS_COLLATOR_ERROR = 29, - __swift_stdlib_U_NO_WRITE_PERMISSION = 30, - __swift_stdlib_U_STANDARD_ERROR_LIMIT, - __swift_stdlib_U_BAD_VARIABLE_DEFINITION = 0x10000, - __swift_stdlib_U_PARSE_ERROR_START = 0x10000, - __swift_stdlib_U_MALFORMED_RULE, - __swift_stdlib_U_MALFORMED_SET, - __swift_stdlib_U_MALFORMED_SYMBOL_REFERENCE, - __swift_stdlib_U_MALFORMED_UNICODE_ESCAPE, - __swift_stdlib_U_MALFORMED_VARIABLE_DEFINITION, - __swift_stdlib_U_MALFORMED_VARIABLE_REFERENCE, - __swift_stdlib_U_MISMATCHED_SEGMENT_DELIMITERS, - __swift_stdlib_U_MISPLACED_ANCHOR_START, - __swift_stdlib_U_MISPLACED_CURSOR_OFFSET, - __swift_stdlib_U_MISPLACED_QUANTIFIER, - __swift_stdlib_U_MISSING_OPERATOR, - __swift_stdlib_U_MISSING_SEGMENT_CLOSE, - __swift_stdlib_U_MULTIPLE_ANTE_CONTEXTS, - __swift_stdlib_U_MULTIPLE_CURSORS, - __swift_stdlib_U_MULTIPLE_POST_CONTEXTS, - __swift_stdlib_U_TRAILING_BACKSLASH, - __swift_stdlib_U_UNDEFINED_SEGMENT_REFERENCE, - __swift_stdlib_U_UNDEFINED_VARIABLE, - __swift_stdlib_U_UNQUOTED_SPECIAL, - __swift_stdlib_U_UNTERMINATED_QUOTE, - __swift_stdlib_U_RULE_MASK_ERROR, - __swift_stdlib_U_MISPLACED_COMPOUND_FILTER, - __swift_stdlib_U_MULTIPLE_COMPOUND_FILTERS, - __swift_stdlib_U_INVALID_RBT_SYNTAX, - __swift_stdlib_U_INVALID_PROPERTY_PATTERN, - __swift_stdlib_U_MALFORMED_PRAGMA, - __swift_stdlib_U_UNCLOSED_SEGMENT, - __swift_stdlib_U_ILLEGAL_CHAR_IN_SEGMENT, - __swift_stdlib_U_VARIABLE_RANGE_EXHAUSTED, - __swift_stdlib_U_VARIABLE_RANGE_OVERLAP, - __swift_stdlib_U_ILLEGAL_CHARACTER, - __swift_stdlib_U_INTERNAL_TRANSLITERATOR_ERROR, - __swift_stdlib_U_INVALID_ID, - __swift_stdlib_U_INVALID_FUNCTION, - __swift_stdlib_U_PARSE_ERROR_LIMIT, - __swift_stdlib_U_UNEXPECTED_TOKEN = 0x10100, - __swift_stdlib_U_FMT_PARSE_ERROR_START = 0x10100, - __swift_stdlib_U_MULTIPLE_DECIMAL_SEPARATORS, - __swift_stdlib_U_MULTIPLE_DECIMAL_SEPERATORS = - __swift_stdlib_U_MULTIPLE_DECIMAL_SEPARATORS, - __swift_stdlib_U_MULTIPLE_EXPONENTIAL_SYMBOLS, - __swift_stdlib_U_MALFORMED_EXPONENTIAL_PATTERN, - __swift_stdlib_U_MULTIPLE_PERCENT_SYMBOLS, - __swift_stdlib_U_MULTIPLE_PERMILL_SYMBOLS, - __swift_stdlib_U_MULTIPLE_PAD_SPECIFIERS, - __swift_stdlib_U_PATTERN_SYNTAX_ERROR, - __swift_stdlib_U_ILLEGAL_PAD_POSITION, - __swift_stdlib_U_UNMATCHED_BRACES, - __swift_stdlib_U_UNSUPPORTED_PROPERTY, - __swift_stdlib_U_UNSUPPORTED_ATTRIBUTE, - __swift_stdlib_U_ARGUMENT_TYPE_MISMATCH, - __swift_stdlib_U_DUPLICATE_KEYWORD, - __swift_stdlib_U_UNDEFINED_KEYWORD, - __swift_stdlib_U_DEFAULT_KEYWORD_MISSING, - __swift_stdlib_U_DECIMAL_NUMBER_SYNTAX_ERROR, - __swift_stdlib_U_FORMAT_INEXACT_ERROR, - __swift_stdlib_U_FMT_PARSE_ERROR_LIMIT, - __swift_stdlib_U_BRK_INTERNAL_ERROR = 0x10200, - __swift_stdlib_U_BRK_ERROR_START = 0x10200, - __swift_stdlib_U_BRK_HEX_DIGITS_EXPECTED, - __swift_stdlib_U_BRK_SEMICOLON_EXPECTED, - __swift_stdlib_U_BRK_RULE_SYNTAX, - __swift_stdlib_U_BRK_UNCLOSED_SET, - __swift_stdlib_U_BRK_ASSIGN_ERROR, - __swift_stdlib_U_BRK_VARIABLE_REDFINITION, - __swift_stdlib_U_BRK_MISMATCHED_PAREN, - __swift_stdlib_U_BRK_NEW_LINE_IN_QUOTED_STRING, - __swift_stdlib_U_BRK_UNDEFINED_VARIABLE, - __swift_stdlib_U_BRK_INIT_ERROR, - __swift_stdlib_U_BRK_RULE_EMPTY_SET, - __swift_stdlib_U_BRK_UNRECOGNIZED_OPTION, - __swift_stdlib_U_BRK_MALFORMED_RULE_TAG, - __swift_stdlib_U_BRK_ERROR_LIMIT, - __swift_stdlib_U_REGEX_INTERNAL_ERROR = 0x10300, - __swift_stdlib_U_REGEX_ERROR_START = 0x10300, - __swift_stdlib_U_REGEX_RULE_SYNTAX, - __swift_stdlib_U_REGEX_INVALID_STATE, - __swift_stdlib_U_REGEX_BAD_ESCAPE_SEQUENCE, - __swift_stdlib_U_REGEX_PROPERTY_SYNTAX, - __swift_stdlib_U_REGEX_UNIMPLEMENTED, - __swift_stdlib_U_REGEX_MISMATCHED_PAREN, - __swift_stdlib_U_REGEX_NUMBER_TOO_BIG, - __swift_stdlib_U_REGEX_BAD_INTERVAL, - __swift_stdlib_U_REGEX_MAX_LT_MIN, - __swift_stdlib_U_REGEX_INVALID_BACK_REF, - __swift_stdlib_U_REGEX_INVALID_FLAG, - __swift_stdlib_U_REGEX_LOOK_BEHIND_LIMIT, - __swift_stdlib_U_REGEX_SET_CONTAINS_STRING, -#ifndef __swift_stdlib_U_HIDE_DEPRECATED_API - __swift_stdlib_U_REGEX_OCTAL_TOO_BIG, -#endif - __swift_stdlib_U_REGEX_MISSING_CLOSE_BRACKET = - __swift_stdlib_U_REGEX_SET_CONTAINS_STRING + 2, - __swift_stdlib_U_REGEX_INVALID_RANGE, - __swift_stdlib_U_REGEX_STACK_OVERFLOW, - __swift_stdlib_U_REGEX_TIME_OUT, - __swift_stdlib_U_REGEX_STOPPED_BY_CALLER, -#ifndef __swift_stdlib_U_HIDE_DRAFT_API - __swift_stdlib_U_REGEX_PATTERN_TOO_BIG, - __swift_stdlib_U_REGEX_INVALID_CAPTURE_GROUP_NAME, -#endif - __swift_stdlib_U_REGEX_ERROR_LIMIT = - __swift_stdlib_U_REGEX_STOPPED_BY_CALLER + 3, - __swift_stdlib_U_IDNA_PROHIBITED_ERROR = 0x10400, - __swift_stdlib_U_IDNA_ERROR_START = 0x10400, - __swift_stdlib_U_IDNA_UNASSIGNED_ERROR, - __swift_stdlib_U_IDNA_CHECK_BIDI_ERROR, - __swift_stdlib_U_IDNA_STD3_ASCII_RULES_ERROR, - __swift_stdlib_U_IDNA_ACE_PREFIX_ERROR, - __swift_stdlib_U_IDNA_VERIFICATION_ERROR, - __swift_stdlib_U_IDNA_LABEL_TOO_LONG_ERROR, - __swift_stdlib_U_IDNA_ZERO_LENGTH_LABEL_ERROR, - __swift_stdlib_U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, - __swift_stdlib_U_IDNA_ERROR_LIMIT, - __swift_stdlib_U_STRINGPREP_PROHIBITED_ERROR = - __swift_stdlib_U_IDNA_PROHIBITED_ERROR, - __swift_stdlib_U_STRINGPREP_UNASSIGNED_ERROR = - __swift_stdlib_U_IDNA_UNASSIGNED_ERROR, - __swift_stdlib_U_STRINGPREP_CHECK_BIDI_ERROR = - __swift_stdlib_U_IDNA_CHECK_BIDI_ERROR, - __swift_stdlib_U_PLUGIN_ERROR_START = 0x10500, - __swift_stdlib_U_PLUGIN_TOO_HIGH = 0x10500, - __swift_stdlib_U_PLUGIN_DIDNT_SET_LEVEL, - __swift_stdlib_U_PLUGIN_ERROR_LIMIT, - __swift_stdlib_U_ERROR_LIMIT = __swift_stdlib_U_PLUGIN_ERROR_LIMIT -} __swift_stdlib_UErrorCode; - -typedef enum __swift_stdlib_UCharCategory { - __swift_stdlib_U_UNASSIGNED = 0, - __swift_stdlib_U_GENERAL_OTHER_TYPES = 0, - __swift_stdlib_U_UPPERCASE_LETTER = 1, - __swift_stdlib_U_LOWERCASE_LETTER = 2, - __swift_stdlib_U_TITLECASE_LETTER = 3, - __swift_stdlib_U_MODIFIER_LETTER = 4, - __swift_stdlib_U_OTHER_LETTER = 5, - __swift_stdlib_U_NON_SPACING_MARK = 6, - __swift_stdlib_U_ENCLOSING_MARK = 7, - __swift_stdlib_U_COMBINING_SPACING_MARK = 8, - __swift_stdlib_U_DECIMAL_DIGIT_NUMBER = 9, - __swift_stdlib_U_LETTER_NUMBER = 10, - __swift_stdlib_U_OTHER_NUMBER = 11, - __swift_stdlib_U_SPACE_SEPARATOR = 12, - __swift_stdlib_U_LINE_SEPARATOR = 13, - __swift_stdlib_U_PARAGRAPH_SEPARATOR = 14, - __swift_stdlib_U_CONTROL_CHAR = 15, - __swift_stdlib_U_FORMAT_CHAR = 16, - __swift_stdlib_U_PRIVATE_USE_CHAR = 17, - __swift_stdlib_U_SURROGATE = 18, - __swift_stdlib_U_DASH_PUNCTUATION = 19, - __swift_stdlib_U_START_PUNCTUATION = 20, - __swift_stdlib_U_END_PUNCTUATION = 21, - __swift_stdlib_U_CONNECTOR_PUNCTUATION = 22, - __swift_stdlib_U_OTHER_PUNCTUATION = 23, - __swift_stdlib_U_MATH_SYMBOL = 24, - __swift_stdlib_U_CURRENCY_SYMBOL = 25, - __swift_stdlib_U_MODIFIER_SYMBOL = 26, - __swift_stdlib_U_OTHER_SYMBOL = 27, - __swift_stdlib_U_INITIAL_PUNCTUATION = 28, - __swift_stdlib_U_FINAL_PUNCTUATION = 29, - __swift_stdlib_U_CHAR_CATEGORY_COUNT -} __swift_stdlib_UCharCategory; - -typedef enum __swift_stdlib_UCharNameChoice { - __swift_stdlib_U_UNICODE_CHAR_NAME, -#ifndef U_HIDE_DEPRECATED_API - __swift_stdlib_U_UNICODE_10_CHAR_NAME, -#endif - __swift_stdlib_U_EXTENDED_CHAR_NAME = __swift_stdlib_U_UNICODE_CHAR_NAME + 2, - __swift_stdlib_U_CHAR_NAME_ALIAS, -#ifndef U_HIDE_DEPRECATED_API - __swift_stdlib_U_CHAR_NAME_CHOICE_COUNT -#endif -} __swift_stdlib_UCharNameChoice; - -typedef struct __swift_stdlib_UBreakIterator __swift_stdlib_UBreakIterator; -typedef struct __swift_stdlib_UText __swift_stdlib_UText; -typedef __swift_int8_t __swift_stdlib_UBool; -typedef __swift_int32_t __swift_stdlib_UChar32; -#if defined(__APPLE__) -typedef __swift_uint16_t __swift_stdlib_UChar; -#else -#if defined(__cplusplus) -typedef char16_t __swift_stdlib_UChar; -#else -typedef __swift_uint16_t __swift_stdlib_UChar; -#endif -#endif -#define __SWIFT_STDLIB_U_MAX_VERSION_LENGTH 4 -typedef __swift_uint8_t - __swift_stdlib_UVersionInfo[__SWIFT_STDLIB_U_MAX_VERSION_LENGTH]; - -#ifdef __cplusplus -} // extern "C" -#endif - -#if __has_feature(nullability) -#pragma clang assume_nonnull end -#endif - -#endif diff --git a/stdlib/public/SwiftShims/module.modulemap b/stdlib/public/SwiftShims/module.modulemap index 270009ef424c7..8644ab1d7a392 100644 --- a/stdlib/public/SwiftShims/module.modulemap +++ b/stdlib/public/SwiftShims/module.modulemap @@ -18,7 +18,6 @@ module SwiftShims { header "System.h" header "ThreadLocalStorage.h" header "UnicodeData.h" - header "UnicodeShims.h" header "Visibility.h" export * } diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt index 12980fdea992d..e7937b77d4b21 100644 --- a/stdlib/public/core/CMakeLists.txt +++ b/stdlib/public/core/CMakeLists.txt @@ -78,7 +78,6 @@ set(SWIFTLIB_ESSENTIAL Hasher.swift Hashing.swift HashTable.swift - ICU.swift Identifiable.swift Indices.swift InputStream.swift @@ -238,29 +237,6 @@ set(swift_core_link_flags "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}") set(swift_core_framework_depends) set(swift_core_private_link_libraries) set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}") -if(SWIFT_PRIMARY_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) - list(APPEND swift_core_link_flags "-all_load") - list(APPEND swift_core_private_link_libraries icucore) -else() - # With the GNU linker the equivalent of -all_load is to tell the linker - # --whole-archive before the archive and --no-whole-archive after (without - # the second, it causes errors when the system libraries are told to - # include everything). The best way to get it in there, according to the - # documentation, is to put the flags in the target_link_libraries setting. - - # TODO: However, for the moment this actually makes things explode with an - # incomplete runtime. This should be turned back on when more of the porting - # effort has been completed. - #set(LINK_FLAGS - # -Wl,--whole-archive swiftRuntime -Wl,--no-whole-archive) - if("${SWIFT_PATH_TO_LIBICU_BUILD}" STREQUAL "") - list(APPEND swift_core_private_link_libraries - ${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_UC} - ${SWIFT_${SWIFT_PRIMARY_VARIANT_SDK}_${SWIFT_PRIMARY_VARIANT_ARCH}_ICU_I18N}) - else() - list(APPEND swift_core_private_link_libraries -licui18nswift -licuucswift -licudataswift) - endif() -endif() if(SWIFT_PRIMARY_VARIANT_SDK STREQUAL CYGWIN) # TODO(compnerd) cache this variable to permit re-configuration @@ -343,29 +319,6 @@ if(${LIBSWIFT_BUILD_MODE} STREQUAL "BOOTSTRAPPING") set(b0_deps symlink-headers-bootstrapping0) set(b1_deps symlink-headers-bootstrapping1) - if(SWIFT_PATH_TO_LIBICU_BUILD) - foreach(bootstrapping "0" "1") - # Need to symlink the libicu libraries to be able to run - # the bootstrapping compiler with a custom library path. - get_bootstrapping_path(output_dir - "${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" "${bootstrapping}") - if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - message("TODO: support for copying ICU libraries on Windows") - endif() - set(target "symlink-icu-bootstrapping${bootstrapping}") - add_custom_target(${target}) - add_custom_command(TARGET ${target} POST_BUILD - COMMAND - "${CMAKE_COMMAND}" "-E" "make_directory" "${output_dir}" - COMMAND - "ln" "-s" "-f" "${SWIFT_PATH_TO_LIBICU_BUILD}/lib/libicu*" "." - WORKING_DIRECTORY "${output_dir}" - COMMENT "symlink ICU libraries for bootstrapping stage ${bootstrapping}") - endforeach() - set(b0_deps ${b0_deps} symlink-icu-bootstrapping0) - set(b1_deps ${b1_deps} symlink-icu-bootstrapping1) - endif() - list(FIND SWIFT_STDLIB_LIBRARY_BUILD_TYPES "SHARED" index_of_shared) if(index_of_shared EQUAL -1) message(FATAL_ERROR "bootstrapping requires SHARED stdlib build type") diff --git a/stdlib/public/core/GroupInfo.json b/stdlib/public/core/GroupInfo.json index 70be153291477..fdfe1a5ce3a53 100644 --- a/stdlib/public/core/GroupInfo.json +++ b/stdlib/public/core/GroupInfo.json @@ -8,7 +8,6 @@ "CString.swift", "Character.swift", "CharacterProperties.swift", - "ICU.swift", "NFC.swift", "NFD.swift", "SmallString.swift", diff --git a/stdlib/public/core/ICU.swift b/stdlib/public/core/ICU.swift deleted file mode 100644 index ae71d2a480d5e..0000000000000 --- a/stdlib/public/core/ICU.swift +++ /dev/null @@ -1,24 +0,0 @@ -//===--- ICU.swift --------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// -import SwiftShims - -extension __swift_stdlib_UErrorCode { - internal var isFailure: Bool { - return rawValue > __swift_stdlib_U_ZERO_ERROR.rawValue - } - internal var isWarning: Bool { - return rawValue < __swift_stdlib_U_ZERO_ERROR.rawValue - } - internal var isSuccess: Bool { - return rawValue <= __swift_stdlib_U_ZERO_ERROR.rawValue - } -} diff --git a/stdlib/public/core/UnicodeHelpers.swift b/stdlib/public/core/UnicodeHelpers.swift index 1e538f9349d4b..c37d9e2e312f6 100644 --- a/stdlib/public/core/UnicodeHelpers.swift +++ b/stdlib/public/core/UnicodeHelpers.swift @@ -388,7 +388,7 @@ extension _StringGuts { _internalInvariant(self.isForeign) // Both a fast-path for single-code-unit graphemes and validation: - // ICU treats isolated surrogates as isolated graphemes + // treat isolated surrogates as isolated graphemes let count = end &- start if start &- end == 1 { return Character(String(self.foreignErrorCorrectedScalar( diff --git a/stdlib/public/runtime/CMakeLists.txt b/stdlib/public/runtime/CMakeLists.txt index 4c227be7dedc8..77ca35cac3431 100644 --- a/stdlib/public/runtime/CMakeLists.txt +++ b/stdlib/public/runtime/CMakeLists.txt @@ -207,26 +207,6 @@ foreach(sdk ${SWIFT_SDKS}) # 'GenericUnix' (eg linux) if(${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF) string(TOLOWER "${sdk}" lowercase_sdk) - if(SWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_STATICLIB) - set(libicu_i18n_a -licui18nswift) - set(libicu_uc_a -licuucswift) - set(libicu_data_a -licudataswift) - else() - find_package(ICU REQUIRED COMPONENTS uc i18n) - get_filename_component(ICU_UC_LIBDIR "${ICU_UC_LIBRARIES}" DIRECTORY) - get_filename_component(ICU_I18N_LIBDIR "${ICU_I18N_LIBRARIES}" DIRECTORY) - - set(libicu_i18n_a -licui18n) - set(libicu_uc_a -licuuc) - set(libicu_data_a) - if(EXISTS ${ICU_I18N_LIBDIR}/libicui18n.a AND - EXISTS ${ICU_UC_LIBDIR}/libicuuc.a AND - EXISTS ${ICU_UC_LIBDIR}/libicudata.a) - set(libicu_i18n_a ${ICU_I18N_LIBDIR}/libicui18n.a) - set(libicu_uc_a ${ICU_UC_LIBDIR}/libicuuc.a) - set(libicu_data_a ${ICU_UC_LIBDIR}/libicudata.a) - endif() - endif() set(libpthread -lpthread) set(android_libraries) if(${sdk} STREQUAL ANDROID) @@ -240,9 +220,6 @@ foreach(sdk ${SWIFT_SDKS}) ${libpthread} ${android_libraries} -lswiftCore -${libicu_i18n_a} -${libicu_uc_a} -${libicu_data_a} -lstdc++ -lm -Xlinker -export-dynamic diff --git a/stdlib/public/stubs/CMakeLists.txt b/stdlib/public/stubs/CMakeLists.txt index c55331500661f..8b2cf0235e751 100644 --- a/stdlib/public/stubs/CMakeLists.txt +++ b/stdlib/public/stubs/CMakeLists.txt @@ -20,11 +20,8 @@ set(swift_stubs_objc_sources SwiftNativeNSXXXBaseARC.m) set(swift_stubs_gyb_sources SwiftNativeNSXXXBase.mm.gyb) -set(swift_stubs_unicode_normalization_sources - UnicodeShims.cpp) set(LLVM_OPTIONAL_SOURCES ${swift_stubs_objc_sources} - ${swift_stubs_unicode_normalization_sources} ${swift_stubs_gyb_sources}) set(swift_stubs_c_compile_flags ${SWIFT_RUNTIME_CORE_CXX_FLAGS}) @@ -35,7 +32,6 @@ add_swift_target_library(swiftStdlibStubs OBJECT_LIBRARY ${swift_stubs_sources} ${swift_stubs_objc_sources} - ${swift_stubs_unicode_normalization_sources} GYB_SOURCES ${swift_stubs_gyb_sources} C_COMPILE_FLAGS diff --git a/stdlib/public/stubs/UnicodeShims.cpp b/stdlib/public/stubs/UnicodeShims.cpp deleted file mode 100644 index be71412b1678f..0000000000000 --- a/stdlib/public/stubs/UnicodeShims.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===--- UnicodeNormalization.cpp - Unicode Normalization Helpers ---------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// -// -// Functions that use ICU to do unicode normalization and collation. -// -//===----------------------------------------------------------------------===// - -#include "../SwiftShims/UnicodeShims.h" - -#include - -#if defined(__APPLE__) - -// Declare a few external functions to avoid a dependency on ICU headers. -extern "C" { - -// Types -typedef struct UBreakIterator UBreakIterator; -typedef enum UErrorCode {} UErrorCode; -typedef enum UCharNameChoice {} UCharNameChoice; -typedef uint16_t UChar; -typedef int32_t UChar32; -typedef int8_t UBool; -typedef __swift_stdlib_UProperty UProperty; - -#define U_MAX_VERSION_LENGTH 4 -typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; -} - -#else - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic pop - -#endif - -// Force an autolink with ICU -#if defined(__MACH__) -asm(".linker_option \"-licucore\"\n"); -#endif // defined(__MACH__) - diff --git a/utils/build-script-impl b/utils/build-script-impl index 0d416f0e3cd5b..2ffa782082bb7 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -2596,7 +2596,7 @@ for host in "${ALL_HOSTS[@]}"; do ${libicu_enable_debug} \ --enable-renaming --with-library-suffix=swift \ --libdir=${ICU_TMPLIBDIR} \ - --enable-shared --enable-static \ + --enable-shared --enable-static --enable-rpath \ --enable-strict --disable-icuio \ --disable-plugins --disable-dyload --disable-extras \ --disable-samples --disable-layoutex --with-data-packaging=auto diff --git a/utils/check_freestanding_dependencies.py b/utils/check_freestanding_dependencies.py index 6051c59f997a7..dc0569d556e4d 100755 --- a/utils/check_freestanding_dependencies.py +++ b/utils/check_freestanding_dependencies.py @@ -30,14 +30,6 @@ # intended to depend on as few platform symbols/APIs as possible. # ################################################################################ -icu_dependencies = [ - "_u_charAge", "_u_charName", "_u_getIntPropertyValue", "_u_getNumericValue", - "_u_hasBinaryProperty", "_u_strToLower", "_u_strToTitle", "_u_strToUpper", - "_ubrk_close", "_ubrk_following", "_ubrk_open", "_ubrk_preceding", - "_ubrk_setText", "_ubrk_setUText", "_unorm2_getNFCInstance", - "_unorm2_hasBoundaryBefore", "_unorm2_normalize", - "_unorm2_spanQuickCheckYes", "_utext_openUChars", "_utext_openUTF8", -] cxx_dependencies = [ "___cxa_guard_acquire", "___cxa_guard_release", ] @@ -57,7 +49,7 @@ "_posix_memalign", "_putc", "_read", "_realloc", "_snprintf", "_strchr", "_strcmp", "_strdup", "_strlen", "_strncmp", "_strtod_l", "_strtof_l", "_strtol", "_strtold_l", "_vsnprintf", "_write", -] + icu_dependencies + cxx_dependencies + math_dependencies +] + cxx_dependencies + math_dependencies vendor_apple_specific_dependencies = [ "___stack_chk_fail", "___stack_chk_guard", "_getsectiondata", "__dyld_register_func_for_add_image",