Support C++23 atomic shims#941
Open
bc-lee wants to merge 1 commit into
Open
Conversation
In C++23, libc++'s <stdatomic.h> exposes std::atomic-based APIs instead of the C atomic interfaces that libdispatch's shim expects. That makes the existing _Atomic storage incompatible with atomic_load_explicit(), atomic_fetch_*(), and related calls when libdispatch is compiled as C++. Route libdispatch's internal atomic operations through private _dispatch_atomic_* aliases. Clang C++23 keeps _Atomic storage and uses __c11_atomic_* builtins directly. GCC C++23 uses plain storage with __atomic_* builtins so the shim does not depend on public <stdatomic.h> names in that mode. C and older C++ modes continue to use <stdatomic.h>.
Member
|
ibdispatch is a C library, not a C++ library, so I'm not sure I understand why this should be needed. |
Author
|
libdispatch is primarily a C library, but this repo does compile C++ code, including |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In C++23, libc++'s
<stdatomic.h>exposesstd::atomic-based APIs instead of the C atomic interfaces that libdispatch's shim expects. That makes the existing_Atomicstorage incompatible withatomic_load_explicit(),atomic_fetch_*(), and related calls whenlibdispatchis compiled as C++.Route
libdispatch's internal atomic operations through private_dispatch_atomic_*aliases. Clang C++23 keeps_Atomicstorage and uses__c11_atomic_*builtins directly. GCC C++23 uses plain storage with__atomic_*builtins so the shim does not depend on public<stdatomic.h>names in that mode. C and older C++ modes continue to use<stdatomic.h>.Fixes #940.