Open
Description
Description
swift-testing uses withVaList(_:)
in one spot and, when building for WASI/Wasm, runs into this error:
/swift-testing/Sources/Testing/Events/TimeValue.swift:87:79: error: cannot convert value of type 'CVaListPointer' to expected argument type '__isoc_va_list?' (aka 'Optional<UnsafeMutableRawPointer>')
_ = vsnprintf(buffer.baseAddress!, buffer.count, "%lld.%03d seconds", args)
Looks like either CVaListPointer
is typealiased incorrectly or needs to be implemented.
Reproduction
Try to build the following code for WASI/Wasm:
let string = withUnsafeTemporaryAllocation(of: CChar.self, capacity: 512) { buffer in
withVaList([CInt(123)]) { args in
_ = vsnprintf(buffer.baseAddress!, buffer.count, "%d", args)
}
return String(cString: buffer.baseAddress!)
}
print(string)
Expected behavior
Prints 123
.
Environment
SwiftWasm Swift version 5.10-dev (LLVM 5dc9d563e5a6cd2, Swift 3aaeb1a91e1c0a5)
Target: arm64-apple-darwin23.4.0
Additional information
No response