diff --git a/stdlib/public/Platform/Platform.swift b/stdlib/public/Platform/Platform.swift index 0c2d63a0cffdb..ca7417c53574b 100644 --- a/stdlib/public/Platform/Platform.swift +++ b/stdlib/public/Platform/Platform.swift @@ -84,6 +84,11 @@ func _convertDarwinBooleanToBool(_ x: DarwinBoolean) -> Bool { #endif +// wasi-libc defines `errno` in a way ClangImporter can understand, so we don't +// need to define shims for it. On the contrary, if we define the shim, we will +// get an ambiguity error when importing WASILibc module and SwiftWASILibc Clang +// module (or a Clang module that re-exports SwiftWASILibc). +#if !os(WASI) //===----------------------------------------------------------------------===// // sys/errno.h //===----------------------------------------------------------------------===// @@ -96,6 +101,7 @@ public var errno : Int32 { return _swift_stdlib_setErrno(val) } } +#endif //===----------------------------------------------------------------------===// diff --git a/stdlib/public/Platform/WASILibc.swift.gyb b/stdlib/public/Platform/WASILibc.swift.gyb index f3d5f2486701a..9331e3f6a8420 100644 --- a/stdlib/public/Platform/WASILibc.swift.gyb +++ b/stdlib/public/Platform/WASILibc.swift.gyb @@ -73,6 +73,7 @@ posix_error_codes = [ "EADDRNOTAVAIL", "EAFNOSUPPORT", "EAGAIN", + "EWOULDBLOCK", "EALREADY", "EBADF", "EBADMSG", @@ -125,6 +126,7 @@ posix_error_codes = [ "ENOTRECOVERABLE", "ENOTSOCK", "ENOTSUP", + "EOPNOTSUPP", "ENOTTY", "ENXIO", "EOVERFLOW",