Skip to content

Commit b71c1d4

Browse files
authored
Fix duplicated -enable-library-evolution flag (#113)
* Fix duplicated -enable-library-evolution flag * Disable OPENGRAPH_LIBRARY_EVOLUTION for swift test * Fix reserved_runtime_symbol_name warning
1 parent 74d5cae commit b71c1d4

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.github/workflows/compatibility_tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
- name: Swift version
3737
run: swift --version
3838
- name: Run tests against Apple's AttributeGraph on macOS via SwiftPM
39+
env:
40+
OPENGRAPH_LIBRARY_EVOLUTION: 0
3941
run: |
4042
swift test \
4143
--build-path .build-compatibility-test-debug

.github/workflows/macos.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
- name: Swift version
3636
run: swift --version
3737
- name: Build and run tests in debug mode with coverage
38+
env:
39+
OPENGRAPH_LIBRARY_EVOLUTION: 0
3840
run: |
3941
swift test \
4042
-c debug \
@@ -45,6 +47,8 @@ jobs:
4547
.build-test-debug/debug/OpenGraphPackageTests.xctest/Contents/MacOS/OpenGraphPackageTests \
4648
> coverage.txt
4749
- name: Build and run tests in release mode
50+
env:
51+
OPENGRAPH_LIBRARY_EVOLUTION: 0
4852
run: |
4953
swift test \
5054
-c release \

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ var sharedCSettings: [CSetting] = [
3434

3535
var sharedSwiftSettings: [SwiftSetting] = [
3636
.enableUpcomingFeature("InternalImportsByDefault"),
37+
.enableExperimentalFeature("Extern"),
3738
.swiftLanguageMode(.v5),
38-
.unsafeFlags(["-enable-library-evolution"]),
3939
]
4040

4141
// MARK: [env] OPENGRAPH_SWIFT_TOOLCHAIN_PATH
@@ -119,6 +119,7 @@ let libraryEvolutionCondition = envEnable("OPENGRAPH_LIBRARY_EVOLUTION")
119119
#endif
120120

121121
if libraryEvolutionCondition {
122+
// NOTE: -enable-library-evolution is not supported on `swift build` yet.
122123
sharedSwiftSettings.append(.unsafeFlags(["-enable-library-evolution"]))
123124
}
124125

Sources/OpenGraph/Runtime/TupleType.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ extension UnsafeTuple {
7575

7676
// MARK: - UnsafeMutableTuple
7777

78-
@_silgen_name("swift_slowAlloc")
79-
private func slowAlloc(_ size: Int, _ alignMask: Int) -> UnsafeMutableRawPointer
80-
81-
@_silgen_name("swift_slowDealloc")
82-
private func slowDealloc(_ ptr: UnsafeMutableRawPointer, _ size: Int, _ alignMask: Int)
83-
8478
extension UnsafeMutableTuple {
8579
public init(with tupleType: TupleType) {
86-
self.init(type: tupleType, value: slowAlloc(tupleType.size, -1))
80+
self.init(
81+
type: tupleType,
82+
value: UnsafeMutableRawPointer.allocate(
83+
byteCount: tupleType.size,
84+
alignment: -1
85+
)
86+
)
8787
}
8888

8989
public func initialize<T>(at index: Int, to element: T) {
@@ -104,7 +104,7 @@ extension UnsafeMutableTuple {
104104
if initialized {
105105
deinitialize()
106106
}
107-
slowDealloc(value, -1, -1)
107+
value.deallocate()
108108
}
109109

110110
public var count: Int { type.count }

0 commit comments

Comments
 (0)