apple / swift-atomics

Low-level atomic operations for Swift
Apache License 2.0
1.06k stars 50 forks source link

[1.2.0] _sa_retain_n, _sa_release_n declarations trigger a calling convention mismatch #108

Closed lorentey closed 9 months ago

lorentey commented 10 months ago

In https://github.com/apple/swift/issues/69264, @kateinoigakukun notes that the Swift compiler does not correctly observe __attribute__((swiftcall)) attributes in the current version of the _AtomicsShims module.

The original intention was that these would get redeclared using @_silgen_name signatures in Swift, but that got lost while juggling all the build variants.

rdar://119327825

lorentey commented 10 months ago

We do want to keep using SWIFT_CC & @_silgen_name for the single-module variant of swift-atomics (as used by the Xcode project), but for the multi-module package, I think it will be best to revert to regular C declarations.

The ATOMICS_SINGLE_MODULE condition is visible in the _AtomicsShims module, so it should be possible to conditionalize the declarations of these two functions, adding/removing SWIFT_CC as needed.