-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[embedded] Use __has_feature(swiftcc)
to detect Swift calling convention
#72345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[embedded] Use __has_feature(swiftcc)
to detect Swift calling convention
#72345
Conversation
If https://github.com/llvm/llvm-project/pull/85347/files causes |
cc3c83a
to
864779e
Compare
Please test with following PR: @swift-ci Please test WebAssembly |
Please test with following PR: @swift-ci Please test |
// RUN: %clang -target wasm32-unknown-none-wasm %t/check.o %t/rt.c -nostdlib -o %t/check.wasm | ||
// RUN: %target-run %t/check.wasm | ||
// REQUIRES: executable_test | ||
// REQUIRES: CPU=wasm32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point me to a CI job that actually runs these executable WASM tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasm CI runs executable tests on WasmKit runtime: https://ci.swift.org/job/swift-PR-Linux-crosscompile-wasm/31
@@ -28,8 +28,7 @@ | |||
extern "C" { | |||
#endif | |||
|
|||
// FIXME: Replace with __has_feature(swiftcc) once that's added to Clang. | |||
#if __has_feature(swiftasynccc) | |||
#if __has_extension(swiftcc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use __has_feature(swiftasynccc) || __has_extension(swiftcc)
to be compatible with older compilers for a while?
@compnerd Do all windows builds use a just built compiler such that this is not a concern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth being conservative here.
…vention This change replaces the use of `__has_feature(swiftasynccc)` with `__has_extension(swiftcc)` to detect the SwiftCC availability. The former condition works fine for most platforms that support both SwiftCC and SwiftAsyncCC or neither, but it fails for WebAssembly, which supports SwiftCC but not SwiftAsyncCC. We add `swiftcc` extension to Clang, and use it here.
864779e
to
5c26620
Compare
Please test with following PR: @swift-ci Please test |
5c26620
to
1e11d0f
Compare
Please test with following PR: @swift-ci Please test |
Please test with following PR: @swift-ci Please test WebAssembly |
Hmm, https://ci-external.swift.org/job/swift-PR-windows/23188/console
// SWIFT_CC(swiftasync) is the Swift async calling convention.
// We assume that it supports mandatory tail call elimination.
#if __has_attribute(swiftasynccall) && (__has_feature(swiftasynccc) || __has_extension(swiftasynccc))
#define SWIFT_CC_swiftasync __attribute__((swiftasynccall))
#else
#define SWIFT_CC_swiftasync SWIFT_CC_swift
#endif |
`swiftasynccc` is now an extension instead of a feature, so we should use `__has_extension` to detect its availability.
1e11d0f
to
1f91d95
Compare
Please test with following PR: @swift-ci Please test |
Please test with following PR: @swift-ci Please test WebAssembly |
Please test with following PR: @swift-ci Please test |
Please test with following PR: @swift-ci Please test WebAssembly |
This change replaces the use of
__has_feature(swiftasynccc)
with__has_feature(swiftcc)
to detect the SwiftCC availability. The former condition works fine for most platforms that support both SwiftCC and SwiftAsyncCC or neither, but it fails for WebAssembly, which supports SwiftCC but not SwiftAsyncCC.This change depends on llvm/llvm-project#85347
Close #72343