Skip to content

Commit 42ca1b1

Browse files
committed
Rename SwiftStdlibCurrentOS to StdlibDeploymentTarget.
`StdlibDeploymentTarget` seems to be a better name. rdar://152498657
1 parent d5ed335 commit 42ca1b1

26 files changed

+228
-229
lines changed

Runtimes/Core/cmake/modules/AvailabilityMacros.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ foreach(def ${availability_defs})
77
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -define-availability -Xfrontend \"${def}\">")
88

99
if("${def}" MATCHES "SwiftStdlib .*")
10-
# For each SwiftStdlib x.y, also define SwiftStdlibCurrentOS x.y, which,
10+
# For each SwiftStdlib x.y, also define StdlibDeploymentTarget x.y, which,
1111
# will expand to the current `-target` platform if the macro defines a
1212
# newer platform as its availability.
1313
#
1414
# There is a setting, SwiftCore_ENABLE_STRICT_AVAILABILITY, which if set
1515
# ON will cause us to use the "proper" availability instead.
16-
string(REPLACE "SwiftStdlib" "SwiftStdlibCurrentOS" current "${def}")
16+
string(REPLACE "SwiftStdlib" "StdlibDeploymentTarget" current "${def}")
1717
if(NOT SwiftCore_ENABLE_STRICT_AVAILABILITY AND SwiftCore_SWIFT_AVAILABILITY_PLATFORM)
1818
if("${SwiftCore_SWIFT_AVAILABILITY_PLATFORM}" STREQUAL "macOS" AND "${SwiftCore_VARIANT_AVAILABILITY_PLATFORM}" STREQUAL "iOS")
1919
string(REGEX MATCH "iOS ([0-9]+(\.[0-9]+)+)" ios_platform_version "${def}")

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,13 @@ function(add_swift_target_library_single target name)
10051005
list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS "-Xfrontend" "-define-availability" "-Xfrontend" "${def}")
10061006

10071007
if("${def}" MATCHES "SwiftStdlib .*")
1008-
# For each SwiftStdlib x.y, also define SwiftStdlibCurrentOS x.y, which,
1008+
# For each SwiftStdlib x.y, also define StdlibDeploymentTarget x.y, which,
10091009
# will expand to the current `-target` platform if the macro defines a
10101010
# newer platform as its availability.
10111011
#
10121012
# There is a setting, SWIFT_STDLIB_ENABLE_STRICT_AVAILABILITY, which if set
10131013
# ON will cause us to use the "proper" availability instead.
1014-
string(REPLACE "SwiftStdlib" "SwiftStdlibCurrentOS" current "${def}")
1014+
string(REPLACE "SwiftStdlib" "StdlibDeploymentTarget" current "${def}")
10151015
if(NOT SWIFT_STDLIB_ENABLE_STRICT_AVAILABILITY AND SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_AVAILABILITY_NAME)
10161016
if(SWIFTLIB_SINGLE_SDK STREQUAL "OSX" AND SWIFTLIB_SINGLE_MACCATALYST_BUILD_FLAVOR STREQUAL "ios-like")
10171017
string(REGEX MATCH "iOS ([0-9]+(\.[0-9]+)+)" platform_version "${def}")

stdlib/public/Concurrency/CFExecutor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum CoreFoundation {
4343

4444
// .. Main Executor ............................................................
4545

46-
@available(SwiftStdlibCurrentOS 6.2, *)
46+
@available(StdlibDeploymentTarget 6.2, *)
4747
public final class CFMainExecutor: DispatchMainExecutor, @unchecked Sendable {
4848

4949
override public func run() throws {
@@ -58,7 +58,7 @@ public final class CFMainExecutor: DispatchMainExecutor, @unchecked Sendable {
5858

5959
// .. Task Executor ............................................................
6060

61-
@available(SwiftStdlibCurrentOS 6.2, *)
61+
@available(StdlibDeploymentTarget 6.2, *)
6262
public final class CFTaskExecutor: DispatchGlobalTaskExecutor,
6363
@unchecked Sendable {
6464

stdlib/public/Concurrency/Clock.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Swift
3030
///
3131
/// For more information about specific clocks see `ContinuousClock` and
3232
/// `SuspendingClock`.
33-
@available(SwiftStdlibCurrentOS 5.7, *)
33+
@available(StdlibDeploymentTarget 5.7, *)
3434
public protocol Clock<Duration>: Sendable {
3535
associatedtype Duration
3636
associatedtype Instant: InstantProtocol where Instant.Duration == Duration
@@ -43,7 +43,7 @@ public protocol Clock<Duration>: Sendable {
4343
#endif
4444

4545
/// The traits associated with this clock instance.
46-
@available(SwiftStdlibCurrentOS 6.2, *)
46+
@available(StdlibDeploymentTarget 6.2, *)
4747
var traits: ClockTraits { get }
4848

4949
/// Convert a Clock-specific Duration to a Swift Duration
@@ -59,7 +59,7 @@ public protocol Clock<Duration>: Sendable {
5959
///
6060
/// Returns: A `Swift.Duration` representing the equivalent duration, or
6161
/// `nil` if this function is not supported.
62-
@available(SwiftStdlibCurrentOS 6.2, *)
62+
@available(StdlibDeploymentTarget 6.2, *)
6363
func convert(from duration: Duration) -> Swift.Duration?
6464

6565
/// Convert a Swift Duration to a Clock-specific Duration
@@ -70,7 +70,7 @@ public protocol Clock<Duration>: Sendable {
7070
///
7171
/// Returns: A `Duration` representing the equivalent duration, or
7272
/// `nil` if this function is not supported.
73-
@available(SwiftStdlibCurrentOS 6.2, *)
73+
@available(StdlibDeploymentTarget 6.2, *)
7474
func convert(from duration: Swift.Duration) -> Duration?
7575

7676
/// Convert an `Instant` from some other clock's `Instant`
@@ -82,20 +82,20 @@ public protocol Clock<Duration>: Sendable {
8282
///
8383
/// Returns: An `Instant` representing the equivalent instant, or
8484
/// `nil` if this function is not supported.
85-
@available(SwiftStdlibCurrentOS 6.2, *)
85+
@available(StdlibDeploymentTarget 6.2, *)
8686
func convert<OtherClock: Clock>(instant: OtherClock.Instant,
8787
from clock: OtherClock) -> Instant?
8888
}
8989

90-
@available(SwiftStdlibCurrentOS 5.7, *)
90+
@available(StdlibDeploymentTarget 5.7, *)
9191
extension Clock {
9292
/// Measure the elapsed time to execute a closure.
9393
///
9494
/// let clock = ContinuousClock()
9595
/// let elapsed = clock.measure {
9696
/// someWork()
9797
/// }
98-
@available(SwiftStdlibCurrentOS 5.7, *)
98+
@available(StdlibDeploymentTarget 5.7, *)
9999
public func measure(_ work: () throws -> Void) rethrows -> Instant.Duration {
100100
let start = now
101101
try work()
@@ -109,7 +109,7 @@ extension Clock {
109109
/// let elapsed = await clock.measure {
110110
/// await someWork()
111111
/// }
112-
@available(SwiftStdlibCurrentOS 5.7, *)
112+
@available(StdlibDeploymentTarget 5.7, *)
113113
@_alwaysEmitIntoClient
114114
public func measure(
115115
isolation: isolated (any Actor)? = #isolation,
@@ -127,7 +127,7 @@ extension Clock {
127127
//
128128
// This function also doubles as an ABI-compatibility shim predating the
129129
// introduction of #isolation.
130-
@available(SwiftStdlibCurrentOS 5.7, *)
130+
@available(StdlibDeploymentTarget 5.7, *)
131131
@_silgen_name("$ss5ClockPsE7measurey8DurationQzyyYaKXEYaKF")
132132
@_unsafeInheritExecutor // for ABI compatibility
133133
public func _unsafeInheritExecutor_measure(
@@ -140,7 +140,7 @@ extension Clock {
140140
}
141141
}
142142

143-
@available(SwiftStdlibCurrentOS 6.2, *)
143+
@available(StdlibDeploymentTarget 6.2, *)
144144
extension Clock {
145145
// For compatibility, return `nil` if this is not implemented
146146
public func convert(from duration: Duration) -> Swift.Duration? {
@@ -171,21 +171,21 @@ extension Clock {
171171
}
172172
}
173173

174-
@available(SwiftStdlibCurrentOS 6.2, *)
174+
@available(StdlibDeploymentTarget 6.2, *)
175175
extension Clock where Duration == Swift.Duration {
176176
public func convert(from duration: Duration) -> Duration? {
177177
return duration
178178
}
179179
}
180180

181181
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
182-
@available(SwiftStdlibCurrentOS 5.7, *)
182+
@available(StdlibDeploymentTarget 5.7, *)
183183
extension Clock {
184184
/// Suspends for the given duration.
185185
///
186186
/// Prefer to use the `sleep(until:tolerance:)` method on `Clock` if you have
187187
/// access to an absolute instant.
188-
@available(SwiftStdlibCurrentOS 5.7, *)
188+
@available(StdlibDeploymentTarget 5.7, *)
189189
@_alwaysEmitIntoClient
190190
public func sleep(
191191
for duration: Instant.Duration,
@@ -207,7 +207,7 @@ extension Clock {
207207
/// clocks best matches the clock that the user is trying to specify a
208208
/// time or delay in. Executors are expected to do this on a best effort
209209
/// basis.
210-
@available(SwiftStdlibCurrentOS 6.2, *)
210+
@available(StdlibDeploymentTarget 6.2, *)
211211
public struct ClockTraits: OptionSet {
212212
public let rawValue: UInt32
213213

@@ -225,10 +225,10 @@ public struct ClockTraits: OptionSet {
225225
public static let wallTime = ClockTraits(rawValue: 1 << 2)
226226
}
227227

228-
@available(SwiftStdlibCurrentOS 6.2, *)
228+
@available(StdlibDeploymentTarget 6.2, *)
229229
extension Clock {
230230
/// The traits associated with this clock instance.
231-
@available(SwiftStdlibCurrentOS 6.2, *)
231+
@available(StdlibDeploymentTarget 6.2, *)
232232
public var traits: ClockTraits {
233233
return []
234234
}
@@ -239,21 +239,21 @@ enum _ClockID: Int32 {
239239
case suspending = 2
240240
}
241241

242-
@available(SwiftStdlibCurrentOS 5.7, *)
242+
@available(StdlibDeploymentTarget 5.7, *)
243243
@_silgen_name("swift_get_time")
244244
internal func _getTime(
245245
seconds: UnsafeMutablePointer<Int64>,
246246
nanoseconds: UnsafeMutablePointer<Int64>,
247247
clock: CInt)
248248

249-
@available(SwiftStdlibCurrentOS 5.7, *)
249+
@available(StdlibDeploymentTarget 5.7, *)
250250
@_silgen_name("swift_get_clock_res")
251251
internal func _getClockRes(
252252
seconds: UnsafeMutablePointer<Int64>,
253253
nanoseconds: UnsafeMutablePointer<Int64>,
254254
clock: CInt)
255255

256-
@available(SwiftStdlibCurrentOS 6.2, *)
256+
@available(StdlibDeploymentTarget 6.2, *)
257257
@_silgen_name("swift_sleep")
258258
internal func _sleep(
259259
seconds: Int64,

stdlib/public/Concurrency/ContinuousClock.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Swift
2020
/// only comparable locally during the execution of a program.
2121
///
2222
/// This clock is suitable for high resolution measurements of execution.
23-
@available(SwiftStdlibCurrentOS 5.7, *)
23+
@available(StdlibDeploymentTarget 5.7, *)
2424
@_unavailableInEmbedded
2525
public struct ContinuousClock: Sendable {
2626
/// A continuous point in time used for `ContinuousClock`.
@@ -36,12 +36,12 @@ public struct ContinuousClock: Sendable {
3636
}
3737

3838
#if !$Embedded
39-
@available(SwiftStdlibCurrentOS 5.7, *)
39+
@available(StdlibDeploymentTarget 5.7, *)
4040
extension ContinuousClock.Instant: Codable {
4141
}
4242
#endif
4343

44-
@available(SwiftStdlibCurrentOS 5.7, *)
44+
@available(StdlibDeploymentTarget 5.7, *)
4545
extension Duration {
4646
internal init(_seconds s: Int64, nanoseconds n: Int64) {
4747
let (secHi, secLo) = s.multipliedFullWidth(by: 1_000_000_000_000_000_000)
@@ -56,19 +56,19 @@ extension Duration {
5656
}
5757
}
5858

59-
@available(SwiftStdlibCurrentOS 5.7, *)
59+
@available(StdlibDeploymentTarget 5.7, *)
6060
@_unavailableInEmbedded
6161
extension Clock where Self == ContinuousClock {
6262
/// A clock that measures time that always increments but does not stop
6363
/// incrementing while the system is asleep.
6464
///
6565
/// try await Task.sleep(until: .now + .seconds(3), clock: .continuous)
6666
///
67-
@available(SwiftStdlibCurrentOS 5.7, *)
67+
@available(StdlibDeploymentTarget 5.7, *)
6868
public static var continuous: ContinuousClock { return ContinuousClock() }
6969
}
7070

71-
@available(SwiftStdlibCurrentOS 5.7, *)
71+
@available(StdlibDeploymentTarget 5.7, *)
7272
@_unavailableInEmbedded
7373
extension ContinuousClock: Clock {
7474
/// The current continuous instant.
@@ -101,7 +101,7 @@ extension ContinuousClock: Clock {
101101
}
102102

103103
/// The continuous clock is continuous and monotonic
104-
@available(SwiftStdlibCurrentOS 6.2, *)
104+
@available(StdlibDeploymentTarget 6.2, *)
105105
public var traits: ClockTraits {
106106
return [.continuous, .monotonic]
107107
}
@@ -119,7 +119,7 @@ extension ContinuousClock: Clock {
119119
public func sleep(
120120
until deadline: Instant, tolerance: Swift.Duration? = nil
121121
) async throws {
122-
if #available(SwiftStdlibCurrentOS 6.2, *) {
122+
if #available(StdlibDeploymentTarget 6.2, *) {
123123
try await Task._sleep(until: deadline,
124124
tolerance: tolerance,
125125
clock: self)
@@ -128,7 +128,7 @@ extension ContinuousClock: Clock {
128128
}
129129
}
130130
#else
131-
@available(SwiftStdlibCurrentOS 5.7, *)
131+
@available(StdlibDeploymentTarget 5.7, *)
132132
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
133133
public func sleep(
134134
until deadline: Instant, tolerance: Swift.Duration? = nil
@@ -138,7 +138,7 @@ extension ContinuousClock: Clock {
138138
#endif
139139
}
140140

141-
@available(SwiftStdlibCurrentOS 5.7, *)
141+
@available(StdlibDeploymentTarget 5.7, *)
142142
@_unavailableInEmbedded
143143
extension ContinuousClock {
144144
@available(SwiftStdlib 5.7, *)

stdlib/public/Concurrency/CooperativeExecutor.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Swift
1717
// Store the Timestamp in the executor private data, if it will fit; otherwise,
1818
// use the allocator to allocate space for it and stash a pointer in the private
1919
// data area.
20-
@available(SwiftStdlibCurrentOS 6.2, *)
20+
@available(StdlibDeploymentTarget 6.2, *)
2121
extension ExecutorJob {
2222
fileprivate var cooperativeExecutorTimestampIsIndirect: Bool {
2323
return MemoryLayout<(Int, Int)>.size
@@ -99,7 +99,7 @@ extension ExecutorJob {
9999

100100
/// A co-operative executor that can be used as the main executor or as a
101101
/// task executor.
102-
@available(SwiftStdlibCurrentOS 6.2, *)
102+
@available(StdlibDeploymentTarget 6.2, *)
103103
class CooperativeExecutor: Executor, @unchecked Sendable {
104104
var runQueue: PriorityQueue<UnownedJob>
105105
var waitQueue: PriorityQueue<UnownedJob>
@@ -179,7 +179,7 @@ class CooperativeExecutor: Executor, @unchecked Sendable {
179179
public var asSchedulable: any SchedulableExecutor { self }
180180
}
181181

182-
@available(SwiftStdlibCurrentOS 6.2, *)
182+
@available(StdlibDeploymentTarget 6.2, *)
183183
extension CooperativeExecutor: SchedulableExecutor {
184184
var currentTime: Timestamp {
185185
var now: Timestamp = .zero
@@ -202,7 +202,7 @@ extension CooperativeExecutor: SchedulableExecutor {
202202
}
203203
}
204204

205-
@available(SwiftStdlibCurrentOS 6.2, *)
205+
@available(StdlibDeploymentTarget 6.2, *)
206206
extension CooperativeExecutor: RunLoopExecutor {
207207
public func run() throws {
208208
try runUntil { false }
@@ -249,13 +249,13 @@ extension CooperativeExecutor: RunLoopExecutor {
249249
}
250250
}
251251

252-
@available(SwiftStdlibCurrentOS 6.2, *)
252+
@available(StdlibDeploymentTarget 6.2, *)
253253
extension CooperativeExecutor: SerialExecutor {}
254254

255-
@available(SwiftStdlibCurrentOS 6.2, *)
255+
@available(StdlibDeploymentTarget 6.2, *)
256256
extension CooperativeExecutor: TaskExecutor {}
257257

258-
@available(SwiftStdlibCurrentOS 6.2, *)
258+
@available(StdlibDeploymentTarget 6.2, *)
259259
extension CooperativeExecutor: MainExecutor {}
260260

261261
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

0 commit comments

Comments
 (0)