Skip to content

Conversation

@kateinoigakukun
Copy link
Member

Cover all va_list family of types just aliased by __builtin_va_list, including __isoc_va_list from wasi-libc. This enables proper C interop for variable argument functions on WASI targets.

Close #72398

Cover all va_list family of types just aliased by __builtin_va_list, including
__isoc_va_list from wasi-libc. This enables proper C interop for variable
argument functions on WASI targets.
@kateinoigakukun
Copy link
Member Author

@swift-ci smoke test

@@ -0,0 +1,18 @@
// RUN: %swift-frontend -target wasm32-unknown-wasip1 -parse-stdlib -module-name Swift -I %S/Inputs/custom-modules -typecheck %s
Copy link
Member Author

@kateinoigakukun kateinoigakukun Aug 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test that always checks with Wasm target because the alias issue happens only for targets where __builtin_va_list is defined as void * by Clang (TargetInfo::BuiltinVaListKind::VoidPtrBuiltinVaList).

@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Aug 31, 2025

@kateinoigakukun Would you have a moment to cherry-pick it for 6.2 after this PR is merged?

@kateinoigakukun
Copy link
Member Author

Yeap, I can do it if we want.

@MaxDesiatov MaxDesiatov added c interop Feature: Interoperability with C WebAssembly Platform: WebAssembly clang importer Area → compiler: The clang importer WASI WebAssembly System Interface support labels Sep 2, 2025
@MaxDesiatov MaxDesiatov merged commit 3f96cef into swiftlang:main Sep 2, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Swift for Wasm Sep 2, 2025
MaxDesiatov pushed a commit to MaxDesiatov/swift that referenced this pull request Sep 2, 2025
Cover all va_list family of types just aliased by __builtin_va_list, including __isoc_va_list from wasi-libc. This enables proper C interop for variable argument functions on WASI targets.

Close swiftlang#72398
# Conflicts:
#	test/ClangImporter/Inputs/custom-modules/module.modulemap
grynspan added a commit to swiftlang/swift-testing that referenced this pull request Sep 17, 2025
This PR removes a workaround on WASI where we were avoiding a call to
`withVaList()` because it miscompiled there. That problem was fixed by
swiftlang/swift#84029 and cherry-picked to 6.2.
grynspan added a commit to swiftlang/swift-testing that referenced this pull request Sep 17, 2025
This PR removes a workaround on WASI where we were avoiding a call to
`withVaList()` because it miscompiled there. That problem was fixed by
swiftlang/swift#84029. It was cherry-picked to
6.2, but does not appear to be fixed in 6.2 CI, so the change here only
applies to 6.3 onward.

### Checklist:

- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c interop Feature: Interoperability with C clang importer Area → compiler: The clang importer WASI WebAssembly System Interface support WebAssembly Platform: WebAssembly

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

WASI/Wasm: withVaList(_:) produces a va_list with the wrong type

3 participants