Compare commits

..
2 Commits
24 changed files with 97 additions and 180 deletions

No files matched your search

-2
View File
@@ -19,8 +19,6 @@ jobs:
{"xcode_version": "16.1"}, {"xcode_version": "16.1"},
] ]
swift_flags: "-Xbuild-tools-swiftc -DSYSTEM_CI" swift_flags: "-Xbuild-tools-swiftc -DSYSTEM_CI"
enable_linux_static_sdk_build: true
enable_wasm_sdk_build: true
build-abi-stable: build-abi-stable:
name: Build ABI Stable name: Build ABI Stable
+2
View File
@@ -134,11 +134,13 @@ typedef struct __SWIFT_IORING_SQE_FALLBACK_STRUCT swift_io_uring_sqe;
#define IORING_FEAT_RW_ATTR (1U << 16) #define IORING_FEAT_RW_ATTR (1U << 16)
#define IORING_FEAT_NO_IOWAIT (1U << 17) #define IORING_FEAT_NO_IOWAIT (1U << 17)
#if !defined(_ASM_GENERIC_INT_LL64_H) && !defined(_ASM_GENERIC_INT_L64_H) && !defined(_UAPI_ASM_GENERIC_INT_LL64_H) && !defined(_UAPI_ASM_GENERIC_INT_L64_H)
typedef uint8_t __u8; typedef uint8_t __u8;
typedef uint16_t __u16; typedef uint16_t __u16;
typedef uint32_t __u32; typedef uint32_t __u32;
typedef uint64_t __u64; typedef uint64_t __u64;
typedef int32_t __s32; typedef int32_t __s32;
#endif
#ifndef __kernel_rwf_t #ifndef __kernel_rwf_t
typedef int __kernel_rwf_t; typedef int __kernel_rwf_t;
+1 -13
View File
@@ -11,7 +11,7 @@
/// occurred. /// occurred.
@frozen @frozen
@available(System 0.0.1, *) @available(System 0.0.1, *)
public struct Errno: RawRepresentable, Error, Hashable { public struct Errno: RawRepresentable, Error, Hashable, Codable {
/// The raw C error number. /// The raw C error number.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public let rawValue: CInt public let rawValue: CInt
@@ -1562,8 +1562,6 @@ extension Errno: CustomStringConvertible, CustomDebugStringConvertible {
public var debugDescription: String { self.description } public var debugDescription: String { self.description }
} }
#if !$Embedded
@available(System 0.0.1, *) @available(System 0.0.1, *)
extension Errno { extension Errno {
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
@@ -1573,13 +1571,3 @@ extension Errno {
} }
} }
@available(System 0.0.1, *)
extension Errno: Codable {}
public typealias SystemError = any Error
#else
public typealias SystemError = Errno
#endif // !$Embedded
+4 -20
View File
@@ -15,7 +15,7 @@
/// in the same way as you manage a raw C file handle. /// in the same way as you manage a raw C file handle.
@frozen @frozen
@available(System 0.0.1, *) @available(System 0.0.1, *)
public struct FileDescriptor: RawRepresentable, Hashable { public struct FileDescriptor: RawRepresentable, Hashable, Codable {
/// The raw C file handle. /// The raw C file handle.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public let rawValue: CInt public let rawValue: CInt
@@ -46,7 +46,7 @@ extension FileDescriptor {
/// The desired read and write access for a newly opened file. /// The desired read and write access for a newly opened file.
@frozen @frozen
@available(System 0.0.1, *) @available(System 0.0.1, *)
public struct AccessMode: RawRepresentable, Sendable, Hashable { public struct AccessMode: RawRepresentable, Sendable, Hashable, Codable {
/// The raw C access mode. /// The raw C access mode.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public var rawValue: CInt public var rawValue: CInt
@@ -89,7 +89,7 @@ extension FileDescriptor {
/// Options that specify behavior for a newly-opened file. /// Options that specify behavior for a newly-opened file.
@frozen @frozen
@available(System 0.0.1, *) @available(System 0.0.1, *)
public struct OpenOptions: OptionSet, Sendable, Hashable { public struct OpenOptions: OptionSet, Sendable, Hashable, Codable {
/// The raw C options. /// The raw C options.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public var rawValue: CInt public var rawValue: CInt
@@ -327,7 +327,7 @@ extension FileDescriptor {
/// Options for specifying what a file descriptor's offset is relative to. /// Options for specifying what a file descriptor's offset is relative to.
@frozen @frozen
@available(System 0.0.1, *) @available(System 0.0.1, *)
public struct SeekOrigin: RawRepresentable, Sendable, Hashable { public struct SeekOrigin: RawRepresentable, Sendable, Hashable, Codable {
/// The raw C value. /// The raw C value.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public var rawValue: CInt public var rawValue: CInt
@@ -402,22 +402,6 @@ extension FileDescriptor {
} }
} }
#if !$Embedded
@available(System 0.0.1, *)
extension FileDescriptor: Codable {}
@available(System 0.0.1, *)
extension FileDescriptor.AccessMode: Codable {}
@available(System 0.0.1, *)
extension FileDescriptor.OpenOptions: Codable {}
@available(System 0.0.1, *)
extension FileDescriptor.SeekOrigin: Codable {}
#endif // !$Embedded
@available(System 0.0.1, *) @available(System 0.0.1, *)
extension FileDescriptor.AccessMode extension FileDescriptor.AccessMode
: CustomStringConvertible, CustomDebugStringConvertible : CustomStringConvertible, CustomDebugStringConvertible
+28 -28
View File
@@ -30,24 +30,24 @@ extension FileDescriptor {
options: FileDescriptor.OpenOptions = FileDescriptor.OpenOptions(), options: FileDescriptor.OpenOptions = FileDescriptor.OpenOptions(),
permissions: FilePermissions? = nil, permissions: FilePermissions? = nil,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> FileDescriptor { ) throws -> FileDescriptor {
#if !os(Windows) #if !os(Windows)
return try path.withCString { (cString) throws(SystemError) in return try path.withCString {
try FileDescriptor.open( try FileDescriptor.open(
cString, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt) $0, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt)
} }
#else #else
return try path.withPlatformString { (platformString) throws(SystemError) in return try path.withPlatformString {
try FileDescriptor.open( try FileDescriptor.open(
platformString, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt) $0, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt)
} }
#endif #endif
} }
#if !os(Windows) #if !os(Windows)
// On Darwin, `CInterop.PlatformChar` is less available than // On Darwin, `CInterop.PlatformChar` is less available than
// `FileDescriptor.open`, so we need to use `CChar` instead. // `FileDescriptor.open`, so we need to use `CChar` instead.
/// Opens or creates a file for reading or writing. /// Opens or creates a file for reading or writing.
/// ///
/// - Parameters: /// - Parameters:
@@ -69,7 +69,7 @@ extension FileDescriptor {
options: FileDescriptor.OpenOptions = FileDescriptor.OpenOptions(), options: FileDescriptor.OpenOptions = FileDescriptor.OpenOptions(),
permissions: FilePermissions? = nil, permissions: FilePermissions? = nil,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> FileDescriptor { ) throws -> FileDescriptor {
try FileDescriptor._open( try FileDescriptor._open(
path, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt path, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt
).get() ).get()
@@ -116,7 +116,7 @@ extension FileDescriptor {
options: FileDescriptor.OpenOptions = FileDescriptor.OpenOptions(), options: FileDescriptor.OpenOptions = FileDescriptor.OpenOptions(),
permissions: FilePermissions? = nil, permissions: FilePermissions? = nil,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> FileDescriptor { ) throws -> FileDescriptor {
try FileDescriptor._open( try FileDescriptor._open(
path, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt path, mode, options: options, permissions: permissions, retryOnInterrupt: retryOnInterrupt
).get() ).get()
@@ -149,7 +149,7 @@ extension FileDescriptor {
/// ///
/// The corresponding C function is `close`. /// The corresponding C function is `close`.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public func close() throws(SystemError) { try _close().get() } public func close() throws { try _close().get() }
@usableFromInline @usableFromInline
internal func _close() -> Result<(), Errno> { internal func _close() -> Result<(), Errno> {
@@ -169,7 +169,7 @@ extension FileDescriptor {
@discardableResult @discardableResult
public func seek( public func seek(
offset: Int64, from whence: FileDescriptor.SeekOrigin offset: Int64, from whence: FileDescriptor.SeekOrigin
) throws(SystemError) -> Int64 { ) throws -> Int64 {
try _seek(offset: offset, from: whence).get() try _seek(offset: offset, from: whence).get()
} }
@@ -187,7 +187,7 @@ extension FileDescriptor {
@available(*, unavailable, renamed: "seek") @available(*, unavailable, renamed: "seek")
public func lseek( public func lseek(
offset: Int64, from whence: FileDescriptor.SeekOrigin offset: Int64, from whence: FileDescriptor.SeekOrigin
) throws(SystemError) -> Int64 { ) throws -> Int64 {
try seek(offset: offset, from: whence) try seek(offset: offset, from: whence)
} }
@@ -214,7 +214,7 @@ extension FileDescriptor {
public func read( public func read(
into buffer: UnsafeMutableRawBufferPointer, into buffer: UnsafeMutableRawBufferPointer,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> Int { ) throws -> Int {
try _read(into: buffer, retryOnInterrupt: retryOnInterrupt).get() try _read(into: buffer, retryOnInterrupt: retryOnInterrupt).get()
} }
@@ -222,7 +222,7 @@ extension FileDescriptor {
internal func _read( internal func _read(
into buffer: UnsafeMutableRawBufferPointer, into buffer: UnsafeMutableRawBufferPointer,
retryOnInterrupt: Bool retryOnInterrupt: Bool
) throws(SystemError) -> Result<Int, Errno> { ) throws -> Result<Int, Errno> {
valueOrErrno(retryOnInterrupt: retryOnInterrupt) { valueOrErrno(retryOnInterrupt: retryOnInterrupt) {
system_read(self.rawValue, buffer.baseAddress, buffer.count) system_read(self.rawValue, buffer.baseAddress, buffer.count)
} }
@@ -251,7 +251,7 @@ extension FileDescriptor {
fromAbsoluteOffset offset: Int64, fromAbsoluteOffset offset: Int64,
into buffer: UnsafeMutableRawBufferPointer, into buffer: UnsafeMutableRawBufferPointer,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> Int { ) throws -> Int {
try _read( try _read(
fromAbsoluteOffset: offset, fromAbsoluteOffset: offset,
into: buffer, into: buffer,
@@ -276,7 +276,7 @@ extension FileDescriptor {
fromAbsoluteOffset offset: Int64, fromAbsoluteOffset offset: Int64,
into buffer: UnsafeMutableRawBufferPointer, into buffer: UnsafeMutableRawBufferPointer,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> Int { ) throws -> Int {
try read( try read(
fromAbsoluteOffset: offset, fromAbsoluteOffset: offset,
into: buffer, into: buffer,
@@ -303,7 +303,7 @@ extension FileDescriptor {
public func write( public func write(
_ buffer: UnsafeRawBufferPointer, _ buffer: UnsafeRawBufferPointer,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> Int { ) throws -> Int {
try _write(buffer, retryOnInterrupt: retryOnInterrupt).get() try _write(buffer, retryOnInterrupt: retryOnInterrupt).get()
} }
@@ -337,7 +337,7 @@ extension FileDescriptor {
toAbsoluteOffset offset: Int64, toAbsoluteOffset offset: Int64,
_ buffer: UnsafeRawBufferPointer, _ buffer: UnsafeRawBufferPointer,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> Int { ) throws -> Int {
try _write(toAbsoluteOffset: offset, buffer, retryOnInterrupt: retryOnInterrupt).get() try _write(toAbsoluteOffset: offset, buffer, retryOnInterrupt: retryOnInterrupt).get()
} }
@@ -359,7 +359,7 @@ extension FileDescriptor {
toAbsoluteOffset offset: Int64, toAbsoluteOffset offset: Int64,
into buffer: UnsafeRawBufferPointer, into buffer: UnsafeRawBufferPointer,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> Int { ) throws -> Int {
try write( try write(
toAbsoluteOffset: offset, toAbsoluteOffset: offset,
buffer, buffer,
@@ -402,7 +402,7 @@ extension FileDescriptor {
public func duplicate( public func duplicate(
as target: FileDescriptor? = nil, as target: FileDescriptor? = nil,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) -> FileDescriptor { ) throws -> FileDescriptor {
try _duplicate(as: target, retryOnInterrupt: retryOnInterrupt).get() try _duplicate(as: target, retryOnInterrupt: retryOnInterrupt).get()
} }
@@ -411,7 +411,7 @@ extension FileDescriptor {
internal func _duplicate( internal func _duplicate(
as target: FileDescriptor?, as target: FileDescriptor?,
retryOnInterrupt: Bool retryOnInterrupt: Bool
) throws(SystemError) -> Result<FileDescriptor, Errno> { ) throws -> Result<FileDescriptor, Errno> {
valueOrErrno(retryOnInterrupt: retryOnInterrupt) { valueOrErrno(retryOnInterrupt: retryOnInterrupt) {
if let target = target { if let target = target {
return system_dup2(self.rawValue, target.rawValue) return system_dup2(self.rawValue, target.rawValue)
@@ -422,13 +422,13 @@ extension FileDescriptor {
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
@available(*, unavailable, renamed: "duplicate") @available(*, unavailable, renamed: "duplicate")
public func dup() throws(SystemError) -> FileDescriptor { public func dup() throws -> FileDescriptor {
fatalError("Not implemented") fatalError("Not implemented")
} }
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
@available(*, unavailable, renamed: "duplicate") @available(*, unavailable, renamed: "duplicate")
public func dup2() throws(SystemError) -> FileDescriptor { public func dup2() throws -> FileDescriptor {
fatalError("Not implemented") fatalError("Not implemented")
} }
} }
@@ -444,7 +444,7 @@ extension FileDescriptor {
/// The corresponding C function is `pipe`. /// The corresponding C function is `pipe`.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
@available(System 1.1.0, *) @available(System 1.1.0, *)
public static func pipe() throws(SystemError) -> (readEnd: FileDescriptor, writeEnd: FileDescriptor) { public static func pipe() throws -> (readEnd: FileDescriptor, writeEnd: FileDescriptor) {
try _pipe().get() try _pipe().get()
} }
@@ -490,7 +490,7 @@ extension FileDescriptor {
public func resize( public func resize(
to newSize: Int64, to newSize: Int64,
retryOnInterrupt: Bool = true retryOnInterrupt: Bool = true
) throws(SystemError) { ) throws {
try _resize( try _resize(
to: newSize, to: newSize,
retryOnInterrupt: retryOnInterrupt retryOnInterrupt: retryOnInterrupt
@@ -537,7 +537,7 @@ extension FilePermissions {
/// afterwards, because of the way reading the creation mask works. /// afterwards, because of the way reading the creation mask works.
internal static func withCreationMask<R>( internal static func withCreationMask<R>(
_ permissions: FilePermissions, _ permissions: FilePermissions,
body: () throws(SystemError) -> R body: () throws -> R
) rethrows -> R { ) rethrows -> R {
let oldMask = _umask(permissions.rawValue) let oldMask = _umask(permissions.rawValue)
defer { defer {
-4
View File
@@ -68,8 +68,6 @@ extension FilePath {
@available(System 0.0.1, *) @available(System 0.0.1, *)
extension FilePath: Hashable {} extension FilePath: Hashable {}
#if !$Embedded
@available(System 0.0.1, *) @available(System 0.0.1, *)
extension FilePath: Codable { extension FilePath: Codable {
// Encoder is synthesized; it probably should have been explicit and used // Encoder is synthesized; it probably should have been explicit and used
@@ -90,5 +88,3 @@ extension FilePath: Codable {
} }
} }
} }
#endif // !$Embedded
@@ -128,8 +128,6 @@ extension SystemString {
} }
} }
#if !$Embedded
// Unifying protocol for common functionality between roots, components, // Unifying protocol for common functionality between roots, components,
// and views onto SystemString and FilePath. // and views onto SystemString and FilePath.
internal protocol _StrSlice: _PlatformStringable, Hashable, Codable { internal protocol _StrSlice: _PlatformStringable, Hashable, Codable {
@@ -140,20 +138,6 @@ internal protocol _StrSlice: _PlatformStringable, Hashable, Codable {
func _invariantCheck() func _invariantCheck()
} }
#else
internal protocol _StrSlice: _PlatformStringable, Hashable {
var _storage: SystemString { get }
var _range: Range<SystemString.Index> { get }
init?(_ str: SystemString)
func _invariantCheck()
}
#endif // !$Embedded
extension _StrSlice { extension _StrSlice {
internal var _slice: Slice<SystemString> { internal var _slice: Slice<SystemString> {
Slice(base: _storage, bounds: _range) Slice(base: _storage, bounds: _range)
+5 -5
View File
@@ -64,7 +64,7 @@ extension FilePath {
} }
#if !os(Windows) #if !os(Windows)
// Note: This function should have been opaque, but it shipped as // Note: This function should have been opaque, but it shipped as
// `@_alwaysEmitIntoClient` in macOS 12/iOS 15, and now it is stuck // `@_alwaysEmitIntoClient` in macOS 12/iOS 15, and now it is stuck
// this way forever. (Or until the language provides a way for us // this way forever. (Or until the language provides a way for us
// to declare separate availability for a function's exported symbol // to declare separate availability for a function's exported symbol
@@ -84,7 +84,7 @@ extension FilePath {
/// Don't try to store the pointer for later use. /// Don't try to store the pointer for later use.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public func withPlatformString<Result>( public func withPlatformString<Result>(
_ body: (UnsafePointer<CInterop.PlatformChar>) throws(SystemError) -> Result _ body: (UnsafePointer<CInterop.PlatformChar>) throws -> Result
) rethrows -> Result { ) rethrows -> Result {
return try withCString(body) return try withCString(body)
} }
@@ -102,7 +102,7 @@ extension FilePath {
/// only during the execution of this method. /// only during the execution of this method.
/// Don't try to store the pointer for later use. /// Don't try to store the pointer for later use.
public func withPlatformString<Result>( public func withPlatformString<Result>(
_ body: (UnsafePointer<CInterop.PlatformChar>) throws(SystemError) -> Result _ body: (UnsafePointer<CInterop.PlatformChar>) throws -> Result
) rethrows -> Result { ) rethrows -> Result {
return try _withPlatformString(body) return try _withPlatformString(body)
} }
@@ -595,8 +595,8 @@ extension FilePath {
/// For backwards compatibility only. This function is equivalent to /// For backwards compatibility only. This function is equivalent to
/// the preferred `withPlatformString`. /// the preferred `withPlatformString`.
public func withCString<Result>( public func withCString<Result>(
_ body: (UnsafePointer<CChar>) throws(SystemError) -> Result _ body: (UnsafePointer<CChar>) throws -> Result
) throws(SystemError) -> Result { ) rethrows -> Result {
return try _withPlatformString(body) return try _withPlatformString(body)
} }
} }
+6 -6
View File
@@ -20,8 +20,8 @@
/// deletes the directory and all of its contents before returning. /// deletes the directory and all of its contents before returning.
internal func withTemporaryFilePath<R>( internal func withTemporaryFilePath<R>(
basename: FilePath.Component, basename: FilePath.Component,
_ body: (FilePath) throws(SystemError) -> R _ body: (FilePath) throws -> R
) throws(SystemError) -> R { ) throws -> R {
let temporaryDir = try createUniqueTemporaryDirectory(basename: basename) let temporaryDir = try createUniqueTemporaryDirectory(basename: basename)
defer { defer {
try? _recursiveRemove(at: temporaryDir) try? _recursiveRemove(at: temporaryDir)
@@ -44,9 +44,9 @@ fileprivate let base64 = Array<UInt8>(
/// ///
/// This function will throw if there is an error, except if the error /// This function will throw if there is an error, except if the error
/// is that the directory exists, in which case it returns `false`. /// is that the directory exists, in which case it returns `false`.
fileprivate func makeLockedDownDirectory(at path: FilePath) throws(SystemError) -> Bool { fileprivate func makeLockedDownDirectory(at path: FilePath) throws -> Bool {
return try path.withPlatformString { (platformString) throws(SystemError) in return try path.withPlatformString {
if system_mkdir(platformString, 0o700) == 0 { if system_mkdir($0, 0o700) == 0 {
return true return true
} }
let err = system_errno let err = system_errno
@@ -83,7 +83,7 @@ fileprivate func createRandomString(length: Int) -> String {
/// string of characters. /// string of characters.
fileprivate func createUniqueTemporaryDirectory( fileprivate func createUniqueTemporaryDirectory(
basename: FilePath.Component basename: FilePath.Component
) throws(SystemError) -> FilePath { ) throws -> FilePath {
var tempDir = try _getTemporaryDirectory() var tempDir = try _getTemporaryDirectory()
tempDir.append(basename) tempDir.append(basename)
@@ -10,7 +10,7 @@
#if !os(Windows) #if !os(Windows)
/// Get the path to the system temporary directory. /// Get the path to the system temporary directory.
internal func _getTemporaryDirectory() throws(SystemError) -> FilePath { internal func _getTemporaryDirectory() throws -> FilePath {
guard let tmp = system_getenv("TMPDIR") else { guard let tmp = system_getenv("TMPDIR") else {
return "/tmp" return "/tmp"
} }
@@ -26,22 +26,22 @@ internal func _getTemporaryDirectory() throws(SystemError) -> FilePath {
/// Removes a directory completely, including all of its contents. /// Removes a directory completely, including all of its contents.
internal func _recursiveRemove( internal func _recursiveRemove(
at path: FilePath at path: FilePath
) throws(SystemError) { ) throws {
let dirfd = try FileDescriptor.open(path, .readOnly, options: .directory) let dirfd = try FileDescriptor.open(path, .readOnly, options: .directory)
defer { defer {
try? dirfd.close() try? dirfd.close()
} }
let dot: (CInterop.PlatformChar, CInterop.PlatformChar) = (46, 0) let dot: (CInterop.PlatformChar, CInterop.PlatformChar) = (46, 0)
try withUnsafeBytes(of: dot) { (bytes) throws(SystemError) in try withUnsafeBytes(of: dot) {
try recursiveRemove( try recursiveRemove(
in: dirfd.rawValue, in: dirfd.rawValue,
name: bytes.assumingMemoryBound(to: CInterop.PlatformChar.self).baseAddress! name: $0.assumingMemoryBound(to: CInterop.PlatformChar.self).baseAddress!
) )
} }
try path.withPlatformString { (platformString) throws(SystemError) in try path.withPlatformString {
if system_rmdir(platformString) != 0 { if system_rmdir($0) != 0 {
throw Errno.current throw Errno.current
} }
} }
@@ -81,8 +81,8 @@ fileprivate func impl_opendirat(
fileprivate func forEachFile( fileprivate func forEachFile(
in dirfd: CInt, in dirfd: CInt,
subdir: UnsafePointer<CInterop.PlatformChar>, subdir: UnsafePointer<CInterop.PlatformChar>,
_ body: (system_dirent) throws(SystemError) -> () _ body: (system_dirent) throws -> ()
) throws(SystemError) { ) throws {
guard let dir = impl_opendirat(dirfd, subdir) else { guard let dir = impl_opendirat(dirfd, subdir) else {
throw Errno.current throw Errno.current
} }
@@ -113,7 +113,7 @@ fileprivate func forEachFile(
fileprivate func recursiveRemove( fileprivate func recursiveRemove(
in dirfd: CInt, in dirfd: CInt,
name: UnsafePointer<CInterop.PlatformChar> name: UnsafePointer<CInterop.PlatformChar>
) throws(SystemError) { ) throws {
// First, deal with subdirectories // First, deal with subdirectories
try forEachFile(in: dirfd, subdir: name) { dirent in try forEachFile(in: dirfd, subdir: name) { dirent in
if dirent.d_type == SYSTEM_DT_DIR { if dirent.d_type == SYSTEM_DT_DIR {
+1 -6
View File
@@ -18,7 +18,7 @@
/// perms == [.ownerReadWrite, .groupRead, .otherRead] // true /// perms == [.ownerReadWrite, .groupRead, .otherRead] // true
@frozen @frozen
@available(System 0.0.1, *) @available(System 0.0.1, *)
public struct FilePermissions: OptionSet, Sendable, Hashable { public struct FilePermissions: OptionSet, Sendable, Hashable, Codable {
/// The raw C file permissions. /// The raw C file permissions.
@_alwaysEmitIntoClient @_alwaysEmitIntoClient
public let rawValue: CModeT public let rawValue: CModeT
@@ -172,8 +172,3 @@ extension FilePermissions
/// A textual representation of the file permissions, suitable for debugging. /// A textual representation of the file permissions, suitable for debugging.
public var debugDescription: String { self.description } public var debugDescription: String { self.description }
} }
#if !$Embedded
@available(System 0.0.1, *)
extension FilePermissions: Codable {}
#endif
+1 -1
View File
@@ -320,7 +320,7 @@ extension IORing.Request {
* ASYNC_CANCEL flags. * ASYNC_CANCEL flags.
* *
* IORING_ASYNC_CANCEL_ALL Cancel all requests that match the given key * IORING_ASYNC_CANCEL_ALL Cancel all requests that match the given key
* IORING_ASYNC_CANCEL_FD Key off 'fd' for cancellation rather than the * IORING_ASYNC_CANCEL_FD Key off 'fd' for cancelation rather than the
* request 'user_data' * request 'user_data'
* IORING_ASYNC_CANCEL_ANY Match any request * IORING_ASYNC_CANCEL_ANY Match any request
* IORING_ASYNC_CANCEL_FD_FIXED 'fd' passed in is a fixed descriptor * IORING_ASYNC_CANCEL_FD_FIXED 'fd' passed in is a fixed descriptor
+3 -3
View File
@@ -116,9 +116,9 @@ internal func system_memset(
// Interop between String and platfrom string // Interop between String and platfrom string
extension String { extension String {
internal func _withPlatformString<Success, Failure: Error>( internal func _withPlatformString<Result>(
_ body: (UnsafePointer<CInterop.PlatformChar>) throws(Failure) -> Success _ body: (UnsafePointer<CInterop.PlatformChar>) throws -> Result
) throws(Failure) -> Success { ) rethrows -> Result {
// Need to #if because CChar may be signed // Need to #if because CChar may be signed
#if os(Windows) #if os(Windows)
return try withCString(encodedAs: CInterop.PlatformUnicodeEncoding.self, body) return try withCString(encodedAs: CInterop.PlatformUnicodeEncoding.self, body)
+9 -9
View File
@@ -17,7 +17,7 @@
// enabled in testing builds of System currently, to minimize runtime overhead of release builds. // enabled in testing builds of System currently, to minimize runtime overhead of release builds.
// //
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
internal struct Trace { internal struct Trace {
internal struct Entry { internal struct Entry {
@@ -115,12 +115,12 @@ extension MockingDriver {
} }
} }
#endif // ENABLE_MOCKING && !$Embedded #endif // ENABLE_MOCKING
@inline(__always) @inline(__always)
internal var mockingEnabled: Bool { internal var mockingEnabled: Bool {
// Fast constant-foldable check for release builds // Fast constant-foldable check for release builds
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
return contextualMockingEnabled return contextualMockingEnabled
#else #else
return false return false
@@ -129,15 +129,15 @@ internal var mockingEnabled: Bool {
@inline(__always) @inline(__always)
internal var forceWindowsPaths: Bool? { internal var forceWindowsPaths: Bool? {
#if ENABLE_MOCKING && !$Embedded #if !ENABLE_MOCKING
return MockingDriver.forceWindowsPaths
#else
return nil return nil
#else
return MockingDriver.forceWindowsPaths
#endif #endif
} }
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
// Strip the mock_system prefix and the arg list suffix // Strip the mock_system prefix and the arg list suffix
private func originalSyscallName(_ function: String) -> String { private func originalSyscallName(_ function: String) -> String {
// `function` must be of format `system_<name>(<parameters>)` // `function` must be of format `system_<name>(<parameters>)`
@@ -193,12 +193,12 @@ internal func _mockOffT(
) -> _COffT { ) -> _COffT {
_COffT(mockImpl(name: name, path: path, args)) _COffT(mockImpl(name: name, path: path, args))
} }
#endif // ENABLE_MOCKING && !$Embedded #endif // ENABLE_MOCKING
// Force paths to be treated as Windows syntactically if `enabled` is // Force paths to be treated as Windows syntactically if `enabled` is
// true, and as POSIX syntactically if not. // true, and as POSIX syntactically if not.
internal func _withWindowsPaths(enabled: Bool, _ body: () -> ()) { internal func _withWindowsPaths(enabled: Bool, _ body: () -> ()) {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
MockingDriver.withMockingEnabled { driver in MockingDriver.withMockingEnabled { driver in
driver.forceWindowsSyntaxForPaths = enabled driver.forceWindowsSyntaxForPaths = enabled
body() body()
+16 -16
View File
@@ -31,7 +31,7 @@ import Android
internal func system_open( internal func system_open(
_ path: UnsafePointer<CInterop.PlatformChar>, _ oflag: Int32 _ path: UnsafePointer<CInterop.PlatformChar>, _ oflag: Int32
) -> CInt { ) -> CInt {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { if mockingEnabled {
return _mock(path: path, oflag) return _mock(path: path, oflag)
} }
@@ -43,7 +43,7 @@ internal func system_open(
_ path: UnsafePointer<CInterop.PlatformChar>, _ path: UnsafePointer<CInterop.PlatformChar>,
_ oflag: Int32, _ mode: CInterop.Mode _ oflag: Int32, _ mode: CInterop.Mode
) -> CInt { ) -> CInt {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { if mockingEnabled {
return _mock(path: path, oflag, mode) return _mock(path: path, oflag, mode)
} }
@@ -53,7 +53,7 @@ internal func system_open(
// close // close
internal func system_close(_ fd: Int32) -> Int32 { internal func system_close(_ fd: Int32) -> Int32 {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(fd) } if mockingEnabled { return _mock(fd) }
#endif #endif
return close(fd) return close(fd)
@@ -63,7 +63,7 @@ internal func system_close(_ fd: Int32) -> Int32 {
internal func system_read( internal func system_read(
_ fd: Int32, _ buf: UnsafeMutableRawPointer?, _ nbyte: Int _ fd: Int32, _ buf: UnsafeMutableRawPointer?, _ nbyte: Int
) -> Int { ) -> Int {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mockInt(fd, buf, nbyte) } if mockingEnabled { return _mockInt(fd, buf, nbyte) }
#endif #endif
return read(fd, buf, nbyte) return read(fd, buf, nbyte)
@@ -73,7 +73,7 @@ internal func system_read(
internal func system_pread( internal func system_pread(
_ fd: Int32, _ buf: UnsafeMutableRawPointer?, _ nbyte: Int, _ offset: off_t _ fd: Int32, _ buf: UnsafeMutableRawPointer?, _ nbyte: Int, _ offset: off_t
) -> Int { ) -> Int {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mockInt(fd, buf, nbyte, offset) } if mockingEnabled { return _mockInt(fd, buf, nbyte, offset) }
#endif #endif
#if os(Android) #if os(Android)
@@ -91,7 +91,7 @@ internal func system_pread(
internal func system_lseek( internal func system_lseek(
_ fd: Int32, _ off: off_t, _ whence: Int32 _ fd: Int32, _ off: off_t, _ whence: Int32
) -> off_t { ) -> off_t {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mockOffT(fd, off, whence) } if mockingEnabled { return _mockOffT(fd, off, whence) }
#endif #endif
return lseek(fd, off, whence) return lseek(fd, off, whence)
@@ -101,7 +101,7 @@ internal func system_lseek(
internal func system_write( internal func system_write(
_ fd: Int32, _ buf: UnsafeRawPointer?, _ nbyte: Int _ fd: Int32, _ buf: UnsafeRawPointer?, _ nbyte: Int
) -> Int { ) -> Int {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mockInt(fd, buf, nbyte) } if mockingEnabled { return _mockInt(fd, buf, nbyte) }
#endif #endif
return write(fd, buf, nbyte) return write(fd, buf, nbyte)
@@ -111,7 +111,7 @@ internal func system_write(
internal func system_pwrite( internal func system_pwrite(
_ fd: Int32, _ buf: UnsafeRawPointer?, _ nbyte: Int, _ offset: off_t _ fd: Int32, _ buf: UnsafeRawPointer?, _ nbyte: Int, _ offset: off_t
) -> Int { ) -> Int {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mockInt(fd, buf, nbyte, offset) } if mockingEnabled { return _mockInt(fd, buf, nbyte, offset) }
#endif #endif
#if os(Android) #if os(Android)
@@ -127,14 +127,14 @@ internal func system_pwrite(
#if !os(WASI) #if !os(WASI)
internal func system_dup(_ fd: Int32) -> Int32 { internal func system_dup(_ fd: Int32) -> Int32 {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(fd) } if mockingEnabled { return _mock(fd) }
#endif #endif
return dup(fd) return dup(fd)
} }
internal func system_dup2(_ fd: Int32, _ fd2: Int32) -> Int32 { internal func system_dup2(_ fd: Int32, _ fd2: Int32) -> Int32 {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(fd, fd2) } if mockingEnabled { return _mock(fd, fd2) }
#endif #endif
return dup2(fd, fd2) return dup2(fd, fd2)
@@ -143,7 +143,7 @@ internal func system_dup2(_ fd: Int32, _ fd2: Int32) -> Int32 {
#if !os(WASI) #if !os(WASI)
internal func system_pipe(_ fds: UnsafeMutablePointer<Int32>) -> CInt { internal func system_pipe(_ fds: UnsafeMutablePointer<Int32>) -> CInt {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(fds) } if mockingEnabled { return _mock(fds) }
#endif #endif
return pipe(fds) return pipe(fds)
@@ -151,7 +151,7 @@ internal func system_pipe(_ fds: UnsafeMutablePointer<Int32>) -> CInt {
#endif #endif
internal func system_ftruncate(_ fd: Int32, _ length: off_t) -> Int32 { internal func system_ftruncate(_ fd: Int32, _ length: off_t) -> Int32 {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(fd, length) } if mockingEnabled { return _mock(fd, length) }
#endif #endif
return ftruncate(fd, length) return ftruncate(fd, length)
@@ -161,7 +161,7 @@ internal func system_mkdir(
_ path: UnsafePointer<CInterop.PlatformChar>, _ path: UnsafePointer<CInterop.PlatformChar>,
_ mode: CInterop.Mode _ mode: CInterop.Mode
) -> CInt { ) -> CInt {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(path: path, mode) } if mockingEnabled { return _mock(path: path, mode) }
#endif #endif
return mkdir(path, mode) return mkdir(path, mode)
@@ -170,7 +170,7 @@ internal func system_mkdir(
internal func system_rmdir( internal func system_rmdir(
_ path: UnsafePointer<CInterop.PlatformChar> _ path: UnsafePointer<CInterop.PlatformChar>
) -> CInt { ) -> CInt {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(path: path) } if mockingEnabled { return _mock(path: path) }
#endif #endif
return rmdir(path) return rmdir(path)
@@ -208,7 +208,7 @@ internal func system_unlinkat(
_ path: UnsafePointer<CInterop.PlatformChar>, _ path: UnsafePointer<CInterop.PlatformChar>,
_ flag: CInt _ flag: CInt
) -> CInt { ) -> CInt {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { return _mock(fd, path, flag) } if mockingEnabled { return _mock(fd, path, flag) }
#endif #endif
return unlinkat(fd, path, flag) return unlinkat(fd, path, flag)
@@ -247,7 +247,7 @@ internal func system_openat(
_ path: UnsafePointer<CInterop.PlatformChar>, _ path: UnsafePointer<CInterop.PlatformChar>,
_ oflag: Int32 _ oflag: Int32
) -> CInt { ) -> CInt {
#if ENABLE_MOCKING && !$Embedded #if ENABLE_MOCKING
if mockingEnabled { if mockingEnabled {
return _mock(fd, path, oflag) return _mock(fd, path, oflag)
} }
+4 -4
View File
@@ -158,8 +158,8 @@ extension String {
/// only during the execution of this method. /// only during the execution of this method.
/// Don't try to store the pointer for later use. /// Don't try to store the pointer for later use.
public func withPlatformString<Result>( public func withPlatformString<Result>(
_ body: (UnsafePointer<CInterop.PlatformChar>) throws(SystemError) -> Result _ body: (UnsafePointer<CInterop.PlatformChar>) throws -> Result
) throws(SystemError) -> Result { ) rethrows -> Result {
try _withPlatformString(body) try _withPlatformString(body)
} }
@@ -189,8 +189,8 @@ extension CInterop.PlatformUnicodeEncoding.CodeUnit {
internal protocol _PlatformStringable { internal protocol _PlatformStringable {
func _withPlatformString<Result>( func _withPlatformString<Result>(
_ body: (UnsafePointer<CInterop.PlatformChar>) throws(SystemError) -> Result _ body: (UnsafePointer<CInterop.PlatformChar>) throws -> Result
) throws(SystemError) -> Result ) rethrows -> Result
init?(_platformString: UnsafePointer<CInterop.PlatformChar>) init?(_platformString: UnsafePointer<CInterop.PlatformChar>)
} }
+4 -16
View File
@@ -9,7 +9,7 @@
// A platform-native character representation, currently used for file paths // A platform-native character representation, currently used for file paths
internal struct SystemChar: internal struct SystemChar:
RawRepresentable, Sendable, Comparable, Hashable { RawRepresentable, Sendable, Comparable, Hashable, Codable {
internal typealias RawValue = CInterop.PlatformChar internal typealias RawValue = CInterop.PlatformChar
internal var rawValue: RawValue internal var rawValue: RawValue
@@ -23,12 +23,6 @@ internal struct SystemChar:
} }
} }
#if !$Embedded
extension SystemChar: Codable {}
#endif // !$Embedded
extension SystemChar { extension SystemChar {
internal init(ascii: Unicode.Scalar) { internal init(ascii: Unicode.Scalar) {
self.init(rawValue: numericCast(UInt8(ascii: ascii))) self.init(rawValue: numericCast(UInt8(ascii: ascii)))
@@ -110,7 +104,7 @@ extension SystemString {
} }
return true return true
} }
fileprivate func _invariantCheck() { fileprivate func _invariantCheck() {
#if DEBUG #if DEBUG
precondition(_invariantsSatisfied()) precondition(_invariantsSatisfied())
@@ -179,14 +173,10 @@ extension SystemString: RangeReplaceableCollection {
} }
} }
extension SystemString: Hashable {} extension SystemString: Hashable, Codable {
#if !$Embedded
extension SystemString: Codable {
// Encoder is synthesized; it probably should have been explicit and used // Encoder is synthesized; it probably should have been explicit and used
// a single-value container, but making that change now is somewhat risky. // a single-value container, but making that change now is somewhat risky.
// Decoder is written explicitly to ensure that we validate invariants on // Decoder is written explicitly to ensure that we validate invariants on
// untrusted input. // untrusted input.
public init(from decoder: any Decoder) throws { public init(from decoder: any Decoder) throws {
@@ -205,8 +195,6 @@ extension SystemString: Codable {
} }
} }
#endif // !$Embedded
extension SystemString { extension SystemString {
internal func withNullTerminatedSystemChars<T>( internal func withNullTerminatedSystemChars<T>(
-4
View File
@@ -43,8 +43,6 @@ internal func nothingOrErrno<I: FixedWidthInteger>(
valueOrErrno(retryOnInterrupt: retryOnInterrupt, f).map { _ in () } valueOrErrno(retryOnInterrupt: retryOnInterrupt, f).map { _ in () }
} }
#if !$Embedded
// Run a precondition for debug client builds // Run a precondition for debug client builds
internal func _debugPrecondition( internal func _debugPrecondition(
_ condition: @autoclosure () -> Bool, _ condition: @autoclosure () -> Bool,
@@ -58,8 +56,6 @@ internal func _debugPrecondition(
} }
} }
#endif // !$Embedded
extension OpaquePointer { extension OpaquePointer {
internal var _isNULL: Bool { internal var _isNULL: Bool {
OpaquePointer(bitPattern: Int(bitPattern: self)) == nil OpaquePointer(bitPattern: Int(bitPattern: self)) == nil
+2 -2
View File
@@ -52,13 +52,13 @@ extension Slice where Element: Equatable {
return self[...idx] return self[...idx]
} }
// If `e` is present, eat up to first occurrence of `e` // If `e` is present, eat up to first occurence of `e`
internal mutating func _eatUntil(_ e: Element) -> Slice? { internal mutating func _eatUntil(_ e: Element) -> Slice? {
guard let idx = self.firstIndex(of: e) else { return nil } guard let idx = self.firstIndex(of: e) else { return nil }
return _eatUntil(idx) return _eatUntil(idx)
} }
// If `e` is present, eat up to and through first occurrence of `e` // If `e` is present, eat up to and through first occurence of `e`
internal mutating func _eatThrough(_ e: Element) -> Slice? { internal mutating func _eatThrough(_ e: Element) -> Slice? {
guard let idx = self.firstIndex(of: e) else { return nil } guard let idx = self.firstIndex(of: e) else { return nil }
return _eatThrough(idx) return _eatThrough(idx)
+2 -4
View File
@@ -22,7 +22,7 @@ import CSystem
@available(System 0.0.1, *) @available(System 0.0.1, *)
final class FileOperationsTest: XCTestCase { final class FileOperationsTest: XCTestCase {
#if ENABLE_MOCKING && !os(WASI) // Would need to use _getConst funcs from CSystem #if !os(WASI) // Would need to use _getConst funcs from CSystem
func testSyscalls() { func testSyscalls() {
let fd = FileDescriptor(rawValue: 1) let fd = FileDescriptor(rawValue: 1)
@@ -91,7 +91,7 @@ final class FileOperationsTest: XCTestCase {
for test in syscallTestCases { test.runAllTests() } for test in syscallTestCases { test.runAllTests() }
} }
#endif // ENABLE_MOCKING && !os(WASI) #endif // !os(WASI)
func testWriteFromEmptyBuffer() throws { func testWriteFromEmptyBuffer() throws {
#if os(Windows) #if os(Windows)
@@ -215,7 +215,6 @@ final class FileOperationsTest: XCTestCase {
} }
} }
#if ENABLE_MOCKING
func testGithubIssues() { func testGithubIssues() {
// https://github.com/apple/swift-system/issues/26 // https://github.com/apple/swift-system/issues/26
#if os(WASI) #if os(WASI)
@@ -234,7 +233,6 @@ final class FileOperationsTest: XCTestCase {
} }
issue26.runAllTests() issue26.runAllTests()
} }
#endif // ENABLE_MOCKING
func testResizeFile() throws { func testResizeFile() throws {
try withTemporaryFilePath(basename: "testResizeFile") { path in try withTemporaryFilePath(basename: "testResizeFile") { path in
@@ -7,7 +7,6 @@
See https://swift.org/LICENSE.txt for license information See https://swift.org/LICENSE.txt for license information
*/ */
#if ENABLE_MOCKING
import XCTest import XCTest
#if SYSTEM_PACKAGE #if SYSTEM_PACKAGE
@@ -106,4 +105,3 @@ final class FilePathParsingTest: XCTestCase {
} }
} }
} }
#endif // ENABLE_MOCKING
@@ -7,7 +7,6 @@
See https://swift.org/LICENSE.txt for license information See https://swift.org/LICENSE.txt for license information
*/ */
#if ENABLE_MOCKING
import XCTest import XCTest
#if SYSTEM_PACKAGE #if SYSTEM_PACKAGE
@@ -1239,4 +1238,3 @@ final class FilePathSyntaxTest: XCTestCase {
} }
} }
#endif // ENABLE_MOCKING
-2
View File
@@ -7,7 +7,6 @@
See https://swift.org/LICENSE.txt for license information See https://swift.org/LICENSE.txt for license information
*/ */
#if ENABLE_MOCKING
import XCTest import XCTest
#if SYSTEM_PACKAGE #if SYSTEM_PACKAGE
@@ -49,4 +48,3 @@ final class MockingTest: XCTestCase {
XCTAssertFalse(mockingEnabled) XCTAssertFalse(mockingEnabled)
} }
} }
#endif // ENABLE_MOCKING
@@ -17,7 +17,6 @@ import XCTest
internal struct Wildcard: Hashable {} internal struct Wildcard: Hashable {}
#if ENABLE_MOCKING
extension Trace.Entry { extension Trace.Entry {
/// This implements `==` with wildcard matching. /// This implements `==` with wildcard matching.
/// (`Entry` cannot conform to `Equatable`/`Hashable` this way because /// (`Entry` cannot conform to `Equatable`/`Hashable` this way because
@@ -34,7 +33,6 @@ extension Trace.Entry {
return true return true
} }
} }
#endif // ENABLE_MOCKING
// To aid debugging, force failures to fatal error // To aid debugging, force failures to fatal error
internal var forceFatalFailures = false internal var forceFatalFailures = false
@@ -83,7 +81,6 @@ extension TestCase {
fail(message) fail(message)
} }
} }
#if ENABLE_MOCKING
func expectMatch( func expectMatch(
_ expected: Trace.Entry?, _ actual: Trace.Entry?, _ expected: Trace.Entry?, _ actual: Trace.Entry?,
_ message: String? = nil _ message: String? = nil
@@ -105,7 +102,6 @@ extension TestCase {
fail(message) fail(message)
} }
} }
#endif // ENABLE_MOCKING
func expectNil<T>( func expectNil<T>(
_ actual: T?, _ actual: T?,
_ message: String? = nil _ message: String? = nil
@@ -146,7 +142,6 @@ extension TestCase {
} }
#if ENABLE_MOCKING
internal struct MockTestCase: TestCase { internal struct MockTestCase: TestCase {
var file: StaticString var file: StaticString
var line: UInt var line: UInt
@@ -246,7 +241,6 @@ internal struct MockTestCase: TestCase {
} }
} }
} }
#endif // ENABLE_MOCKING
internal func withWindowsPaths(enabled: Bool, _ body: () -> ()) { internal func withWindowsPaths(enabled: Bool, _ body: () -> ()) {
_withWindowsPaths(enabled: enabled, body) _withWindowsPaths(enabled: enabled, body)