Skip to content

Commit e81a385

Browse files
Merge pull request #5137 from robbertvanginkel/robbert/wasi-5.7-backport
[5.7] Add more consts from wasi-libc error.h & seek.h
2 parents 01e5a4e + 21287e7 commit e81a385

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

stdlib/public/Platform/WASI.swift.gyb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,34 @@ public let ${prefix}_TRUE_MIN = ${type}.leastNonzeroMagnitude
6565
public let MAP_FAILED: UnsafeMutableRawPointer! = UnsafeMutableRawPointer(bitPattern: -1)
6666

6767
// wasi-libc's error.h uses a macro that Swift can't import.
68+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EACCES'.")
69+
public let EACCES: Int32 = 2
70+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EDQUOT'.")
71+
public let EDQUOT: Int32 = 19
72+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EEXIST'.")
73+
public let EEXIST: Int32 = 20
74+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EFBIG'.")
75+
public let EFBIG: Int32 = 22
6876
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EINTR'.")
6977
public let EINTR: Int32 = 27
7078
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EINVAL'.")
7179
public let EINVAL: Int32 = 28
80+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.ENAMETOOLONG'.")
81+
public let ENAMETOOLONG: Int32 = 37
82+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.ENOENT'.")
83+
public let ENOENT: Int32 = 44
84+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.ENOSPC'.")
85+
public let ENOSPC: Int32 = 51
86+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EPERM'.")
87+
public let EPERM: Int32 = 63
88+
@available(*, deprecated, message: "Please use 'POSIXErrorCode.EROFS'.")
89+
public let EROFS: Int32 = 69
90+
91+
92+
// wasi-libc's _seek.h uses a macro that Swift can't import.
93+
// https://developer.apple.com/documentation/swift/using-imported-c-macros-in-swift
94+
// https://github.com/apple/swift/blob/c55b9cc87925c5d63a21d383ad23dff056d36607/lib/ClangImporter/ImportName.cpp#L2115-L2117
95+
// https://github.com/WebAssembly/wasi-libc/pull/148
96+
public let SEEK_SET: Int32 = 0
97+
public let SEEK_CUR: Int32 = 1
98+
public let SEEK_END: Int32 = 2

0 commit comments

Comments
 (0)