update atomics.h to be more fully C11/C++11 compliant#42152
Conversation
|
I couldn’t find anything in the standard saying that the pointer cast to atomic type is defined, or that the atomic typed are the same in c and c++ which was why I did not want to use them. Otoh, c++20 has https://en.cppreference.com/w/cpp/atomic/atomic_ref which should be well defined to do what we want here. I don’t know if there’s something like that added/proposed for c though… |
|
This is finally specified in C++23:
This came out of http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0943r6.html, and the existing bugs you mentioned are slowly being addressed in GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65146. Though those corner cases are relevant for common struct objects, but not for the primitive types we usually annotate here. OTOH, |
3e7f980 to
b900387
Compare
b900387 to
1439e17
Compare
1439e17 to
f448356
Compare
|
This needs a manual backport against #42255. |
|
Just point out that this has still not been backported since someone needs to do it manually (@barche, if you are interested in this, perhaps you can help out?) |
|
OK, how does this work in practice? Make a separate PR to merge into the |
|
againt |
Fixes #42098