Skip to content

Commit 8ed81ae

Browse files
committed
[stdlib] Adopt availability macros
1 parent 8e154a4 commit 8ed81ae

24 files changed

+57
-57
lines changed

stdlib/public/core/AnyHashable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ extension AnyHashable: CustomReflectable {
262262
}
263263
#endif
264264

265-
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
265+
@available(SwiftStdlib 5.5, *)
266266
extension AnyHashable: _HasCustomAnyHashableRepresentation {
267267
}
268268

stdlib/public/core/Assert.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ internal func _internalInvariant_5_1(
311311
// FIXME: The below won't run the assert on 5.1 stdlib if testing on older
312312
// OSes, which means that testing may not test the assertion. We need a real
313313
// solution to this.
314-
guard #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) else { return }
314+
guard #available(SwiftStdlib 5.1, *) else { return }
315315
_internalInvariant(condition(), message, file: file, line: line)
316316
#endif
317317
}

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public protocol _ObjectiveCBridgeable {
8888
// Note: This function is not intended to be called from Swift. The
8989
// availability information here is perfunctory; this function isn't considered
9090
// part of the Stdlib's Swift ABI.
91-
@available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *)
91+
@available(SwiftStdlib 5.2, *)
9292
@_cdecl("_SwiftCreateBridgedArray")
9393
@usableFromInline
9494
internal func _SwiftCreateBridgedArray_DoNotCall(
@@ -103,7 +103,7 @@ internal func _SwiftCreateBridgedArray_DoNotCall(
103103
// Note: This function is not intended to be called from Swift. The
104104
// availability information here is perfunctory; this function isn't considered
105105
// part of the Stdlib's Swift ABI.
106-
@available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *)
106+
@available(SwiftStdlib 5.2, *)
107107
@_cdecl("_SwiftCreateBridgedMutableArray")
108108
@usableFromInline
109109
internal func _SwiftCreateBridgedMutableArray_DoNotCall(

stdlib/public/core/CTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public typealias CLongLong = Int64
5858

5959
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
6060
/// The C '_Float16' type.
61-
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
61+
@available(SwiftStdlib 5.3, *)
6262
public typealias CFloat16 = Float16
6363
#endif
6464

stdlib/public/core/Codable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4732,7 +4732,7 @@ extension RawRepresentable where RawValue == Float, Self: Decodable {
47324732
}
47334733

47344734
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
4735-
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
4735+
@available(SwiftStdlib 5.3, *)
47364736
extension Float16: Codable {
47374737
/// Creates a new instance by decoding from the given decoder.
47384738
///

stdlib/public/core/CollectionDifference.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/// A collection of insertions and removals that describe the difference
1414
/// between two ordered collection states.
15-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
15+
@available(SwiftStdlib 5.1, *)
1616
public struct CollectionDifference<ChangeElement> {
1717
/// A single change to a collection.
1818
@frozen
@@ -233,7 +233,7 @@ public struct CollectionDifference<ChangeElement> {
233233
/// }
234234
/// }
235235
/// ```
236-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
236+
@available(SwiftStdlib 5.1, *)
237237
extension CollectionDifference: Collection {
238238
public typealias Element = Change
239239

@@ -281,7 +281,7 @@ extension CollectionDifference: Collection {
281281
}
282282
}
283283

284-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
284+
@available(SwiftStdlib 5.1, *)
285285
extension CollectionDifference.Index: Equatable {
286286
@inlinable
287287
public static func == (
@@ -292,7 +292,7 @@ extension CollectionDifference.Index: Equatable {
292292
}
293293
}
294294

295-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
295+
@available(SwiftStdlib 5.1, *)
296296
extension CollectionDifference.Index: Comparable {
297297
@inlinable
298298
public static func < (
@@ -303,27 +303,27 @@ extension CollectionDifference.Index: Comparable {
303303
}
304304
}
305305

306-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
306+
@available(SwiftStdlib 5.1, *)
307307
extension CollectionDifference.Index: Hashable {
308308
@inlinable
309309
public func hash(into hasher: inout Hasher) {
310310
hasher.combine(_offset)
311311
}
312312
}
313313

314-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
314+
@available(SwiftStdlib 5.1, *)
315315
extension CollectionDifference.Change: Equatable where ChangeElement: Equatable {}
316316

317-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
317+
@available(SwiftStdlib 5.1, *)
318318
extension CollectionDifference: Equatable where ChangeElement: Equatable {}
319319

320-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
320+
@available(SwiftStdlib 5.1, *)
321321
extension CollectionDifference.Change: Hashable where ChangeElement: Hashable {}
322322

323-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
323+
@available(SwiftStdlib 5.1, *)
324324
extension CollectionDifference: Hashable where ChangeElement: Hashable {}
325325

326-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
326+
@available(SwiftStdlib 5.1, *)
327327
extension CollectionDifference where ChangeElement: Hashable {
328328
/// Returns a new collection difference with associations between individual
329329
/// elements that have been removed and inserted only once.
@@ -380,7 +380,7 @@ extension CollectionDifference where ChangeElement: Hashable {
380380
}
381381
}
382382

383-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
383+
@available(SwiftStdlib 5.1, *)
384384
extension CollectionDifference.Change: Codable where ChangeElement: Codable {
385385
private enum _CodingKeys: String, CodingKey {
386386
case offset
@@ -417,12 +417,12 @@ extension CollectionDifference.Change: Codable where ChangeElement: Codable {
417417
}
418418
}
419419

420-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
420+
@available(SwiftStdlib 5.1, *)
421421
extension CollectionDifference: Codable where ChangeElement: Codable {}
422422

423-
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
423+
@available(SwiftStdlib 5.1, *)
424424
extension CollectionDifference: Sendable where ChangeElement: Sendable { }
425-
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
425+
@available(SwiftStdlib 5.1, *)
426426
extension CollectionDifference.Change: Sendable where ChangeElement: Sendable { }
427-
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
427+
@available(SwiftStdlib 5.1, *)
428428
extension CollectionDifference.Index: Sendable where ChangeElement: Sendable { }

stdlib/public/core/Diffing.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// MARK: Diff application to RangeReplaceableCollection
1414

15-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
15+
@available(SwiftStdlib 5.1, *)
1616
extension CollectionDifference {
1717
fileprivate func _fastEnumeratedApply(
1818
_ consume: (Change) throws -> Void
@@ -67,7 +67,7 @@ extension RangeReplaceableCollection {
6767
///
6868
/// - Complexity: O(*n* + *c*), where *n* is `self.count` and *c* is the
6969
/// number of changes contained by the parameter.
70-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
70+
@available(SwiftStdlib 5.1, *)
7171
public func applying(_ difference: CollectionDifference<Element>) -> Self? {
7272

7373
func append(
@@ -142,7 +142,7 @@ extension BidirectionalCollection {
142142
/// - Complexity: Worst case performance is O(*n* * *m*), where *n* is the
143143
/// count of this collection and *m* is `other.count`. You can expect
144144
/// faster execution when the collections share many common elements.
145-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
145+
@available(SwiftStdlib 5.1, *)
146146
public func difference<C: BidirectionalCollection>(
147147
from other: C,
148148
by areEquivalent: (C.Element, Element) -> Bool
@@ -169,7 +169,7 @@ extension BidirectionalCollection where Element: Equatable {
169169
/// count of this collection and *m* is `other.count`. You can expect
170170
/// faster execution when the collections share many common elements, or
171171
/// if `Element` conforms to `Hashable`.
172-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
172+
@available(SwiftStdlib 5.1, *)
173173
public func difference<C: BidirectionalCollection>(
174174
from other: C
175175
) -> CollectionDifference<Element> where C.Element == Self.Element {
@@ -224,7 +224,7 @@ private struct _V {
224224
}
225225
}
226226

227-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
227+
@available(SwiftStdlib 5.1, *)
228228
private func _myers<C,D>(
229229
from old: C, to new: D,
230230
using cmp: (C.Element, D.Element) -> Bool

stdlib/public/core/FloatingPoint.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ extension BinaryFloatingPoint {
18951895
switch (Source.exponentBitCount, Source.significandBitCount) {
18961896
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
18971897
case (5, 10):
1898-
guard #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) else {
1898+
guard #available(SwiftStdlib 5.3, *) else {
18991899
// Convert signaling NaN to quiet NaN by multiplying by 1.
19001900
self = Self._convert(from: value).value * 1
19011901
break

stdlib/public/core/FloatingPointParsing.swift.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal func _isspace_clocale(_ u: UTF16.CodeUnit) -> Bool {
4747
% end
4848

4949
%if bits == 16:
50-
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
50+
@available(SwiftStdlib 5.3, *)
5151
%end
5252
extension ${Self}: LosslessStringConvertible {
5353
/// Creates a new instance from the given string.
@@ -165,7 +165,7 @@ extension ${Self}: LosslessStringConvertible {
165165
%if bits == 16:
166166
self.init(Substring(text))
167167
%else:
168-
if #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) {
168+
if #available(SwiftStdlib 5.3, *) {
169169
self.init(Substring(text))
170170
} else {
171171
self = 0.0
@@ -195,7 +195,7 @@ extension ${Self}: LosslessStringConvertible {
195195
// In particular, we still have to export
196196
// _swift_stdlib_strtoXYZ_clocale()
197197
// as ABI to support old compiled code that still requires it.
198-
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
198+
@available(SwiftStdlib 5.3, *)
199199
public init?(_ text: Substring) {
200200
self = 0.0
201201
let success = withUnsafeMutablePointer(to: &self) { p -> Bool in

stdlib/public/core/FloatingPointTypes.swift.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ RawSignificand = 'UInt' + str(SignificandSize)
4040

4141
def Availability(bits):
4242
if bits == 16:
43-
return '@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)'
43+
return '@available(SwiftStdlib 5.3, *)'
4444
return ''
4545

4646
if Self == 'Float16':
@@ -1366,7 +1366,7 @@ internal struct _${Self}AnyHashableBox: _AnyHashableBox {
13661366
${SelfDocComment}
13671367
@frozen
13681368
% if bits == 16:
1369-
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)
1369+
@available(SwiftStdlib 5.3, *)
13701370
@available(macOS, unavailable)
13711371
@available(macCatalyst, unavailable)
13721372
% else:
@@ -1385,7 +1385,7 @@ public struct ${Self} {
13851385
// from the implicit conformance emitted into the generated .swiftinterface
13861386
// file. See https://github.com/apple/swift/pull/36669 for details.
13871387
// FIXME: rdar://76092800
1388-
@available(macOS 11, iOS 14, tvOS 14, watchOS 7, *)
1388+
@available(SwiftStdlib 5.3, *)
13891389
@available(macOS, unavailable)
13901390
@available(macCatalyst, unavailable)
13911391
extension ${Self}: Sendable { }

0 commit comments

Comments
 (0)