Skip to content

Commit b5b16b0

Browse files
Add import WASILibc statements to libc import chains
1 parent c0a485e commit b5b16b0

21 files changed

+52
-0
lines changed

Sources/FoundationEssentials/Calendar/Calendar.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import Android
1818
import Glibc
1919
#elseif canImport(CRT)
2020
import CRT
21+
#elseif os(WASI)
22+
import WASILibc
2123
#endif
2224

2325
#if FOUNDATION_FRAMEWORK

Sources/FoundationEssentials/Calendar/Calendar_Gregorian.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import Android
1818
import Glibc
1919
#elseif canImport(CRT)
2020
import CRT
21+
#elseif os(WASI)
22+
import WASILibc
2123
#endif
2224

2325

Sources/FoundationEssentials/Data/Data+Reading.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import Glibc
2525
#elseif os(Windows)
2626
import CRT
2727
import WinSDK
28+
#elseif os(WASI)
29+
import WASILibc
30+
import var WASILibc.errno
31+
import wasi_emulated_mman
2832
#endif
2933

3034
func _fgetxattr(_ fd: Int32, _ name: UnsafePointer<CChar>!, _ value: UnsafeMutableRawPointer!, _ size: Int, _ position: UInt32, _ options: Int32) -> Int {

Sources/FoundationEssentials/Data/Data+Writing.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ import Glibc
2727
#elseif os(Windows)
2828
import CRT
2929
import WinSDK
30+
#elseif os(WASI)
31+
import WASILibc
32+
import var WASILibc.errno
33+
import wasi_emulated_mman
3034
#endif
3135

3236
#if !NO_FILESYSTEM

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Bionic
4040
@usableFromInline let memcpy = Musl.memcpy
4141
@usableFromInline let memcmp = Musl.memcmp
4242
#elseif canImport(WASILibc)
43+
import WASILibc
4344
@usableFromInline let calloc = WASILibc.calloc
4445
@usableFromInline let malloc = WASILibc.malloc
4546
@usableFromInline let free = WASILibc.free
@@ -76,6 +77,9 @@ import Glibc
7677
import Musl
7778
#elseif canImport(ucrt)
7879
import ucrt
80+
#elseif canImport(WASILibc)
81+
import WASILibc
82+
import wasi_emulated_mman
7983
#endif
8084

8185
#if os(Windows)

Sources/FoundationEssentials/Date.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import Bionic
1818
import Glibc
1919
#elseif canImport(WinSDK)
2020
import WinSDK
21+
#elseif os(WASI)
22+
import WASILibc
2123
#endif
2224

2325
#if !FOUNDATION_FRAMEWORK

Sources/FoundationEssentials/Decimal/Decimal+Math.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import Android
1818
import Glibc
1919
#elseif canImport(CRT)
2020
import CRT
21+
#elseif os(WASI)
22+
import WASILibc
2123
#endif
2224

2325
private let powerOfTen: [Decimal.VariableLengthInteger] = [

Sources/FoundationEssentials/Error/CocoaError+FilePath.swift

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

2729
extension CocoaError.Code {

Sources/FoundationEssentials/Error/ErrorCodes+POSIX.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#elseif os(Windows)
2020
import CRT
2121
import WinSDK
22+
#elseif os(WASI)
23+
import WASILibc
2224
#endif
2325

2426
#if FOUNDATION_FRAMEWORK

Sources/FoundationEssentials/FileManager/FileManager+Basics.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import Glibc
1919
#elseif os(Windows)
2020
import CRT
2121
import WinSDK
22+
#elseif os(WASI)
23+
import WASILibc
2224
#endif
2325

2426
#if os(Windows)

0 commit comments

Comments
 (0)