Files
swift-mirror/stdlib/public/ClangOverlays/float.swift.gyb
Ian Anderson be413e96b4 [overlay] magic-symbols-for-install-name conflicts with @_originallyDefinedIn
The _Builtin_float interfaces were defined in $@rpath/lib/libswiftDarwin.dylib until macOS 10.14.4 and then in usr/lib/swift/libswiftDarwin.dylib after that. We were trying to use magic-symbols-for-install-name for the first one and @_originallyDefinedIn for the second one. However, @_originallyDefinedIn uses the @available introduced version as the first bound for $ld$previous$ which conflicts with the magic-symbols-for-install-name $ld$install_name$. Eventually @_originallyDefinedIn will need to support multiple install names, but until then just use it as-is and stop using magic-symbols-for-install-name.

Add the missing @_originallyDefinedIn on FLT_RADIX, and match the watchOS/tvOS order between @_originallyDefinedIn and @available.
There was no tvOS 7.0, the first one was 9.0.

rdar://122351557
2024-02-23 23:15:27 -08:00

69 lines
3.6 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 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 _Builtin_float
@available(swift, deprecated: 3.0, message: "Please use 'T.radix' to get the radix of a FloatingPoint type 'T'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
public let FLT_RADIX = Double.radix
%for type, prefix in [('Float', 'FLT'), ('Double', 'DBL'), ('Float80', 'LDBL')]:
% if type == "Float80":
#if !os(Android) && !os(WASI) && !os(Windows) && (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'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
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'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
public let ${prefix}_MAX_EXP = ${type}.greatestFiniteMagnitude.exponent + 1
@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNormalMagnitude.exponent + 1'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
public let ${prefix}_MIN_EXP = ${type}.leastNormalMagnitude.exponent + 1
@available(swift, deprecated: 3.0, message: "Please use '${type}.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
public let ${prefix}_MAX = ${type}.greatestFiniteMagnitude
@available(swift, deprecated: 3.0, message: "Please use '${type}.ulpOfOne' or '.ulpOfOne'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
public let ${prefix}_EPSILON = ${type}.ulpOfOne
@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNormalMagnitude' or '.leastNormalMagnitude'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
public let ${prefix}_MIN = ${type}.leastNormalMagnitude
@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'.")
@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)
@_originallyDefinedIn(module: "Darwin", macOS 9999, iOS 9999, watchOS 9999, tvOS 9999)
public let ${prefix}_TRUE_MIN = ${type}.leastNonzeroMagnitude
% if type == "Float80":
#endif
% end
%end