Remove the repeated list of Darwin-based platforms

Replaced with a constant defined in the package manifest.
This commit is contained in:
Guillaume Lessard committed 2024-05-10 16:09:22 -07:00
1 parent c456f4186e
commit 7b14e48d0d
8 files changed
+41 -41

No files matched your search

+10 -10
View File
@@ -23,7 +23,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
@_alwaysEmitIntoClient
private init(_ raw: CInt) { self.init(rawValue: raw) }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Error. Not used.
@_alwaysEmitIntoClient
public static var notUsed: Errno { Errno(_ERRNO_NOT_USED) }
@@ -911,7 +911,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
@available(*, unavailable, renamed: "directoryNotEmpty")
public static var ENOTEMPTY: Errno { directoryNotEmpty }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Too many processes.
///
/// The corresponding C error is `EPROCLIM`.
@@ -968,7 +968,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
public static var ESTALE: Errno { staleNFSFileHandle }
// TODO: Add Linux's RPC equivalents
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// The structure of the remote procedure call (RPC) is bad.
///
@@ -1060,7 +1060,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
public static var ENOSYS: Errno { noFunction }
// BSD
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Inappropriate file type or format.
///
/// The file was the wrong type for the operation,
@@ -1075,7 +1075,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
public static var EFTYPE: Errno { badFileTypeOrFormat }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Authentication error.
///
/// The authentication ticket used to mount an NFS file system was invalid.
@@ -1102,7 +1102,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
public static var ENEEDAUTH: Errno { needAuthenticator }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Device power is off.
///
/// The corresponding C error is `EPWROFF`.
@@ -1142,7 +1142,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
public static var EOVERFLOW: Errno { overflow }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Bad executable or shared library.
///
/// The executable or shared library being referenced was malformed.
@@ -1246,7 +1246,7 @@ public struct Errno: RawRepresentable, Error, Hashable, Codable {
@available(*, unavailable, renamed: "illegalByteSequence")
public static var EILSEQ: Errno { illegalByteSequence }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Attribute not found.
///
/// The specified extended attribute doesn't exist.
@@ -1409,7 +1409,7 @@ extension Errno {
@available(*, unavailable, renamed: "tooManyRemoteLevels")
public static var EREMOTE: Errno { tooManyRemoteLevels }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// No such policy registered.
///
/// The corresponding C error is `ENOPOLICY`.
@@ -1443,7 +1443,7 @@ extension Errno {
public static var EOWNERDEAD: Errno { previousOwnerDied }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Interface output queue is full.
///
/// The corresponding C error is `EQFULL`.
+5 -5
View File
@@ -182,7 +182,7 @@ extension FileDescriptor {
@available(*, unavailable, renamed: "exclusiveCreate")
public static var O_EXCL: OpenOptions { exclusiveCreate }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Indicates that opening the file
/// atomically obtains a shared lock on the file.
///
@@ -250,7 +250,7 @@ extension FileDescriptor {
public static var O_DIRECTORY: OpenOptions { directory }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Indicates that opening the file
/// opens symbolic links instead of following them.
///
@@ -353,7 +353,7 @@ extension FileDescriptor {
// TODO: These are available on some versions of Linux with appropriate
// macro defines.
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
/// Indicates that the offset should be set
/// to the next hole after the specified number of bytes.
///
@@ -415,7 +415,7 @@ extension FileDescriptor.SeekOrigin
case .start: return "start"
case .current: return "current"
case .end: return "end"
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
case .nextHole: return "nextHole"
case .nextData: return "nextData"
#endif
@@ -434,7 +434,7 @@ extension FileDescriptor.OpenOptions
/// A textual representation of the open options.
@inline(never)
public var description: String {
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
let descriptions: [(Element, StaticString)] = [
(.nonBlocking, ".nonBlocking"),
(.append, ".append"),
+1 -1
View File
@@ -14,7 +14,7 @@
@available(*, deprecated, renamed: "CInterop.Mode")
public typealias CModeT = CInterop.Mode
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
import Darwin
#elseif os(Windows)
import CSystem
+13 -13
View File
@@ -11,7 +11,7 @@
// they can be used anywhere without imports and without confusion to
// unavailable local decls.
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
import Darwin
#elseif os(Windows)
import CSystem
@@ -26,7 +26,7 @@ import Musl
#endif
// MARK: errno
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _ERRNO_NOT_USED: CInt { 0 }
#endif
@@ -272,7 +272,7 @@ internal var _EHOSTUNREACH: CInt { EHOSTUNREACH }
@_alwaysEmitIntoClient
internal var _ENOTEMPTY: CInt { ENOTEMPTY }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _EPROCLIM: CInt { EPROCLIM }
#endif
@@ -313,7 +313,7 @@ internal var _EREMOTE: CInt {
#endif
}
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _EBADRPC: CInt { EBADRPC }
@@ -336,7 +336,7 @@ internal var _ENOLCK: CInt { ENOLCK }
@_alwaysEmitIntoClient
internal var _ENOSYS: CInt { ENOSYS }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _EFTYPE: CInt { EFTYPE }
@@ -358,7 +358,7 @@ internal var _EDEVERR: CInt { EDEVERR }
internal var _EOVERFLOW: CInt { EOVERFLOW }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _EBADEXEC: CInt { EBADEXEC }
@@ -386,7 +386,7 @@ internal var _ENOMSG: CInt { ENOMSG }
@_alwaysEmitIntoClient
internal var _EILSEQ: CInt { EILSEQ }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _ENOATTR: CInt { ENOATTR }
#endif
@@ -420,7 +420,7 @@ internal var _ETIME: CInt { ETIME }
@_alwaysEmitIntoClient
internal var _EOPNOTSUPP: CInt { EOPNOTSUPP }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _ENOPOLICY: CInt { ENOPOLICY }
#endif
@@ -433,7 +433,7 @@ internal var _ENOTRECOVERABLE: CInt { ENOTRECOVERABLE }
internal var _EOWNERDEAD: CInt { EOWNERDEAD }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _EQFULL: CInt { EQFULL }
@@ -468,7 +468,7 @@ internal var _O_NONBLOCK: CInt { O_NONBLOCK }
@_alwaysEmitIntoClient
internal var _O_APPEND: CInt { O_APPEND }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _O_SHLOCK: CInt { O_SHLOCK }
@@ -494,7 +494,7 @@ internal var _O_TRUNC: CInt { O_TRUNC }
@_alwaysEmitIntoClient
internal var _O_EXCL: CInt { O_EXCL }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _O_EVTONLY: CInt { O_EVTONLY }
#endif
@@ -508,7 +508,7 @@ internal var _O_NOCTTY: CInt { O_NOCTTY }
internal var _O_DIRECTORY: CInt { O_DIRECTORY }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _O_SYMLINK: CInt { O_SYMLINK }
#endif
@@ -527,7 +527,7 @@ internal var _SEEK_CUR: CInt { SEEK_CUR }
@_alwaysEmitIntoClient
internal var _SEEK_END: CInt { SEEK_END }
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
@_alwaysEmitIntoClient
internal var _SEEK_HOLE: CInt { SEEK_HOLE }
+2 -2
View File
@@ -12,7 +12,7 @@
// TODO: Should CSystem just include all the header files we need?
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
import Darwin
#elseif os(Windows)
import CSystem
@@ -31,7 +31,7 @@ internal typealias _COffT = off_t
// MARK: syscalls and variables
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
internal var system_errno: CInt {
get { Darwin.errno }
set { Darwin.errno = newValue }
+1 -1
View File
@@ -7,7 +7,7 @@
See https://swift.org/LICENSE.txt for license information
*/
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
import Darwin
#elseif canImport(Glibc)
import Glibc
+7 -7
View File
@@ -84,7 +84,7 @@ final class ErrnoTest: XCTestCase {
XCTAssert(EHOSTUNREACH == Errno.noRouteToHost.rawValue)
XCTAssert(ENOTEMPTY == Errno.directoryNotEmpty.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssert(EPROCLIM == Errno.tooManyProcesses.rawValue)
#endif
@@ -92,7 +92,7 @@ final class ErrnoTest: XCTestCase {
XCTAssert(EDQUOT == Errno.diskQuotaExceeded.rawValue)
XCTAssert(ESTALE == Errno.staleNFSFileHandle.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssert(EBADRPC == Errno.rpcUnsuccessful.rawValue)
XCTAssert(ERPCMISMATCH == Errno.rpcVersionMismatch.rawValue)
XCTAssert(EPROGUNAVAIL == Errno.rpcProgramUnavailable.rawValue)
@@ -103,7 +103,7 @@ final class ErrnoTest: XCTestCase {
XCTAssert(ENOLCK == Errno.noLocks.rawValue)
XCTAssert(ENOSYS == Errno.noFunction.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssert(EFTYPE == Errno.badFileTypeOrFormat.rawValue)
XCTAssert(EAUTH == Errno.authenticationError.rawValue)
XCTAssert(ENEEDAUTH == Errno.needAuthenticator.rawValue)
@@ -113,7 +113,7 @@ final class ErrnoTest: XCTestCase {
XCTAssert(EOVERFLOW == Errno.overflow.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssert(EBADEXEC == Errno.badExecutable.rawValue)
XCTAssert(EBADARCH == Errno.badCPUType.rawValue)
XCTAssert(ESHLIBVERS == Errno.sharedLibraryVersionMismatch.rawValue)
@@ -125,7 +125,7 @@ final class ErrnoTest: XCTestCase {
XCTAssert(ENOMSG == Errno.noMessage.rawValue)
XCTAssert(EILSEQ == Errno.illegalByteSequence.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssert(ENOATTR == Errno.attributeNotFound.rawValue)
#endif
@@ -144,14 +144,14 @@ final class ErrnoTest: XCTestCase {
XCTAssert(ETOOMANYREFS == Errno.tooManyReferences.rawValue)
XCTAssert(EREMOTE == Errno.tooManyRemoteLevels.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssert(ENOPOLICY == Errno.noSuchPolicy.rawValue)
#endif
XCTAssert(ENOTRECOVERABLE == Errno.notRecoverable.rawValue)
XCTAssert(EOWNERDEAD == Errno.previousOwnerDied.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssert(EQFULL == Errno.outputQueueFull.rawValue)
XCTAssert(ELAST == Errno.lastErrnoValue.rawValue)
#endif
+2 -2
View File
@@ -38,7 +38,7 @@ final class FileDescriptorTest: XCTestCase {
XCTAssertEqual(O_CLOEXEC, FileDescriptor.OpenOptions.closeOnExec.rawValue)
// BSD only
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssertEqual(O_SHLOCK, FileDescriptor.OpenOptions.sharedLock.rawValue)
XCTAssertEqual(O_EXLOCK, FileDescriptor.OpenOptions.exclusiveLock.rawValue)
XCTAssertEqual(O_SYMLINK, FileDescriptor.OpenOptions.symlink.rawValue)
@@ -49,7 +49,7 @@ final class FileDescriptorTest: XCTestCase {
XCTAssertEqual(SEEK_CUR, FileDescriptor.SeekOrigin.current.rawValue)
XCTAssertEqual(SEEK_END, FileDescriptor.SeekOrigin.end.rawValue)
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
#if SYSTEM_PACKAGE_DARWIN
XCTAssertEqual(SEEK_HOLE, FileDescriptor.SeekOrigin.nextHole.rawValue)
XCTAssertEqual(SEEK_DATA, FileDescriptor.SeekOrigin.nextData.rawValue)
#endif