stdlib/benchmark: add canImport(Musl) where needed (#67120)

This allows compiling stdlib and benchmarks when targeting musl instead of Glibc.
This commit is contained in:
Max Desiatov
2023-07-05 19:55:08 +01:00
committed by GitHub
parent 39a837c1b5
commit 21a2b78801
18 changed files with 47 additions and 8 deletions

View File

@@ -11,8 +11,10 @@
//===----------------------------------------------------------------------===//
import TestsUtils
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import MSVCRT
#else

View File

@@ -2,8 +2,10 @@
//
// Originally written by @owensd. Used with his permission.
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import MSVCRT
#else

View File

@@ -11,8 +11,10 @@
//===----------------------------------------------------------------------===//
import TestsUtils
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import MSVCRT
#else

View File

@@ -11,8 +11,10 @@
//===----------------------------------------------------------------------===//
import TestsUtils
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import MSVCRT
#else

View File

@@ -11,8 +11,10 @@
//===----------------------------------------------------------------------===//
import TestsUtils
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import MSVCRT
#else

View File

@@ -10,8 +10,10 @@
//
//===----------------------------------------------------------------------===//
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import MSVCRT
#else

View File

@@ -10,8 +10,10 @@
//
//===----------------------------------------------------------------------===//
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import MSVCRT
#else

View File

@@ -43,6 +43,8 @@ import SwiftPrivateThreadExtras
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(WASI)
import WASILibc
#elseif os(Windows)

View File

@@ -16,6 +16,8 @@ import SwiftPrivateLibcExtras
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(WASI)
import WASILibc
#elseif os(Windows)

View File

@@ -22,6 +22,8 @@ import Foundation
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import CRT
import WinSDK

View File

@@ -19,6 +19,9 @@ let (platform_read, platform_write, platform_close) = (read, write, close)
#elseif canImport(Glibc)
import Glibc
let (platform_read, platform_write, platform_close) = (read, write, close)
#elseif canImport(Musl)
import Musl
let (platform_read, platform_write, platform_close) = (read, write, close)
#elseif os(Windows)
import CRT
import WinSDK

View File

@@ -15,6 +15,8 @@ import SwiftPrivate
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(WASI)
import WASILibc
#elseif os(Windows)

View File

@@ -15,6 +15,8 @@ import SwiftPrivate
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(WASI)
import WASILibc
#elseif os(Windows)

View File

@@ -19,6 +19,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(WASI)
import WASILibc
#elseif os(Windows)
@@ -69,7 +71,7 @@ public typealias ThreadHandle = HANDLE
#else
public typealias ThreadHandle = pthread_t
#if os(Linux) || os(Android)
#if (os(Linux) && !canImport(Musl)) || os(Android)
internal func _make_pthread_t() -> pthread_t {
return pthread_t()
}

View File

@@ -14,6 +14,8 @@
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(WASI)
import WASILibc
#elseif os(Windows)

View File

@@ -127,7 +127,11 @@ internal func getImageCount() -> UInt32 {
let rtldDefault = UnsafeMutableRawPointer(bitPattern: Int(-2))
#elseif !os(Windows)
import SwiftShims
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#endif
let rtldDefault: UnsafeMutableRawPointer? = nil

View File

@@ -16,6 +16,8 @@ import Swift
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
import Darwin.C.tgmath
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(OpenBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#elseif os(WASI)

View File

@@ -16,6 +16,8 @@ import Swift
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import WinSDK
#endif