Skip to content

Commit 6023598

Browse files
authored
Fix 5.9 build (#844)
Motivation: An oversight in 373862a meant that 5.9 wasn't actually dropped which means that the use of 'nonisolated(unsafe)' in 0e715a2 broke users of 5.9. Modifications: - Add back a 5.9 path Result: - Builds on 5.9 - Resolves #843
1 parent 3b265e6 commit 6023598

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: Unit tests
1515
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
1616
with:
17-
linux_5_9_enabled: false
17+
linux_5_9_enabled: true
1818
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -warnings-as-errors"
1919
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -warnings-as-errors"
2020
linux_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -warnings-as-errors"

Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,21 @@ extension String.UTF8View.SubSequence {
216216
}
217217
}
218218

219+
#if compiler(>=5.10)
219220
nonisolated(unsafe) private let posixLocale: UnsafeMutableRawPointer = {
220221
// All POSIX systems must provide a "POSIX" locale, and its date/time formats are US English.
221222
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_05
222223
let _posixLocale = newlocale(LC_TIME_MASK | LC_NUMERIC_MASK, "POSIX", nil)!
223224
return UnsafeMutableRawPointer(_posixLocale)
224225
}()
226+
#else
227+
private let posixLocale: UnsafeMutableRawPointer = {
228+
// All POSIX systems must provide a "POSIX" locale, and its date/time formats are US English.
229+
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_05
230+
let _posixLocale = newlocale(LC_TIME_MASK | LC_NUMERIC_MASK, "POSIX", nil)!
231+
return UnsafeMutableRawPointer(_posixLocale)
232+
}()
233+
#endif
225234

226235
private func parseTimestamp(_ utf8: String.UTF8View.SubSequence, format: String) -> tm? {
227236
var timeComponents = tm()

0 commit comments

Comments
 (0)