mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #81726 from ian-twilightcoder/remove_darwin_overlay
[CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
This commit is contained in:
@@ -716,9 +716,6 @@ function(swift_benchmark_compile)
|
||||
|
||||
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
|
||||
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
if((SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) AND SWIFT_BUILD_SDK_OVERLAY)
|
||||
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
endif()
|
||||
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
|
||||
string(FIND "${stdlib_dependency}" "Unittest" find_output)
|
||||
if("${find_output}" STREQUAL "-1")
|
||||
|
||||
@@ -38,11 +38,7 @@ if(swift_build_freestanding AND (SWIFT_FREESTANDING_FLAVOR STREQUAL "apple"))
|
||||
configure_target_variant(FREESTANDING-R "FREESTANDING Release" FREESTANDING R "Release")
|
||||
configure_target_variant(FREESTANDING-S "FREESTANDING MinSizeRelease" FREESTANDING S "MinSizeRelease")
|
||||
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
|
||||
else()
|
||||
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
|
||||
endif()
|
||||
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
|
||||
endif()
|
||||
|
||||
# Compatible cross-compile SDKS for Darwin OSes: IOS, IOS_SIMULATOR, TVOS,
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
set(swift_oslog_darwin_dependencies "")
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
list(APPEND swift_oslog_darwin_dependencies "Darwin")
|
||||
endif()
|
||||
if (SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
|
||||
list(APPEND swift_oslog_darwin_dependencies "_Concurrency")
|
||||
endif()
|
||||
@@ -12,10 +9,8 @@ if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND swift_oslog_darwin_dependencies _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swift_stdlib_unittest_darwin_dependencies Darwin)
|
||||
else()
|
||||
set(swift_stdlib_unittest_darwin_dependencies)
|
||||
endif()
|
||||
|
||||
if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND swift_stdlib_unittest_darwin_dependencies _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -2,20 +2,14 @@ set(swift_swiftprivate_compile_flags
|
||||
"-parse-stdlib"
|
||||
"-Xfrontend" "-disable-access-control")
|
||||
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swift_swiftprivate_darwin_dependencies Darwin)
|
||||
else()
|
||||
set(swift_swiftprivate_darwin_dependencies)
|
||||
endif()
|
||||
|
||||
if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND swift_swiftprivate_darwin_dependencies _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -14,20 +14,14 @@ else()
|
||||
set(swift_private_libc_extras_incorporate_object_libraries "swiftCommandLineSupport")
|
||||
endif()
|
||||
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swift_private_libc_extras_darwin_dependencies Darwin)
|
||||
else()
|
||||
set(swift_private_libc_extras_darwin_dependencies)
|
||||
endif()
|
||||
|
||||
if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND swift_private_libc_extras_darwin_dependencies _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swift_private_thread_extras_darwin_dependencies Darwin)
|
||||
else()
|
||||
set(swift_private_thread_extras_darwin_dependencies)
|
||||
endif()
|
||||
|
||||
if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND swift_private_thread_extras_darwin_dependencies _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swift_reflection_test_darwin_dependencies Darwin)
|
||||
else()
|
||||
set(swift_reflection_test_darwin_dependencies)
|
||||
endif()
|
||||
|
||||
if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND swift_reflection_test_darwin_dependencies _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -19,15 +19,6 @@ add_dependencies(sdk-overlay CxxStdlib-apinotes)
|
||||
add_dependencies(compiler CxxStdlib-apinotes)
|
||||
|
||||
|
||||
# Swift compiler currently assumes that the Darwin overlay is a dependency of
|
||||
# CxxStdlib, and fails to build CxxStdlib if Darwin.swiftmodule in build dir
|
||||
# is built with a different (older) version of the compiler. To workaround this,
|
||||
# declare the Darwin overlay as a dependency of CxxStdlib.
|
||||
set(swift_cxxstdlib_darwin_dependencies)
|
||||
if(SWIFT_BUILD_STDLIB AND SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swift_cxxstdlib_darwin_dependencies Darwin)
|
||||
endif()
|
||||
|
||||
set(swift_cxxstdlib_dependencies)
|
||||
if(NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT)
|
||||
set(swift_cxxstdlib_dependencies _Builtin_float)
|
||||
@@ -44,12 +35,6 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
|
||||
String.swift
|
||||
|
||||
SWIFT_MODULE_DEPENDS Cxx ${swift_cxxstdlib_dependencies}
|
||||
SWIFT_MODULE_DEPENDS_IOS ${swift_cxxstdlib_darwin_dependencies}
|
||||
SWIFT_MODULE_DEPENDS_OSX ${swift_cxxstdlib_darwin_dependencies}
|
||||
SWIFT_MODULE_DEPENDS_TVOS ${swift_cxxstdlib_darwin_dependencies}
|
||||
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_cxxstdlib_darwin_dependencies}
|
||||
SWIFT_MODULE_DEPENDS_XROS ${swift_cxxstdlib_darwin_dependencies}
|
||||
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_cxxstdlib_darwin_dependencies}
|
||||
SWIFT_MODULE_DEPENDS_ANDROID Android
|
||||
|
||||
SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
|
||||
|
||||
@@ -16,12 +16,6 @@ else()
|
||||
set(swiftDifferentiationSIMDFiles)
|
||||
endif()
|
||||
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swiftDifferentiationDarwinDependencies Darwin)
|
||||
else()
|
||||
set(swiftDifferentiationDarwinDependencies)
|
||||
endif()
|
||||
|
||||
add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
|
||||
Differentiable.swift
|
||||
DifferentialOperators.swift
|
||||
@@ -37,11 +31,6 @@ add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPE
|
||||
TgmathDerivatives.swift.gyb
|
||||
${swiftDifferentiationSIMDFiles}
|
||||
|
||||
SWIFT_MODULE_DEPENDS_OSX ${swiftDifferentiationDarwinDependencies}
|
||||
SWIFT_MODULE_DEPENDS_IOS ${swiftDifferentiationDarwinDependencies}
|
||||
SWIFT_MODULE_DEPENDS_TVOS ${swiftDifferentiationDarwinDependencies}
|
||||
SWIFT_MODULE_DEPENDS_WATCHOS ${swiftDifferentiationDarwinDependencies}
|
||||
SWIFT_MODULE_DEPENDS_XROS ${swiftDifferentiationDarwinDependencies}
|
||||
SWIFT_MODULE_DEPENDS_ANDROID Android
|
||||
SWIFT_MODULE_DEPENDS_LINUX Glibc
|
||||
SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl
|
||||
|
||||
@@ -10,20 +10,14 @@
|
||||
#
|
||||
#===----------------------------------------------------------------------===#
|
||||
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(swift_distributed_darwin_dependencies Darwin)
|
||||
else()
|
||||
set(swift_distributed_darwin_dependencies)
|
||||
endif()
|
||||
|
||||
if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND swift_distributed_darwin_dependencies _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -4,130 +4,11 @@ set(swift_platform_sources
|
||||
set(swift_platform_gyb_sources
|
||||
tgmath.swift.gyb)
|
||||
|
||||
set(darwin_depends)
|
||||
if(NOT BUILD_STANDALONE)
|
||||
# This is overly conservative, but we have so few API notes files that
|
||||
# haven't migrated to the Swift repo that it's probably fine in practice.
|
||||
list(APPEND darwin_depends copy_apinotes)
|
||||
endif()
|
||||
|
||||
set(swift_platform_compile_flags)
|
||||
if(SWIFT_ENABLE_REFLECTION)
|
||||
list(APPEND swift_platform_compile_flags "-DSWIFT_ENABLE_REFLECTION")
|
||||
endif()
|
||||
|
||||
set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS)
|
||||
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "apple" AND NOT SWIFT_FREESTANDING_IS_DARWIN)
|
||||
set(swiftDarwin_target_sdks ALL_APPLE_PLATFORMS FREESTANDING)
|
||||
endif()
|
||||
|
||||
set(swiftDarwin_common_options
|
||||
IS_SDK_OVERLAY
|
||||
${swift_platform_sources}
|
||||
POSIXError.swift
|
||||
MachError.swift
|
||||
|
||||
"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"
|
||||
|
||||
GYB_SOURCES
|
||||
${swift_platform_gyb_sources}
|
||||
Darwin.swift.gyb
|
||||
|
||||
SWIFT_COMPILE_FLAGS
|
||||
${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}
|
||||
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
|
||||
-Xfrontend -disable-objc-attr-requires-foundation-module
|
||||
${swift_platform_compile_flags}
|
||||
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
|
||||
DEPENDS ${darwin_depends})
|
||||
|
||||
|
||||
if(BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING" AND
|
||||
SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
|
||||
|
||||
set(swiftDarwin_common_bootstrapping_options
|
||||
${swiftDarwin_common_options}
|
||||
SHARED
|
||||
IS_STDLIB
|
||||
SDK ${SWIFT_HOST_VARIANT_SDK}
|
||||
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
|
||||
INSTALL_IN_COMPONENT "never_install")
|
||||
|
||||
set(b0_deps swiftCore-bootstrapping0)
|
||||
set(b1_deps swiftCore-bootstrapping1)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(b0_deps ${b0_deps} swiftSwiftOnoneSupport-bootstrapping0)
|
||||
set(b1_deps ${b1_deps} swiftSwiftOnoneSupport-bootstrapping1)
|
||||
endif()
|
||||
|
||||
add_swift_target_library_single(swiftDarwin-bootstrapping0 swiftDarwin
|
||||
${swiftDarwin_common_bootstrapping_options}
|
||||
FILE_DEPENDS ${b0_deps}
|
||||
BOOTSTRAPPING 0)
|
||||
|
||||
add_swift_target_library_single(swiftDarwin-bootstrapping1 swiftDarwin
|
||||
${swiftDarwin_common_bootstrapping_options}
|
||||
FILE_DEPENDS ${b1_deps}
|
||||
BOOTSTRAPPING 1)
|
||||
endif()
|
||||
|
||||
add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
|
||||
${swiftDarwin_common_options}
|
||||
TARGET_SDKS "${swiftDarwin_target_sdks}"
|
||||
INSTALL_IN_COMPONENT sdk-overlay
|
||||
MACCATALYST_BUILD_FLAVOR "zippered"
|
||||
INSTALL_BINARY_SWIFTMODULE FALSE)
|
||||
|
||||
if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
|
||||
set(SWIFT_ENABLE_REFLECTION OFF)
|
||||
|
||||
add_custom_target(embedded-darwin)
|
||||
add_dependencies(embedded-libraries embedded-darwin)
|
||||
foreach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})
|
||||
string(REGEX REPLACE "[ \t]+" ";" list "${entry}")
|
||||
list(GET list 0 arch)
|
||||
list(GET list 1 mod)
|
||||
list(GET list 2 triple)
|
||||
|
||||
if(NOT "${mod}" MATCHES "-macos$")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
set(SWIFT_SDK_embedded_ARCH_${arch}_MODULE "${mod}")
|
||||
set(SWIFT_SDK_embedded_LIB_SUBDIR "embedded")
|
||||
set(SWIFT_SDK_embedded_ARCH_${arch}_TRIPLE "${triple}")
|
||||
set(SWIFT_SDK_embedded_PATH ${SWIFT_SDK_OSX_PATH})
|
||||
set(SWIFT_SDK_embedded_ARCH_${arch}_PATH ${SWIFT_SDK_OSX_PATH})
|
||||
set(SWIFT_SDK_embedded_USE_ISYSROOT TRUE)
|
||||
add_swift_target_library_single(
|
||||
embedded-darwin-${mod}
|
||||
swiftDarwin
|
||||
ONLY_SWIFTMODULE
|
||||
IS_SDK_OVERLAY IS_FRAGILE
|
||||
|
||||
Platform.swift
|
||||
TiocConstants.swift
|
||||
POSIXError.swift
|
||||
MachError.swift
|
||||
|
||||
GYB_SOURCES
|
||||
tgmath.swift.gyb
|
||||
Darwin.swift.gyb
|
||||
|
||||
SWIFT_COMPILE_FLAGS
|
||||
-Xcc -ffreestanding -enable-experimental-feature Embedded
|
||||
C_COMPILE_FLAGS
|
||||
-ffreestanding
|
||||
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
|
||||
SDK "embedded"
|
||||
ARCHITECTURE "${arch}"
|
||||
DEPENDS embedded-stdlib-${mod}
|
||||
INSTALL_IN_COMPONENT stdlib
|
||||
)
|
||||
add_dependencies(embedded-darwin embedded-darwin-${mod})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(swiftGlibc_target_sdks CYGWIN FREEBSD OPENBSD LINUX HAIKU)
|
||||
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "linux")
|
||||
set(swiftGlibc_target_sdks CYGWIN FREEBSD OPENBSD LINUX HAIKU FREESTANDING)
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@_exported import Darwin // Clang module
|
||||
|
||||
public let MAP_FAILED: UnsafeMutableRawPointer! = UnsafeMutableRawPointer(bitPattern: -1)
|
||||
|
||||
// Constants defined by <math.h>
|
||||
@available(swift, deprecated: 3.0, message: "Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.")
|
||||
public let M_PI = Double.pi
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use 'Double.pi / 2' or '.pi / 2' to get the value of correct type and avoid casting.")
|
||||
public let M_PI_2 = Double.pi / 2
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use 'Double.pi / 4' or '.pi / 4' to get the value of correct type and avoid casting.")
|
||||
public let M_PI_4 = Double.pi / 4
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use '2.squareRoot()'.")
|
||||
public let M_SQRT2 = 2.squareRoot()
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use '0.5.squareRoot()'.")
|
||||
public let M_SQRT1_2 = 0.5.squareRoot()
|
||||
|
||||
// Constants defined by <float.h>
|
||||
@available(swift, deprecated: 3.0, message: "Please use 'T.radix' to get the radix of a FloatingPoint type 'T'.")
|
||||
public let FLT_RADIX = Double.radix
|
||||
|
||||
%for type, prefix in [('Float', 'FLT'), ('Double', 'DBL'), ('Float80', 'LDBL')]:
|
||||
% if type == "Float80":
|
||||
#if arch(i386) || arch(x86_64)
|
||||
% end
|
||||
// Where does the 1 come from? C counts the usually-implicit leading
|
||||
// significand bit, but Swift does not. Neither is really right or wrong.
|
||||
@available(swift, deprecated: 3.0, message: "Please use '${type}.significandBitCount + 1'.")
|
||||
public let ${prefix}_MANT_DIG = ${type}.significandBitCount + 1
|
||||
|
||||
// Where does the 1 come from? C models floating-point numbers as having a
|
||||
// significand in [0.5, 1), but Swift (following IEEE 754) considers the
|
||||
// significand to be in [1, 2). This rationale applies to ${prefix}_MIN_EXP
|
||||
// as well.
|
||||
@available(swift, deprecated: 3.0, message: "Please use '${type}.greatestFiniteMagnitude.exponent + 1'.")
|
||||
public let ${prefix}_MAX_EXP = ${type}.greatestFiniteMagnitude.exponent + 1
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNormalMagnitude.exponent + 1'.")
|
||||
public let ${prefix}_MIN_EXP = ${type}.leastNormalMagnitude.exponent + 1
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use '${type}.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'.")
|
||||
public let ${prefix}_MAX = ${type}.greatestFiniteMagnitude
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use '${type}.ulpOfOne' or '.ulpOfOne'.")
|
||||
public let ${prefix}_EPSILON = ${type}.ulpOfOne
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNormalMagnitude' or '.leastNormalMagnitude'.")
|
||||
public let ${prefix}_MIN = ${type}.leastNormalMagnitude
|
||||
|
||||
@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'.")
|
||||
public let ${prefix}_TRUE_MIN = ${type}.leastNonzeroMagnitude
|
||||
|
||||
% if type == "Float80":
|
||||
#endif
|
||||
% end
|
||||
%end
|
||||
|
||||
// Macros defined in bsd/sys/proc.h that do not import into Swift.
|
||||
extension extern_proc {
|
||||
// #define p_starttime p_un.__p_starttime
|
||||
@_transparent
|
||||
public var p_starttime: timeval {
|
||||
get { return self.p_un.__p_starttime }
|
||||
set { self.p_un.__p_starttime = newValue }
|
||||
}
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)) && _runtime(_ObjC)
|
||||
/// Enumeration describing Mach error codes.
|
||||
@objc
|
||||
public enum MachErrorCode : Int32 {
|
||||
case success = 0
|
||||
|
||||
/// Specified address is not currently valid.
|
||||
case invalidAddress = 1
|
||||
|
||||
/// Specified memory is valid, but does not permit the required
|
||||
/// forms of access.
|
||||
case protectionFailure = 2
|
||||
|
||||
/// The address range specified is already in use, or no address
|
||||
/// range of the size specified could be found.
|
||||
case noSpace = 3
|
||||
|
||||
/// The function requested was not applicable to this type of
|
||||
/// argument, or an argument is invalid.
|
||||
case invalidArgument = 4
|
||||
|
||||
/// The function could not be performed. A catch-all.
|
||||
case failure = 5
|
||||
|
||||
/// A system resource could not be allocated to fulfill this
|
||||
/// request. This failure may not be permanent.
|
||||
case resourceShortage = 6
|
||||
|
||||
/// The task in question does not hold receive rights for the port
|
||||
/// argument.
|
||||
case notReceiver = 7
|
||||
|
||||
/// Bogus access restriction.
|
||||
case noAccess = 8
|
||||
|
||||
/// During a page fault, the target address refers to a memory
|
||||
/// object that has been destroyed. This failure is permanent.
|
||||
case memoryFailure = 9
|
||||
|
||||
/// During a page fault, the memory object indicated that the data
|
||||
/// could not be returned. This failure may be temporary; future
|
||||
/// attempts to access this same data may succeed, as defined by the
|
||||
/// memory object.
|
||||
case memoryError = 10
|
||||
|
||||
/// The receive right is already a member of the portset.
|
||||
case alreadyInSet = 11
|
||||
|
||||
/// The receive right is not a member of a port set.
|
||||
case notInSet = 12
|
||||
|
||||
/// The name already denotes a right in the task.
|
||||
case nameExists = 13
|
||||
|
||||
/// The operation was aborted. Ipc code will catch this and reflect
|
||||
/// it as a message error.
|
||||
case aborted = 14
|
||||
|
||||
/// The name doesn't denote a right in the task.
|
||||
case invalidName = 15
|
||||
|
||||
/// Target task isn't an active task.
|
||||
case invalidTask = 16
|
||||
|
||||
/// The name denotes a right, but not an appropriate right.
|
||||
case invalidRight = 17
|
||||
|
||||
/// A blatant range error.
|
||||
case invalidValue = 18
|
||||
|
||||
/// Operation would overflow limit on user-references.
|
||||
case userReferencesOverflow = 19
|
||||
|
||||
/// The supplied (port) capability is improper.
|
||||
case invalidCapability = 20
|
||||
|
||||
/// The task already has send or receive rights for the port under
|
||||
/// another name.
|
||||
case rightExists = 21
|
||||
|
||||
/// Target host isn't actually a host.
|
||||
case invalidHost = 22
|
||||
|
||||
/// An attempt was made to supply "precious" data for memory that is
|
||||
/// already present in a memory object.
|
||||
case memoryPresent = 23
|
||||
|
||||
/// A page was requested of a memory manager via
|
||||
/// memory_object_data_request for an object using a
|
||||
/// MEMORY_OBJECT_COPY_CALL strategy, with the VM_PROT_WANTS_COPY
|
||||
/// flag being used to specify that the page desired is for a copy
|
||||
/// of the object, and the memory manager has detected the page was
|
||||
/// pushed into a copy of the object while the kernel was walking
|
||||
/// the shadow chain from the copy to the object. This error code is
|
||||
/// delivered via memory_object_data_error and is handled by the
|
||||
/// kernel (it forces the kernel to restart the fault). It will not
|
||||
/// be seen by users.
|
||||
case memoryDataMoved = 24
|
||||
|
||||
/// A strategic copy was attempted of an object upon which a quicker
|
||||
/// copy is now possible. The caller should retry the copy using
|
||||
/// vm_object_copy_quickly. This error code is seen only by the
|
||||
/// kernel.
|
||||
case memoryRestartCopy = 25
|
||||
|
||||
/// An argument applied to assert processor set privilege was not a
|
||||
/// processor set control port.
|
||||
case invalidProcessorSet = 26
|
||||
|
||||
/// The specified scheduling attributes exceed the thread's limits.
|
||||
case policyLimit = 27
|
||||
|
||||
/// The specified scheduling policy is not currently enabled for the
|
||||
/// processor set.
|
||||
case invalidPolicy = 28
|
||||
|
||||
/// The external memory manager failed to initialize the memory object.
|
||||
case invalidObject = 29
|
||||
|
||||
/// A thread is attempting to wait for an event for which there is
|
||||
/// already a waiting thread.
|
||||
case alreadyWaiting = 30
|
||||
|
||||
/// An attempt was made to destroy the default processor set.
|
||||
case defaultSet = 31
|
||||
|
||||
/// An attempt was made to fetch an exception port that is
|
||||
/// protected, or to abort a thread while processing a protected
|
||||
/// exception.
|
||||
case exceptionProtected = 32
|
||||
|
||||
/// A ledger was required but not supplied.
|
||||
case invalidLedger = 33
|
||||
|
||||
/// The port was not a memory cache control port.
|
||||
case invalidMemoryControl = 34
|
||||
|
||||
/// An argument supplied to assert security privilege was not a host
|
||||
/// security port.
|
||||
case invalidSecurity = 35
|
||||
|
||||
/// thread_depress_abort was called on a thread which was not
|
||||
/// currently depressed.
|
||||
case notDepressed = 36
|
||||
|
||||
/// Object has been terminated and is no longer available.
|
||||
case terminated = 37
|
||||
|
||||
/// Lock set has been destroyed and is no longer available.
|
||||
case lockSetDestroyed = 38
|
||||
|
||||
/// The thread holding the lock terminated before releasing the lock.
|
||||
case lockUnstable = 39
|
||||
|
||||
/// The lock is already owned by another thread.
|
||||
case lockOwned = 40
|
||||
|
||||
/// The lock is already owned by the calling thread.
|
||||
case lockOwnedSelf = 41
|
||||
|
||||
/// Semaphore has been destroyed and is no longer available.
|
||||
case semaphoreDestroyed = 42
|
||||
|
||||
/// Return from RPC indicating the target server was terminated
|
||||
/// before it successfully replied.
|
||||
case rpcServerTerminated = 43
|
||||
|
||||
/// Terminate an orphaned activation.
|
||||
case rpcTerminateOrphan = 44
|
||||
|
||||
/// Allow an orphaned activation to continue executing.
|
||||
case rpcContinueOrphan = 45
|
||||
|
||||
/// Empty thread activation (No thread linked to it).
|
||||
case notSupported = 46
|
||||
|
||||
/// Remote node down or inaccessible.
|
||||
case nodeDown = 47
|
||||
|
||||
/// A signalled thread was not actually waiting.
|
||||
case notWaiting = 48
|
||||
|
||||
/// Some thread-oriented operation (semaphore_wait) timed out.
|
||||
case operationTimedOut = 49
|
||||
|
||||
/// During a page fault, indicates that the page was rejected as a
|
||||
/// result of a signature check.
|
||||
case codesignError = 50
|
||||
|
||||
/// The requested property cannot be changed at this time.
|
||||
case policyStatic = 51
|
||||
}
|
||||
#endif // (os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)) && _runtime(_ObjC)
|
||||
@@ -10,260 +10,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)) && _runtime(_ObjC)
|
||||
|
||||
/// Enumeration describing POSIX error codes.
|
||||
@objc
|
||||
public enum POSIXErrorCode: Int32, Sendable {
|
||||
/// Operation not permitted.
|
||||
case EPERM = 1
|
||||
/// No such file or directory.
|
||||
case ENOENT = 2
|
||||
/// No such process.
|
||||
case ESRCH = 3
|
||||
/// Interrupted system call.
|
||||
case EINTR = 4
|
||||
/// Input/output error.
|
||||
case EIO = 5
|
||||
/// Device not configured.
|
||||
case ENXIO = 6
|
||||
/// Argument list too long.
|
||||
case E2BIG = 7
|
||||
/// Exec format error.
|
||||
case ENOEXEC = 8
|
||||
/// Bad file descriptor.
|
||||
case EBADF = 9
|
||||
/// No child processes.
|
||||
case ECHILD = 10
|
||||
/// Resource deadlock avoided.
|
||||
case EDEADLK = 11
|
||||
/// 11 was EAGAIN.
|
||||
/// Cannot allocate memory.
|
||||
case ENOMEM = 12
|
||||
/// Permission denied.
|
||||
case EACCES = 13
|
||||
/// Bad address.
|
||||
case EFAULT = 14
|
||||
/// Block device required.
|
||||
case ENOTBLK = 15
|
||||
/// Device / Resource busy.
|
||||
case EBUSY = 16
|
||||
/// File exists.
|
||||
case EEXIST = 17
|
||||
/// Cross-device link.
|
||||
case EXDEV = 18
|
||||
/// Operation not supported by device.
|
||||
case ENODEV = 19
|
||||
/// Not a directory.
|
||||
case ENOTDIR = 20
|
||||
/// Is a directory.
|
||||
case EISDIR = 21
|
||||
/// Invalid argument.
|
||||
case EINVAL = 22
|
||||
/// Too many open files in system.
|
||||
case ENFILE = 23
|
||||
/// Too many open files.
|
||||
case EMFILE = 24
|
||||
/// Inappropriate ioctl for device.
|
||||
case ENOTTY = 25
|
||||
/// Text file busy.
|
||||
case ETXTBSY = 26
|
||||
/// File too large.
|
||||
case EFBIG = 27
|
||||
/// No space left on device.
|
||||
case ENOSPC = 28
|
||||
/// Illegal seek.
|
||||
case ESPIPE = 29
|
||||
/// Read-only file system.
|
||||
case EROFS = 30
|
||||
/// Too many links.
|
||||
case EMLINK = 31
|
||||
/// Broken pipe.
|
||||
case EPIPE = 32
|
||||
|
||||
/// math software.
|
||||
/// Numerical argument out of domain.
|
||||
case EDOM = 33
|
||||
/// Result too large.
|
||||
case ERANGE = 34
|
||||
|
||||
/// non-blocking and interrupt i/o.
|
||||
/// Resource temporarily unavailable.
|
||||
case EAGAIN = 35
|
||||
/// Operation would block.
|
||||
public static var EWOULDBLOCK: POSIXErrorCode { return EAGAIN }
|
||||
/// Operation now in progress.
|
||||
case EINPROGRESS = 36
|
||||
/// Operation already in progress.
|
||||
case EALREADY = 37
|
||||
|
||||
/// ipc/network software -- argument errors.
|
||||
/// Socket operation on non-socket.
|
||||
case ENOTSOCK = 38
|
||||
/// Destination address required.
|
||||
case EDESTADDRREQ = 39
|
||||
/// Message too long.
|
||||
case EMSGSIZE = 40
|
||||
/// Protocol wrong type for socket.
|
||||
case EPROTOTYPE = 41
|
||||
/// Protocol not available.
|
||||
case ENOPROTOOPT = 42
|
||||
/// Protocol not supported.
|
||||
case EPROTONOSUPPORT = 43
|
||||
/// Socket type not supported.
|
||||
case ESOCKTNOSUPPORT = 44
|
||||
/// Operation not supported.
|
||||
case ENOTSUP = 45
|
||||
/// Protocol family not supported.
|
||||
case EPFNOSUPPORT = 46
|
||||
/// Address family not supported by protocol family.
|
||||
case EAFNOSUPPORT = 47
|
||||
/// Address already in use.
|
||||
case EADDRINUSE = 48
|
||||
/// Can't assign requested address.
|
||||
case EADDRNOTAVAIL = 49
|
||||
|
||||
/// ipc/network software -- operational errors
|
||||
/// Network is down.
|
||||
case ENETDOWN = 50
|
||||
/// Network is unreachable.
|
||||
case ENETUNREACH = 51
|
||||
/// Network dropped connection on reset.
|
||||
case ENETRESET = 52
|
||||
/// Software caused connection abort.
|
||||
case ECONNABORTED = 53
|
||||
/// Connection reset by peer.
|
||||
case ECONNRESET = 54
|
||||
/// No buffer space available.
|
||||
case ENOBUFS = 55
|
||||
/// Socket is already connected.
|
||||
case EISCONN = 56
|
||||
/// Socket is not connected.
|
||||
case ENOTCONN = 57
|
||||
/// Can't send after socket shutdown.
|
||||
case ESHUTDOWN = 58
|
||||
/// Too many references: can't splice.
|
||||
case ETOOMANYREFS = 59
|
||||
/// Operation timed out.
|
||||
case ETIMEDOUT = 60
|
||||
/// Connection refused.
|
||||
case ECONNREFUSED = 61
|
||||
|
||||
/// Too many levels of symbolic links.
|
||||
case ELOOP = 62
|
||||
/// File name too long.
|
||||
case ENAMETOOLONG = 63
|
||||
|
||||
/// Host is down.
|
||||
case EHOSTDOWN = 64
|
||||
/// No route to host.
|
||||
case EHOSTUNREACH = 65
|
||||
/// Directory not empty.
|
||||
case ENOTEMPTY = 66
|
||||
|
||||
/// quotas & mush.
|
||||
/// Too many processes.
|
||||
case EPROCLIM = 67
|
||||
/// Too many users.
|
||||
case EUSERS = 68
|
||||
/// Disc quota exceeded.
|
||||
case EDQUOT = 69
|
||||
|
||||
/// Network File System.
|
||||
/// Stale NFS file handle.
|
||||
case ESTALE = 70
|
||||
/// Too many levels of remote in path.
|
||||
case EREMOTE = 71
|
||||
/// RPC struct is bad.
|
||||
case EBADRPC = 72
|
||||
/// RPC version wrong.
|
||||
case ERPCMISMATCH = 73
|
||||
/// RPC prog. not avail.
|
||||
case EPROGUNAVAIL = 74
|
||||
/// Program version wrong.
|
||||
case EPROGMISMATCH = 75
|
||||
/// Bad procedure for program.
|
||||
case EPROCUNAVAIL = 76
|
||||
|
||||
/// No locks available.
|
||||
case ENOLCK = 77
|
||||
/// Function not implemented.
|
||||
case ENOSYS = 78
|
||||
|
||||
/// Inappropriate file type or format.
|
||||
case EFTYPE = 79
|
||||
/// Authentication error.
|
||||
case EAUTH = 80
|
||||
/// Need authenticator.
|
||||
case ENEEDAUTH = 81
|
||||
|
||||
/// Intelligent device errors.
|
||||
/// Device power is off.
|
||||
case EPWROFF = 82
|
||||
/// Device error, e.g. paper out.
|
||||
case EDEVERR = 83
|
||||
|
||||
/// Value too large to be stored in data type.
|
||||
case EOVERFLOW = 84
|
||||
|
||||
// MARK: Program loading errors.
|
||||
|
||||
/// Bad executable.
|
||||
case EBADEXEC = 85
|
||||
/// Bad CPU type in executable.
|
||||
case EBADARCH = 86
|
||||
/// Shared library version mismatch.
|
||||
case ESHLIBVERS = 87
|
||||
/// Malformed Macho file.
|
||||
case EBADMACHO = 88
|
||||
|
||||
/// Operation canceled.
|
||||
case ECANCELED = 89
|
||||
|
||||
/// Identifier removed.
|
||||
case EIDRM = 90
|
||||
/// No message of desired type.
|
||||
case ENOMSG = 91
|
||||
/// Illegal byte sequence.
|
||||
case EILSEQ = 92
|
||||
/// Attribute not found.
|
||||
case ENOATTR = 93
|
||||
|
||||
/// Bad message.
|
||||
case EBADMSG = 94
|
||||
/// Reserved.
|
||||
case EMULTIHOP = 95
|
||||
/// No message available on STREAM.
|
||||
case ENODATA = 96
|
||||
/// Reserved.
|
||||
case ENOLINK = 97
|
||||
/// No STREAM resources.
|
||||
case ENOSR = 98
|
||||
/// Not a STREAM.
|
||||
case ENOSTR = 99
|
||||
/// Protocol error.
|
||||
case EPROTO = 100
|
||||
/// STREAM ioctl timeout.
|
||||
case ETIME = 101
|
||||
|
||||
/// No such policy registered.
|
||||
case ENOPOLICY = 103
|
||||
|
||||
/// State not recoverable.
|
||||
case ENOTRECOVERABLE = 104
|
||||
/// Previous owner died.
|
||||
case EOWNERDEAD = 105
|
||||
|
||||
/// Interface output queue is full.
|
||||
case EQFULL = 106
|
||||
/// Must be equal largest errno.
|
||||
public static var ELAST: POSIXErrorCode { return EQFULL }
|
||||
|
||||
// FIXME: EOPNOTSUPP has different values depending on __DARWIN_UNIX03 and
|
||||
// KERNEL.
|
||||
}
|
||||
|
||||
#elseif os(Linux) || os(Android)
|
||||
#if os(Linux) || os(Android)
|
||||
|
||||
/// Enumeration describing POSIX error codes.
|
||||
public enum POSIXErrorCode: Int32, Sendable {
|
||||
|
||||
@@ -13,77 +13,6 @@
|
||||
import SwiftShims
|
||||
import SwiftOverlayShims
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MacTypes.h
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
public var noErr: OSStatus { return 0 }
|
||||
|
||||
/// The `Boolean` type declared in MacTypes.h and used throughout Core
|
||||
/// Foundation.
|
||||
///
|
||||
/// The C type is a typedef for `unsigned char`.
|
||||
@frozen
|
||||
public struct DarwinBoolean : ExpressibleByBooleanLiteral {
|
||||
@usableFromInline var _value: UInt8
|
||||
|
||||
@_transparent
|
||||
public init(_ value: Bool) {
|
||||
self._value = value ? 1 : 0
|
||||
}
|
||||
|
||||
/// The value of `self`, expressed as a `Bool`.
|
||||
@_transparent
|
||||
public var boolValue: Bool {
|
||||
return _value != 0
|
||||
}
|
||||
|
||||
/// Create an instance initialized to `value`.
|
||||
@_transparent
|
||||
public init(booleanLiteral value: Bool) {
|
||||
self.init(value)
|
||||
}
|
||||
}
|
||||
|
||||
#if SWIFT_ENABLE_REFLECTION
|
||||
extension DarwinBoolean : CustomReflectable {
|
||||
/// Returns a mirror that reflects `self`.
|
||||
public var customMirror: Mirror {
|
||||
return Mirror(reflecting: boolValue)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@_unavailableInEmbedded
|
||||
extension DarwinBoolean : CustomStringConvertible {
|
||||
/// A textual representation of `self`.
|
||||
public var description: String {
|
||||
return self.boolValue.description
|
||||
}
|
||||
}
|
||||
|
||||
extension DarwinBoolean : Equatable {
|
||||
@_transparent
|
||||
public static func ==(lhs: DarwinBoolean, rhs: DarwinBoolean) -> Bool {
|
||||
return lhs.boolValue == rhs.boolValue
|
||||
}
|
||||
}
|
||||
|
||||
@_transparent
|
||||
public // COMPILER_INTRINSIC
|
||||
func _convertBoolToDarwinBoolean(_ x: Bool) -> DarwinBoolean {
|
||||
return DarwinBoolean(x)
|
||||
}
|
||||
|
||||
@_transparent
|
||||
public // COMPILER_INTRINSIC
|
||||
func _convertDarwinBooleanToBool(_ x: DarwinBoolean) -> Bool {
|
||||
return x.boolValue
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// sys/errno.h
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -102,7 +31,7 @@ public var errno : Int32 {
|
||||
// stdio.h
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) || os(FreeBSD) || os(PS4)
|
||||
#if os(FreeBSD) || os(PS4)
|
||||
public var stdin : UnsafeMutablePointer<FILE> {
|
||||
get {
|
||||
return __stdinp
|
||||
@@ -250,9 +179,6 @@ public var S_IFBLK: mode_t { return mode_t(0o060000) }
|
||||
public var S_IFREG: mode_t { return mode_t(0o100000) }
|
||||
public var S_IFLNK: mode_t { return mode_t(0o120000) }
|
||||
public var S_IFSOCK: mode_t { return mode_t(0o140000) }
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
public var S_IFWHT: mode_t { return mode_t(0o160000) }
|
||||
#endif
|
||||
|
||||
public var S_IRWXU: mode_t { return mode_t(0o000700) }
|
||||
public var S_IRUSR: mode_t { return mode_t(0o000400) }
|
||||
@@ -272,13 +198,6 @@ public var S_IXOTH: mode_t { return mode_t(0o000001) }
|
||||
public var S_ISUID: mode_t { return mode_t(0o004000) }
|
||||
public var S_ISGID: mode_t { return mode_t(0o002000) }
|
||||
public var S_ISVTX: mode_t { return mode_t(0o001000) }
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
|
||||
public var S_ISTXT: mode_t { return S_ISVTX }
|
||||
public var S_IREAD: mode_t { return S_IRUSR }
|
||||
public var S_IWRITE: mode_t { return S_IWUSR }
|
||||
public var S_IEXEC: mode_t { return S_IXUSR }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -313,32 +232,11 @@ public func ioctl(
|
||||
// !os(Windows)
|
||||
#endif
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// unistd.h
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
@available(*, unavailable, message: "Please use threads or posix_spawn*()")
|
||||
public func fork() -> Int32 {
|
||||
fatalError("unavailable function can't be called")
|
||||
}
|
||||
|
||||
@available(*, unavailable, message: "Please use threads or posix_spawn*()")
|
||||
public func vfork() -> Int32 {
|
||||
fatalError("unavailable function can't be called")
|
||||
}
|
||||
#endif
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// signal.h
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
public var SIG_DFL: sig_t? { return nil }
|
||||
public var SIG_IGN: sig_t { return unsafeBitCast(1, to: sig_t.self) }
|
||||
public var SIG_ERR: sig_t { return unsafeBitCast(-1, to: sig_t.self) }
|
||||
public var SIG_HOLD: sig_t { return unsafeBitCast(5, to: sig_t.self) }
|
||||
#elseif os(OpenBSD)
|
||||
#if os(OpenBSD)
|
||||
public var SIG_DFL: sig_t? { return nil }
|
||||
public var SIG_IGN: sig_t { return unsafeBitCast(1, to: sig_t.self) }
|
||||
public var SIG_ERR: sig_t { return unsafeBitCast(-1, to: sig_t.self) }
|
||||
@@ -399,10 +297,7 @@ public typealias Semaphore = UnsafeMutablePointer<sem_t>
|
||||
|
||||
/// The value returned by `sem_open()` in the case of failure.
|
||||
public var SEM_FAILED: Semaphore? {
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
// The value is ABI. Value verified to be correct for OS X, iOS, watchOS, tvOS.
|
||||
return Semaphore(bitPattern: -1)
|
||||
#elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI)
|
||||
#if os(Linux) || os(FreeBSD) || os(OpenBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI)
|
||||
// The value is ABI. Value verified to be correct on Glibc.
|
||||
return Semaphore(bitPattern: 0)
|
||||
#else
|
||||
@@ -432,7 +327,7 @@ public func sem_open(
|
||||
// time.h
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) || os(Linux)
|
||||
#if os(Linux)
|
||||
|
||||
@available(SwiftStdlib 5.7, *)
|
||||
extension timespec {
|
||||
@@ -457,15 +352,9 @@ extension timeval {
|
||||
@available(SwiftStdlib 5.7, *)
|
||||
public init(_ duration: Duration) {
|
||||
let comps = duration.components
|
||||
#if os(Linux)
|
||||
// Linux platforms define timeval as Int/Int
|
||||
self.init(tv_sec: Int(comps.seconds),
|
||||
tv_usec: Int(comps.attoseconds / 1_000_000_000_000))
|
||||
#else
|
||||
// Darwin platforms define timeval as Int/Int32
|
||||
self.init(tv_sec: Int(comps.seconds),
|
||||
tv_usec: Int32(comps.attoseconds / 1_000_000_000_000))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +374,7 @@ extension Duration {
|
||||
|
||||
// Some platforms don't have `extern char** environ` imported from C.
|
||||
#if SWIFT_STDLIB_HAS_ENVIRON
|
||||
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) || os(FreeBSD) || os(OpenBSD) || os(PS4)
|
||||
#if os(FreeBSD) || os(OpenBSD) || os(PS4)
|
||||
public var environ: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?> {
|
||||
return _swift_stdlib_getEnviron()
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
This directory holds the Swift Standard Library's Darwin and Glibc Module,
|
||||
comprised of
|
||||
This directory holds the Swift Standard Library's Glibc Module, comprised of
|
||||
|
||||
- The *overlay* library, which amends some APIs imported from Clang module.
|
||||
- Glibc only: The clang [module map] which specifies which headers need to
|
||||
be imported from Glibc for bare minimum functionality.
|
||||
- The clang [module map] which specifies which headers need to be imported
|
||||
from Glibc for bare minimum functionality.
|
||||
|
||||
Note: On Darwin platforms, we assume clang [module map] is already installed
|
||||
in the system SDK.
|
||||
Note: Darwin platforms provide their own overlays and module maps in the
|
||||
system SDK.
|
||||
|
||||
[module map]: http://clang.llvm.org/docs/Modules.html
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Tty ioctl request constants, needed only on Darwin and FreeBSD.
|
||||
// Tty ioctl request constants, needed only on FreeBSD.
|
||||
|
||||
// Constants available on all platforms, also available on Linux.
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS) || os(FreeBSD) || os(Haiku)
|
||||
#if os(FreeBSD) || os(Haiku)
|
||||
|
||||
/// Set exclusive use of tty.
|
||||
public var TIOCEXCL: UInt { return 0x2000740d }
|
||||
@@ -114,45 +114,6 @@ public var TIOCGLTC: UInt { return 0x40067474 }
|
||||
#endif
|
||||
|
||||
|
||||
// Darwin only constants, also available on Linux.
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
|
||||
|
||||
/// Get termios struct.
|
||||
public var TIOCGETA: UInt { return 0x40487413 }
|
||||
/// Set termios struct.
|
||||
public var TIOCSETA: UInt { return 0x80487414 }
|
||||
/// Drain output, set.
|
||||
public var TIOCSETAW: UInt { return 0x80487415 }
|
||||
/// Drn out, fls in, set.
|
||||
public var TIOCSETAF: UInt { return 0x80487416 }
|
||||
/// Pty: generate signal.
|
||||
public var TIOCSIG: UInt { return 0x2000745f }
|
||||
/// Get modem control state.
|
||||
public var TIOCMODG: UInt { return 0x40047403 }
|
||||
/// Set modem control state.
|
||||
public var TIOCMODS: UInt { return 0x80047404 }
|
||||
/// Internal input VSTART.
|
||||
public var TIOCIXON: UInt { return 0x20007481 }
|
||||
/// Internal input VSTOP.
|
||||
public var TIOCIXOFF: UInt { return 0x20007480 }
|
||||
/// Remote input editing.
|
||||
public var TIOCREMOTE: UInt { return 0x80047469 }
|
||||
/// 4.2 compatibility.
|
||||
public var TIOCSCONS: UInt { return 0x20007463 }
|
||||
/// Enable/get timestamp of last DCd rise.
|
||||
public var TIOCDCDTIMESTAMP: UInt { return 0x40107458 }
|
||||
/// Download microcode to DSI Softmodem.
|
||||
public var TIOCDSIMICROCODE: UInt { return 0x20007455 }
|
||||
/// Grantpt(3).
|
||||
public var TIOCPTYGRANT: UInt { return 0x20007454 }
|
||||
/// Ptsname(3).
|
||||
public var TIOCPTYGNAME: UInt { return 0x40807453 }
|
||||
/// Unlockpt(3).
|
||||
public var TIOCPTYUNLK: UInt { return 0x20007452 }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// FreeBSD specific values and constants available only on FreeBSD.
|
||||
#if os(FreeBSD)
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ def TypedBinaryFunctions():
|
||||
// Note these do not have a corresponding LLVM intrinsic
|
||||
% for T, CT, f, ufunc in TypedUnaryFunctions():
|
||||
% if T == 'Float80':
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux) && !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))))
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux)))
|
||||
% end
|
||||
@_transparent
|
||||
public func ${ufunc}(_ x: ${T}) -> ${T} {
|
||||
@@ -234,23 +234,6 @@ public func ${ufunc}(_ x: ${T}) -> ${T} {
|
||||
|
||||
% end
|
||||
|
||||
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
|
||||
// Unary intrinsic functions
|
||||
// Note these have a corresponding LLVM intrinsic
|
||||
% for T, ufunc in TypedUnaryIntrinsicFunctions():
|
||||
% if T == 'Float80':
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux) && !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))))
|
||||
% end
|
||||
@_transparent
|
||||
public func ${ufunc}(_ x: ${T}) -> ${T} {
|
||||
return _${ufunc}(x)
|
||||
}
|
||||
% if T == 'Float80':
|
||||
#endif
|
||||
% end
|
||||
|
||||
% end
|
||||
#else
|
||||
// FIXME: As of now, we cannot declare 64-bit (Double/CDouble) overlays here.
|
||||
// Since CoreFoundation also exports libc functions, they will conflict with
|
||||
// Swift overlays when building Foundation. For now, just like normal
|
||||
@@ -258,7 +241,7 @@ public func ${ufunc}(_ x: ${T}) -> ${T} {
|
||||
% for ufunc in UnaryIntrinsicFunctions:
|
||||
% for T, CT, f in OverlayFloatTypes():
|
||||
% if T == 'Float80':
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux) && !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))))
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux)))
|
||||
% end
|
||||
@_transparent
|
||||
public func ${ufunc}(_ x: ${T}) -> ${T} {
|
||||
@@ -269,13 +252,12 @@ public func ${ufunc}(_ x: ${T}) -> ${T} {
|
||||
% end
|
||||
% end
|
||||
% end
|
||||
#endif
|
||||
|
||||
// Binary functions
|
||||
|
||||
% for T, CT, f, bfunc in TypedBinaryFunctions():
|
||||
% if T == 'Float80':
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux) && !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))))
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux)))
|
||||
% end
|
||||
@_transparent
|
||||
public func ${bfunc}(_ lhs: ${T}, _ rhs: ${T}) -> ${T} {
|
||||
@@ -290,7 +272,7 @@ public func ${bfunc}(_ lhs: ${T}, _ rhs: ${T}) -> ${T} {
|
||||
% # This is AllFloatTypes not OverlayFloatTypes because of the tuple return.
|
||||
% for T, CT, f in AllFloatTypes():
|
||||
% if T == 'Float80':
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || os(OpenBSD) || ($Embedded && !os(Linux) && !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))))
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || os(OpenBSD) || ($Embedded && !os(Linux)))
|
||||
% else:
|
||||
// lgamma not available on Windows, apparently?
|
||||
#if !os(Windows)
|
||||
@@ -308,7 +290,7 @@ public func lgamma(_ x: ${T}) -> (${T}, Int) {
|
||||
% # This is AllFloatTypes not OverlayFloatTypes because of the tuple return.
|
||||
% for T, CT, f in AllFloatTypes():
|
||||
% if T == 'Float80':
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux) && !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))))
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux)))
|
||||
% end
|
||||
@_transparent
|
||||
public func remquo(_ x: ${T}, _ y: ${T}) -> (${T}, Int) {
|
||||
@@ -324,7 +306,7 @@ public func remquo(_ x: ${T}, _ y: ${T}) -> (${T}, Int) {
|
||||
|
||||
% for T, CT, f in OverlayFloatTypes():
|
||||
% if T == 'Float80':
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux) && !(os(macOS) || os(iOS) || os(watchOS) || os(tvOS))))
|
||||
#if (arch(i386) || arch(x86_64)) && !(os(Windows) || os(Android) || ($Embedded && !os(Linux)))
|
||||
% end
|
||||
@available(swift, deprecated: 4.2/*, obsoleted: 5.1*/, message:
|
||||
"use ${T}(nan: ${T}.RawSignificand).")
|
||||
|
||||
@@ -37,18 +37,12 @@ set(SWIFT_SYNCHRONIZATION_GYB_SOURCES
|
||||
|
||||
set(SWIFT_SYNCHRONIZATION_DARWIN_DEPENDENCIES)
|
||||
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(SWIFT_SYNCHRONIZATION_DARWIN_DEPENDENCIES Darwin)
|
||||
endif()
|
||||
|
||||
if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND SWIFT_SYNCHRONIZATION_DARWIN_DEPENDENCIES _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ set(glibc)
|
||||
set(musl)
|
||||
|
||||
if(SWIFT_BUILD_SDK_OVERLAY)
|
||||
set(darwin Darwin)
|
||||
set(wincrt_sdk CRT WinSDK)
|
||||
set(glibc Glibc)
|
||||
set(musl Musl)
|
||||
@@ -16,10 +15,8 @@ if((SWIFT_BUILD_CLANG_OVERLAYS
|
||||
OR SWIFT_BUILD_TEST_SUPPORT_MODULES)
|
||||
AND (NOT DEFINED SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT
|
||||
OR NOT SWIFT_BUILD_CLANG_OVERLAYS_SKIP_BUILTIN_FLOAT))
|
||||
# We need to make this dependency explicit because this library
|
||||
# imports Darwin and Darwin re-exports _Builtin_float,
|
||||
# but in most configurations we pull Darwin from the SDK,
|
||||
# meaning we specify no Darwin dependency in the build system
|
||||
# This library imports Darwin from the SDK, which re-exports
|
||||
# _Builtin_float which is part of this build.
|
||||
list(APPEND darwin _Builtin_float)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user