Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit d4f33e7

Browse files
committed
Do not build Demangle on Swift 5.9 or above
Pull request #68 prevents Backtrace from being built on Swift 5.9 and above, but Demangle is still built and fails when the importing project uses musl.
1 parent 525d450 commit d4f33e7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Sources/Backtrace/Demangle.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
// Swift 5.9 has its own built-in backtracing support in the runtime;
16+
// we don't want to activate this library if we're using 5.9 or above.
17+
#if !(swift(>=5.9) && !os(Windows))
18+
1519
#if os(Linux)
1620
import Glibc
1721
#elseif os(Windows)
@@ -55,3 +59,5 @@ internal func _stdlib_demangleName(_ mangledName: String) -> String {
5559
}
5660
}
5761
#endif
62+
63+
#endif

Sources/Sample/main.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
import Backtrace
1616
#if canImport(Darwin)
1717
import Darwin
18-
#elseif os(Linux)
18+
#elseif canImport(Glibc)
1919
import Glibc
20+
#elseif canImport(Musl)
21+
import Musl
2022
#endif
2123

2224
#if swift(<5.9) || os(Windows)

0 commit comments

Comments
 (0)