Skip to content

Commit ace7a9f

Browse files
committed
Use a function instead of a closure
1 parent ff0833c commit ace7a9f

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

Sources/Testing/ABI/EntryPoints/Library.swift

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,7 @@ private let testingLibraryDiscoverableEntryPoint: Library.Record.EntryPoint = {
155155
}
156156
}
157157

158-
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
159-
@_section("__DATA_CONST,__swift5_tests")
160-
#elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android) || os(WASI)
161-
@_section("swift5_tests")
162-
#elseif os(Windows)
163-
@_section(".sw5test$B")
164-
#else
165-
@__testing(warning: "Platform-specific implementation missing: test content section name unavailable")
166-
#endif
167-
@_used
168-
private let testingLibraryRecord: __TestContentRecord = (
169-
0x6D61696E, /* 'main' */
170-
0,
171-
{ outValue, type, hint, _ in
158+
private func testingLibraryDiscoverableAccessor(_ outValue: UnsafeMutableRawPointer, _ type: UnsafeRawPointer, _ hint: UnsafeRawPointer?, _ reserved: UInt) -> CBool {
172159
return false
173160
// #if !hasFeature(Embedded)
174161
// guard type.load(as: Any.Type.self) == Library.Record.self else {
@@ -194,7 +181,22 @@ private let testingLibraryRecord: __TestContentRecord = (
194181
// )
195182
// }
196183
// return true
197-
},
184+
}
185+
186+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
187+
@_section("__DATA_CONST,__swift5_tests")
188+
#elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android) || os(WASI)
189+
@_section("swift5_tests")
190+
#elseif os(Windows)
191+
@_section(".sw5test$B")
192+
#else
193+
@__testing(warning: "Platform-specific implementation missing: test content section name unavailable")
194+
#endif
195+
@_used
196+
private let testingLibraryRecord: __TestContentRecord = (
197+
0x6D61696E, /* 'main' */
198+
0,
199+
testingLibraryDiscoverableAccessor,
198200
0,
199201
0
200202
)

0 commit comments

Comments
 (0)