Skip to content

Commit c8778cf

Browse files
committed
Remove some workarounds
Remove conditional compilation statements put in place to work around a mismatch in the compiler version used by the Windows CI.
1 parent 8180dd1 commit c8778cf

File tree

4 files changed

+4
-45
lines changed

4 files changed

+4
-45
lines changed

Package.swift

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,6 @@ let package = Package(
141141
swiftSettings: [
142142
.enableExperimentalFeature("VariadicGenerics"),
143143
.enableExperimentalFeature("LifetimeDependence"),
144-
.enableExperimentalFeature(
145-
"InoutLifetimeDependence",
146-
.when(platforms: [.macOS, .iOS, .watchOS, .tvOS, .linux])
147-
),
148-
.enableExperimentalFeature(
149-
"LifetimeDependenceMutableAccessors",
150-
.when(platforms: [.macOS, .iOS, .watchOS, .tvOS, .linux])
151-
),
152144
.enableExperimentalFeature("AddressableTypes"),
153145
.enableExperimentalFeature("AllowUnsafeAttribute"),
154146
.enableExperimentalFeature("BuiltinModule"),
@@ -167,16 +159,7 @@ let package = Package(
167159
resources: [
168160
.copy("Resources")
169161
],
170-
swiftSettings: [
171-
.enableExperimentalFeature(
172-
"InoutLifetimeDependence",
173-
.when(platforms: [.macOS, .iOS, .watchOS, .tvOS, .linux])
174-
),
175-
.enableExperimentalFeature(
176-
"LifetimeDependenceMutableAccessors",
177-
.when(platforms: [.macOS, .iOS, .watchOS, .tvOS, .linux])
178-
),
179-
] + availabilityMacros + featureSettings + testOnlySwiftSettings
162+
swiftSettings: availabilityMacros + featureSettings + testOnlySwiftSettings
180163
),
181164

182165
// FoundationInternationalization

Sources/FoundationEssentials/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ endif()
7474

7575
if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android)
7676
target_compile_options(FoundationEssentials PRIVATE
77-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -Xcc -Xfrontend -D_GNU_SOURCE>"
78-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend InoutLifetimeDependence>"
79-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend LifetimeDependenceMutableAccessors>")
77+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -Xcc -Xfrontend -D_GNU_SOURCE>")
8078
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
8179
endif()
8280

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,9 +2239,7 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22392239
return _overrideLifetime(span, borrowing: self)
22402240
}
22412241
}
2242-
#endif
22432242

2244-
#if compiler(>=5.9) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
22452243
@available(FoundationSpan 6.2, *)
22462244
public var mutableBytes: MutableRawSpan {
22472245
@lifetime(&self)
@@ -2301,7 +2299,7 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
23012299
#endif
23022300
}
23032301
}
2304-
#endif // $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
2302+
#endif // compiler(>=6.2) && $LifetimeDependence
23052303

23062304
@_alwaysEmitIntoClient
23072305
public func withContiguousStorageIfAvailable<ResultType>(_ body: (_ buffer: UnsafeBufferPointer<UInt8>) throws -> ResultType) rethrows -> ResultType? {
@@ -3008,9 +3006,7 @@ internal func _overrideLifetime<
30083006
) -> T {
30093007
dependent
30103008
}
3011-
#endif
30123009

3013-
#if compiler(>=5.9) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
30143010
/// Unsafely discard any lifetime dependency on the `dependent` argument.
30153011
/// Return a value identical to `dependent` with a lifetime dependency
30163012
/// on the caller's exclusive borrow scope of the `source` argument.
@@ -3027,4 +3023,4 @@ internal func _overrideLifetime<
30273023
) -> T {
30283024
dependent
30293025
}
3030-
#endif // $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
3026+
#endif // compiler(>=6.2) && $LifetimeDependence

Tests/FoundationEssentialsTests/DataTests.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,6 @@ class DataTests : XCTestCase {
16371637
func test_InlineDataSpan() throws {
16381638
guard #available(FoundationSpan 6.2, *) else { throw XCTSkip("Span not available") }
16391639

1640-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16411640
var source = Data()
16421641
var span = source.span
16431642
XCTAssertTrue(span.isEmpty)
@@ -1647,18 +1646,15 @@ class DataTests : XCTestCase {
16471646
XCTAssertFalse(span.isEmpty)
16481647
XCTAssertEqual(span.count, source.count)
16491648
XCTAssertEqual(span[0], 1)
1650-
#endif
16511649
}
16521650

16531651
func test_InlineSliceDataSpan() throws {
16541652
guard #available(FoundationSpan 6.2, *) else { throw XCTSkip("Span not available") }
16551653

1656-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16571654
let source = Data(0 ... .max)
16581655
let span = source.span
16591656
XCTAssertEqual(span.count, source.count)
16601657
XCTAssertEqual(span[span.indices.last!], .max)
1661-
#endif
16621658
}
16631659

16641660
func test_LargeSliceDataSpan() throws {
@@ -1672,19 +1668,16 @@ class DataTests : XCTestCase {
16721668
#error("This test needs updating")
16731669
#endif
16741670

1675-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16761671
let source = Data(repeating: 0, count: count).dropFirst()
16771672
XCTAssertNotEqual(source.startIndex, 0)
16781673
let span = source.span
16791674
XCTAssertFalse(span.isEmpty)
1680-
#endif
16811675
}
16821676

16831677
func test_InlineDataMutableSpan() throws {
16841678
guard #available(FoundationSpan 6.2, *) else { throw XCTSkip("Span not available") }
16851679

16861680
#if !canImport(Darwin) || FOUNDATION_FRAMEWORK
1687-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16881681
var source = Data()
16891682
var span = source.mutableSpan
16901683
XCTAssertTrue(span.isEmpty)
@@ -1700,15 +1693,13 @@ class DataTests : XCTestCase {
17001693
var sub = span.extracting(i ..< i+1)
17011694
sub.update(repeating: v)
17021695
XCTAssertEqual(source[i], v)
1703-
#endif
17041696
#endif
17051697
}
17061698

17071699
func test_InlineSliceDataMutableSpan() throws {
17081700
guard #available(FoundationSpan 6.2, *) else { throw XCTSkip("Span not available") }
17091701

17101702
#if !canImport(Darwin) || FOUNDATION_FRAMEWORK
1711-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17121703
var source = Data(0..<100)
17131704
let count = source.count
17141705
var span = source.mutableSpan
@@ -1717,7 +1708,6 @@ class DataTests : XCTestCase {
17171708
var sub = span.extracting(i..<i+1)
17181709
sub.update(repeating: .max)
17191710
XCTAssertEqual(source[i], .max)
1720-
#endif
17211711
#endif
17221712
}
17231713

@@ -1733,7 +1723,6 @@ class DataTests : XCTestCase {
17331723
#endif
17341724

17351725
#if !canImport(Darwin) || FOUNDATION_FRAMEWORK
1736-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17371726
var source = Data(repeating: 0, count: count).dropFirst()
17381727
XCTAssertNotEqual(source.startIndex, 0)
17391728
count = source.count
@@ -1743,14 +1732,12 @@ class DataTests : XCTestCase {
17431732
span[i] = .max
17441733
XCTAssertEqual(source[i], 0)
17451734
XCTAssertEqual(source[i+1], .max)
1746-
#endif
17471735
#endif
17481736
}
17491737

17501738
func test_InlineDataMutableRawSpan() throws {
17511739
guard #available(FoundationSpan 6.2, *) else { throw XCTSkip("Span not available") }
17521740

1753-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17541741
var source = Data()
17551742
var span = source.mutableBytes
17561743
XCTAssertTrue(span.isEmpty)
@@ -1765,21 +1752,18 @@ class DataTests : XCTestCase {
17651752
var sub = span.extracting(i..<i+1)
17661753
sub.storeBytes(of: v, as: UInt8.self)
17671754
XCTAssertEqual(source[i], v)
1768-
#endif
17691755
}
17701756

17711757
func test_InlineSliceDataMutableRawSpan() throws {
17721758
guard #available(FoundationSpan 6.2, *) else { throw XCTSkip("Span not available") }
17731759

1774-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17751760
var source = Data(0..<100)
17761761
let count = source.count
17771762
var span = source.mutableBytes
17781763
XCTAssertEqual(span.byteCount, count)
17791764
let i = try XCTUnwrap(span.byteOffsets.randomElement())
17801765
span.storeBytes(of: -1, toByteOffset: i, as: Int8.self)
17811766
XCTAssertEqual(source[i], .max)
1782-
#endif
17831767
}
17841768

17851769
func test_LargeSliceDataMutableRawSpan() throws {
@@ -1793,7 +1777,6 @@ class DataTests : XCTestCase {
17931777
#error("This test needs updating")
17941778
#endif
17951779

1796-
#if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17971780
var source = Data(repeating: 0, count: count).dropFirst()
17981781
XCTAssertNotEqual(source.startIndex, 0)
17991782
count = source.count
@@ -1803,7 +1786,6 @@ class DataTests : XCTestCase {
18031786
span.storeBytes(of: -1, toByteOffset: i, as: Int8.self)
18041787
XCTAssertEqual(source[i], 0)
18051788
XCTAssertEqual(source[i+1], .max)
1806-
#endif
18071789
}
18081790

18091791
#if false // FIXME: XCTest doesn't support crash tests yet rdar://20195010&22387653

0 commit comments

Comments
 (0)