Skip to content

Commit 00bc32d

Browse files
authored
Merge pull request #15230 from ikesyo/macos-over-osx
[gardening][Overlay] Prefer macOS over OSX for `#available`
2 parents 156a4dc + f956609 commit 00bc32d

File tree

11 files changed

+28
-28
lines changed

11 files changed

+28
-28
lines changed

stdlib/public/SDK/Accelerate/BNNS.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ extension BNNSActivation {
172172
public init(function: BNNSActivationFunction,
173173
alpha: Float = .nan,
174174
beta: Float = .nan) {
175-
if #available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
175+
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
176176
_precondition(function != .integerLinearSaturate,
177177
"This initializer cannot be used with the integerLinearSaturate activation function; use BNNSActivation.integerLinearSaturate(scale:Int32, offset:Int32, shift:Int32) instead.")
178178
_precondition(function != .integerLinearSaturatePerChannel,

stdlib/public/SDK/Dispatch/Dispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public enum DispatchTimeoutResult {
131131

132132
public extension DispatchGroup {
133133
public func notify(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], queue: DispatchQueue, execute work: @escaping @convention(block) () -> Void) {
134-
if #available(OSX 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
134+
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
135135
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
136136
_swift_dispatch_group_notify(self, queue, item._block)
137137
} else {

stdlib/public/SDK/Dispatch/Queue.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public extension DispatchQueue {
3939
if self.contains(.concurrent) {
4040
attr = _swift_dispatch_queue_concurrent()
4141
}
42-
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
42+
if #available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
4343
if self.contains(.initiallyInactive) {
4444
attr = __dispatch_queue_attr_make_initially_inactive(attr)
4545
}
@@ -93,7 +93,7 @@ public extension DispatchQueue {
9393
case never
9494

9595
internal func _attr(attr: __OS_dispatch_queue_attr?) -> __OS_dispatch_queue_attr? {
96-
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
96+
if #available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
9797
switch self {
9898
case .inherit:
9999
// DISPATCH_AUTORELEASE_FREQUENCY_INHERIT
@@ -154,11 +154,11 @@ public extension DispatchQueue {
154154
if autoreleaseFrequency != .inherit {
155155
attr = autoreleaseFrequency._attr(attr: attr)
156156
}
157-
if #available(OSX 10.10, iOS 8.0, *), qos != .unspecified {
157+
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified {
158158
attr = __dispatch_queue_attr_make_with_qos_class(attr, qos.qosClass.rawValue, Int32(qos.relativePriority))
159159
}
160160

161-
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
161+
if #available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
162162
self.init(__label: label, attr: attr, queue: target)
163163
} else {
164164
self.init(__label: label, attr: attr)
@@ -209,7 +209,7 @@ public extension DispatchQueue {
209209
}
210210

211211
var block: @convention(block) () -> Void = work
212-
if #available(OSX 10.10, iOS 8.0, *), (qos != .unspecified || !flags.isEmpty) {
212+
if #available(macOS 10.10, iOS 8.0, *), (qos != .unspecified || !flags.isEmpty) {
213213
let workItem = DispatchWorkItem(qos: qos, flags: flags, block: work)
214214
block = workItem._block
215215
}
@@ -279,7 +279,7 @@ public extension DispatchQueue {
279279
public func sync<T>(flags: DispatchWorkItemFlags, execute work: () throws -> T) rethrows -> T {
280280
if flags == .barrier {
281281
return try self._syncHelper(fn: _syncBarrier, execute: work, rescue: { throw $0 })
282-
} else if #available(OSX 10.10, iOS 8.0, *), !flags.isEmpty {
282+
} else if #available(macOS 10.10, iOS 8.0, *), !flags.isEmpty {
283283
return try self._syncHelper(fn: sync, flags: flags, execute: work, rescue: { throw $0 })
284284
} else {
285285
return try self._syncHelper(fn: sync, execute: work, rescue: { throw $0 })
@@ -292,7 +292,7 @@ public extension DispatchQueue {
292292
flags: DispatchWorkItemFlags = [],
293293
execute work: @escaping @convention(block) () -> Void)
294294
{
295-
if #available(OSX 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
295+
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
296296
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
297297
_swift_dispatch_after(deadline.rawValue, self, item._block)
298298
} else {
@@ -306,7 +306,7 @@ public extension DispatchQueue {
306306
flags: DispatchWorkItemFlags = [],
307307
execute work: @escaping @convention(block) () -> Void)
308308
{
309-
if #available(OSX 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
309+
if #available(macOS 10.10, iOS 8.0, *), qos != .unspecified || !flags.isEmpty {
310310
let item = DispatchWorkItem(qos: qos, flags: flags, block: work)
311311
_swift_dispatch_after(wallDeadline.rawValue, self, item._block)
312312
} else {

stdlib/public/SDK/Dispatch/Source.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public extension DispatchSourceProtocol {
1717
typealias DispatchSourceHandler = @convention(block) () -> Void
1818

1919
public func setEventHandler(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], handler: DispatchSourceHandler?) {
20-
if #available(OSX 10.10, iOS 8.0, *),
20+
if #available(macOS 10.10, iOS 8.0, *),
2121
let h = handler,
2222
qos != .unspecified || !flags.isEmpty {
2323
let item = DispatchWorkItem(qos: qos, flags: flags, block: h)
@@ -33,7 +33,7 @@ public extension DispatchSourceProtocol {
3333
}
3434

3535
public func setCancelHandler(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], handler: DispatchSourceHandler?) {
36-
if #available(OSX 10.10, iOS 8.0, *),
36+
if #available(macOS 10.10, iOS 8.0, *),
3737
let h = handler,
3838
qos != .unspecified || !flags.isEmpty {
3939
let item = DispatchWorkItem(qos: qos, flags: flags, block: h)
@@ -49,7 +49,7 @@ public extension DispatchSourceProtocol {
4949
}
5050

5151
public func setRegistrationHandler(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], handler: DispatchSourceHandler?) {
52-
if #available(OSX 10.10, iOS 8.0, *),
52+
if #available(macOS 10.10, iOS 8.0, *),
5353
let h = handler,
5454
qos != .unspecified || !flags.isEmpty {
5555
let item = DispatchWorkItem(qos: qos, flags: flags, block: h)

stdlib/public/SDK/Foundation/Calendar.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
970970
}
971971

972972
internal static func _toNSCalendarIdentifier(_ identifier : Identifier) -> NSCalendar.Identifier {
973-
if #available(OSX 10.10, iOS 8.0, *) {
973+
if #available(macOS 10.10, iOS 8.0, *) {
974974
let identifierMap : [Identifier : NSCalendar.Identifier] =
975975
[.gregorian : .gregorian,
976976
.buddhist : .buddhist,
@@ -1010,7 +1010,7 @@ public struct Calendar : Hashable, Equatable, ReferenceConvertible, _MutableBoxi
10101010
}
10111011

10121012
internal static func _fromNSCalendarIdentifier(_ identifier : NSCalendar.Identifier) -> Identifier {
1013-
if #available(OSX 10.10, iOS 8.0, *) {
1013+
if #available(macOS 10.10, iOS 8.0, *) {
10141014
let identifierMap : [NSCalendar.Identifier : Identifier] =
10151015
[.gregorian : .gregorian,
10161016
.buddhist : .buddhist,

stdlib/public/SDK/Foundation/CharacterSet.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
517517

518518
/// Returns the character set for characters allowed in a user URL subcomponent.
519519
public static var urlUserAllowed : CharacterSet {
520-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
520+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
521521
return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLUserAllowedCharacterSet() as NSCharacterSet)
522522
} else {
523523
return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLUserAllowedCharacterSet() as! NSCharacterSet)
@@ -526,7 +526,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
526526

527527
/// Returns the character set for characters allowed in a password URL subcomponent.
528528
public static var urlPasswordAllowed : CharacterSet {
529-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
529+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
530530
return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLPasswordAllowedCharacterSet() as NSCharacterSet)
531531
} else {
532532
return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLPasswordAllowedCharacterSet() as! NSCharacterSet)
@@ -535,7 +535,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
535535

536536
/// Returns the character set for characters allowed in a host URL subcomponent.
537537
public static var urlHostAllowed : CharacterSet {
538-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
538+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
539539
return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLHostAllowedCharacterSet() as NSCharacterSet)
540540
} else {
541541
return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLHostAllowedCharacterSet() as! NSCharacterSet)
@@ -544,7 +544,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
544544

545545
/// Returns the character set for characters allowed in a path URL component.
546546
public static var urlPathAllowed : CharacterSet {
547-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
547+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
548548
return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLPathAllowedCharacterSet() as NSCharacterSet)
549549
} else {
550550
return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLPathAllowedCharacterSet() as! NSCharacterSet)
@@ -553,7 +553,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
553553

554554
/// Returns the character set for characters allowed in a query URL component.
555555
public static var urlQueryAllowed : CharacterSet {
556-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
556+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
557557
return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLQueryAllowedCharacterSet() as NSCharacterSet)
558558
} else {
559559
return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLQueryAllowedCharacterSet() as! NSCharacterSet)
@@ -562,7 +562,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
562562

563563
/// Returns the character set for characters allowed in a fragment URL component.
564564
public static var urlFragmentAllowed : CharacterSet {
565-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
565+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
566566
return CharacterSet(_uncopiedImmutableReference: _CFURLComponentsGetURLFragmentAllowedCharacterSet() as NSCharacterSet)
567567
} else {
568568
return CharacterSet(_uncopiedImmutableReference: _NSURLComponentsGetURLFragmentAllowedCharacterSet() as! NSCharacterSet)

stdlib/public/SDK/Foundation/Date.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public struct Date : ReferenceConvertible, Comparable, Equatable {
143143
public static let distantPast = Date(timeIntervalSinceReferenceDate: -63114076800.0)
144144

145145
public var hashValue: Int {
146-
if #available(OSX 10.12, iOS 10.0, *) {
146+
if #available(macOS 10.12, iOS 10.0, *) {
147147
return Int(bitPattern: __CFHashDouble(_time))
148148
} else { // 10.11 and previous behavior fallback; this must allocate a date to reference the hash value and then throw away the reference
149149
return NSDate(timeIntervalSinceReferenceDate: _time).hash

stdlib/public/SDK/Foundation/JSONEncoder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ extension _JSONEncoder {
733733
return NSNumber(value: 1000.0 * date.timeIntervalSince1970)
734734

735735
case .iso8601:
736-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
736+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
737737
return NSString(string: _iso8601Formatter.string(from: date))
738738
} else {
739739
fatalError("ISO8601DateFormatter is unavailable on this platform.")
@@ -2289,7 +2289,7 @@ extension _JSONDecoder {
22892289
return Date(timeIntervalSince1970: double / 1000.0)
22902290

22912291
case .iso8601:
2292-
if #available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
2292+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
22932293
let string = try self.unbox(value, as: String.self)!
22942294
guard let date = _iso8601Formatter.date(from: string) else {
22952295
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: self.codingPath, debugDescription: "Expected date string to be ISO8601-formatted."))

stdlib/public/SDK/Foundation/NSError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public func _getErrorDefaultUserInfo<T: Error>(_ error: T)
205205

206206
// If the OS supports user info value providers, use those
207207
// to lazily populate the user-info dictionary for this domain.
208-
if #available(OSX 10.11, iOS 9.0, tvOS 9.0, watchOS 2.0, *) {
208+
if #available(macOS 10.11, iOS 9.0, tvOS 9.0, watchOS 2.0, *) {
209209
// Note: the Cocoa error domain specifically excluded from
210210
// user-info value providers.
211211
let domain = error._domain

stdlib/public/SDK/Foundation/NSStringAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ extension StringProtocol where Index == String.Index {
16381638
/// Equivalent to `self.rangeOfString(other) != nil`
16391639
public func contains<T : StringProtocol>(_ other: T) -> Bool {
16401640
let r = self.range(of: other) != nil
1641-
if #available(OSX 10.10, iOS 8.0, *) {
1641+
if #available(macOS 10.10, iOS 8.0, *) {
16421642
_sanityCheck(r == _ns.contains(other._ephemeralString))
16431643
}
16441644
return r
@@ -1661,7 +1661,7 @@ extension StringProtocol where Index == String.Index {
16611661
let r = self.range(
16621662
of: other, options: .caseInsensitive, locale: Locale.current
16631663
) != nil
1664-
if #available(OSX 10.10, iOS 8.0, *) {
1664+
if #available(macOS 10.10, iOS 8.0, *) {
16651665
_sanityCheck(r ==
16661666
_ns.localizedCaseInsensitiveContains(other._ephemeralString))
16671667
}

stdlib/public/SDK/Foundation/URLComponents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ extension URLComponents : CustomStringConvertible, CustomDebugStringConvertible,
333333
if let p = self.port { c.append((label: "port", value: p)) }
334334

335335
c.append((label: "path", value: self.path))
336-
if #available(OSX 10.10, iOS 8.0, *) {
336+
if #available(macOS 10.10, iOS 8.0, *) {
337337
if let qi = self.queryItems { c.append((label: "queryItems", value: qi)) }
338338
}
339339
if let f = self.fragment { c.append((label: "fragment", value: f)) }

0 commit comments

Comments
 (0)