-
Notifications
You must be signed in to change notification settings - Fork 52
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
swift-atomics uses non-standard _Atomic(bool)
operations
#37
Comments
For now, I'm going to |
Per apple#37, we currently happen to use some non-standard C atomics that only work in Clang; to prevent issues when this module gets compiled using other compilers, `#ifdef` out all the actual shims, leaving only the definitions for `retain_n`/`release_n`. (For example, CMake builds the shims module using the system C compiler by default, which is usually GCC on Linux.)
Per apple#37, we currently happen to use some non-standard C atomics that only work in Clang; to prevent issues when this module gets compiled using other compilers, `#ifdef` out all the actual shims, leaving only the definitions for `retain_n`/`release_n`. (For example, CMake builds the shims module using the system C compiler by default, which is usually GCC on Linux.)
Interesting. I had relied on cppreference to be correct, and assumed I did not need to read the standard. |
CMake builds not using a swift-toolchain-compatible clang seems like a bigger problem, since System and Atomics and Numerics would all benefit considerably from a known C environment. |
@stephentyrone - at the very least, MSVC needs to be supported as a C compiler. There are subtle bugs in clang/LLVM when it comes to some platforms, and so assuming a swift toolchain compatible clang is just as big an issue IMO. |
The current Meanwhile, #74 starts walking towards getting rid of the C module altogether. It'll require compiler and stdlib changes to land; I'm going to do my best to deliver them. The use of non-standard Closing. |
#74 refactored things so that |
Swift Atomics currently exposes and/xor/or operations on booleans, and maps them to
atomic_fetch_XXX_explicit
calls in C. However, C17 does not define these operations on_Atomic(_Bool)
; it only defines them for other atomic integer types.This is silently accepted by Clang, but it causes build issues when the
_AtomicsShims
module is compiled with GCC, such as with CMake.Review
Bool
's atomic operations and figure out if we should deprecateloadThenLogicalOr
and friends, or if we can continue exposing them (with this implementation or throughcompareExchange
).The text was updated successfully, but these errors were encountered: