forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wasm] Annotate errno as SwiftPrivate by apinotes
This patch adds an apinotes file for SwiftWASILibc clang module to mark `errno` macro hidden from Swift code. This resolves ambiguity between the C macro definition and the Swift wrapper in WASILibc overlay module. This change installs the apinotes file to the resource directories for both lib/swift/apinotes and lib/swift_static/apinotes.
- Loading branch information
1 parent
432b070
commit 9537a2b
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Name: SwiftWASILibc | ||
Globals: | ||
# errno macro is importable but we provide explicit Swift wrapper | ||
- Name: errno | ||
SwiftPrivate: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// RUN: %target-swift-frontend -typecheck -swift-version 6 %s -verify | ||
// REQUIRES: executable_test | ||
// REQUIRES: OS=wasi | ||
|
||
import WASILibc | ||
|
||
// errno is a global thread-local variable, so it should be accessible | ||
// from any context. | ||
|
||
enum TestErrno { | ||
static func testSyncContext() { | ||
_ = errno | ||
errno = 0 | ||
} | ||
static func testAsyncContext() async { | ||
_ = errno | ||
errno = 0 | ||
} | ||
} |