Skip to content

Commit 0d92bf6

Browse files
authored
Enable strict concurrency (#53)
Motivation: To catch potential data races at build time. Modifications: - Enable strict concurrency in Package.swift. - Add `Sendable` conformance to `StructuredFieldType`. - Swap [concurrency-unsafe](swiftlang/swift#66213) `CommandLine.arguments` for `ProcessInfo.processInfo.arguments`. Result: Strict concurrency adoption.
1 parent 8126775 commit 0d92bf6

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Package.swift

+6
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ let package = Package(
4545
),
4646
]
4747
)
48+
49+
for target in package.targets {
50+
var settings = target.swiftSettings ?? []
51+
settings.append(.enableExperimentalFeature("StrictConcurrency=complete"))
52+
target.swiftSettings = settings
53+
}

Sources/StructuredFieldValues/StructuredFieldValue.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public protocol StructuredFieldValue: Codable {
2222
}
2323

2424
/// The kinds of header fields used in HTTP Structured Headers.
25-
public enum StructuredFieldType {
25+
public enum StructuredFieldType: Sendable {
2626
/// An item field consists of a single item, optionally with parameters.
2727
case item
2828

Sources/sh-parser/main.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ struct Flags {
2121
init() {
2222
// Default to item
2323
self.headerType = .item
24+
let arguments = ProcessInfo.processInfo.arguments
2425

25-
for argument in CommandLine.arguments.dropFirst() {
26+
for argument in arguments.dropFirst() {
2627
switch argument {
2728
case "--dictionary":
2829
self.headerType = .dictionary

0 commit comments

Comments
 (0)