Skip to content

Commit 629aa83

Browse files
Merge pull request #75798 from kateinoigakukun/yt/backport-errno-fixes-6.0
2 parents 8aaede8 + 878cdc5 commit 629aa83

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

stdlib/public/Platform/Platform.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ func _convertDarwinBooleanToBool(_ x: DarwinBoolean) -> Bool {
8484

8585
#endif
8686

87+
// wasi-libc defines `errno` in a way ClangImporter can understand, so we don't
88+
// need to define shims for it. On the contrary, if we define the shim, we will
89+
// get an ambiguity error when importing WASILibc module and SwiftWASILibc Clang
90+
// module (or a Clang module that re-exports SwiftWASILibc).
91+
#if !os(WASI)
8792
//===----------------------------------------------------------------------===//
8893
// sys/errno.h
8994
//===----------------------------------------------------------------------===//
@@ -96,6 +101,7 @@ public var errno : Int32 {
96101
return _swift_stdlib_setErrno(val)
97102
}
98103
}
104+
#endif
99105

100106

101107
//===----------------------------------------------------------------------===//

stdlib/public/Platform/WASILibc.swift.gyb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ posix_error_codes = [
7373
"EADDRNOTAVAIL",
7474
"EAFNOSUPPORT",
7575
"EAGAIN",
76+
"EWOULDBLOCK",
7677
"EALREADY",
7778
"EBADF",
7879
"EBADMSG",
@@ -125,6 +126,7 @@ posix_error_codes = [
125126
"ENOTRECOVERABLE",
126127
"ENOTSOCK",
127128
"ENOTSUP",
129+
"EOPNOTSUPP",
128130
"ENOTTY",
129131
"ENXIO",
130132
"EOVERFLOW",

0 commit comments

Comments
 (0)