[PATCH] D129362: Undeprecate ATOMIC_FLAG_INIT in C++
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 8 04:16:52 PDT 2022
aaron.ballman created this revision.
aaron.ballman added reviewers: clang-language-wg, erichkeane, cor3ntin, tambre, ldionne.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.
C++20 deprecated ATOMIC_FLAG_INIT thinking it was deprecated in C when it wasn't. It is expected to be undeprecated in C++23 as part of LWG3659 (https://wg21.link/LWG3659), which is currently Tentatively Ready as of yesterday.
I think similar changes should happen on the libc++ side, basically to undo parts of 4e730aeb731cb9b7116ed51bbef662d363f72b66 <https://reviews.llvm.org/rG4e730aeb731cb9b7116ed51bbef662d363f72b66>, so I've included some of the libc++ folks here to see if they agree.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129362
Files:
clang/docs/ReleaseNotes.rst
clang/lib/Headers/stdatomic.h
clang/test/Headers/stdatomic-deprecations.c
Index: clang/test/Headers/stdatomic-deprecations.c
===================================================================
--- clang/test/Headers/stdatomic-deprecations.c
+++ clang/test/Headers/stdatomic-deprecations.c
@@ -12,7 +12,6 @@
void func(void) {
_Atomic int i = ATOMIC_VAR_INIT(12); // expected-warning {{macro 'ATOMIC_VAR_INIT' has been marked as deprecated}} \
// expected-note at stdatomic.h:* {{macro marked 'deprecated' here}}
- #if defined(ATOMIC_FLAG_INIT) // cxx-warning {{macro 'ATOMIC_FLAG_INIT' has been marked as deprecated}} \
- // cxx-note at stdatomic.h:* {{macro marked 'deprecated' here}}
+ #if defined(ATOMIC_FLAG_INIT) // Ok, deprecated in C++20, undeprecated in C++23 via LWG4659.
#endif
}
Index: clang/lib/Headers/stdatomic.h
===================================================================
--- clang/lib/Headers/stdatomic.h
+++ clang/lib/Headers/stdatomic.h
@@ -158,10 +158,6 @@
typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
#define ATOMIC_FLAG_INIT { 0 }
-#if __cplusplus >= 202002L && !defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
-/* ATOMIC_FLAG_INIT was deprecated in C++20 but is not deprecated in C. */
-#pragma clang deprecated(ATOMIC_FLAG_INIT)
-#endif
/* These should be provided by the libc implementation. */
#ifdef __cplusplus
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -476,6 +476,7 @@
- Implemented `P2128R6: Multidimensional subscript operator <https://wg21.link/P2128R6>`_.
- Implemented `P0849R8: auto(x): decay-copy in the language <https://wg21.link/P0849R8>`_.
- Implemented `P2242R3: Non-literal variables (and labels and gotos) in constexpr functions <https://wg21.link/P2242R3>`_.
+- Implemented `LWG3659: Consider ATOMIC_FLAG_INIT undeprecation <https://wg21.link/LWG3659>`_.
CUDA/HIP Language Changes in Clang
----------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129362.443199.patch
Type: text/x-patch
Size: 2039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220708/bc96f79f/attachment.bin>
More information about the cfe-commits
mailing list