Skip to content

Commit 21a2b78

Browse files
authored
stdlib/benchmark: add canImport(Musl) where needed (#67120)
This allows compiling stdlib and benchmarks when targeting musl instead of Glibc.
1 parent 39a837c commit 21a2b78

File tree

18 files changed

+47
-8
lines changed

18 files changed

+47
-8
lines changed

benchmark/single-source/CString.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
#if os(Linux)
14+
#if canImport(Glibc)
1515
import Glibc
16+
#elseif canImport(Musl)
17+
import Musl
1618
#elseif os(Windows)
1719
import MSVCRT
1820
#else

benchmark/single-source/Radix2CooleyTukey.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
//
33
// Originally written by @owensd. Used with his permission.
44

5-
#if os(Linux)
5+
#if canImport(Glibc)
66
import Glibc
7+
#elseif canImport(Musl)
8+
import Musl
79
#elseif os(Windows)
810
import MSVCRT
911
#else

benchmark/single-source/StringEdits.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
#if os(Linux)
14+
#if canImport(Glibc)
1515
import Glibc
16+
#elseif canImport(Musl)
17+
import Musl
1618
#elseif os(Windows)
1719
import MSVCRT
1820
#else

benchmark/single-source/StringMatch.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
#if os(Linux)
14+
#if canImport(Glibc)
1515
import Glibc
16+
#elseif canImport(Musl)
17+
import Musl
1618
#elseif os(Windows)
1719
import MSVCRT
1820
#else

benchmark/single-source/Walsh.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
#if os(Linux)
14+
#if canImport(Glibc)
1515
import Glibc
16+
#elseif canImport(Musl)
17+
import Musl
1618
#elseif os(Windows)
1719
import MSVCRT
1820
#else

benchmark/utils/ArgParse.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if os(Linux)
13+
#if canImport(Glibc)
1414
import Glibc
15+
#elseif canImport(Musl)
16+
import Musl
1517
#elseif os(Windows)
1618
import MSVCRT
1719
#else

benchmark/utils/DriverUtils.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if os(Linux)
13+
#if canImport(Glibc)
1414
import Glibc
15+
#elseif canImport(Musl)
16+
import Musl
1517
#elseif os(Windows)
1618
import MSVCRT
1719
#else

stdlib/private/StdlibUnittest/RaceTest.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ import SwiftPrivateThreadExtras
4343
import Darwin
4444
#elseif canImport(Glibc)
4545
import Glibc
46+
#elseif canImport(Musl)
47+
import Musl
4648
#elseif os(WASI)
4749
import WASILibc
4850
#elseif os(Windows)

stdlib/private/StdlibUnittest/StdlibCoreExtras.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import SwiftPrivateLibcExtras
1616
import Darwin
1717
#elseif canImport(Glibc)
1818
import Glibc
19+
#elseif canImport(Musl)
20+
import Musl
1921
#elseif os(WASI)
2022
import WASILibc
2123
#elseif os(Windows)

stdlib/private/StdlibUnittest/StdlibUnittest.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import Foundation
2222
import Darwin
2323
#elseif canImport(Glibc)
2424
import Glibc
25+
#elseif canImport(Musl)
26+
import Musl
2527
#elseif os(Windows)
2628
import CRT
2729
import WinSDK

0 commit comments

Comments
 (0)