[PATCH] D112221: Mark ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT as deprecated
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 9 05:52:36 PST 2021
Quuxplusone added a comment.
If libc++ is using these macros, then I think it would be useful to include (the removal of) those uses in this PR.
../libcxx/include/atomic:#define ATOMIC_VAR_INIT(value) see below
../libcxx/include/atomic:#define ATOMIC_FLAG_INIT see below
../libcxx/include/atomic:#define ATOMIC_FLAG_INIT {false}
../libcxx/include/atomic:#define ATOMIC_VAR_INIT(__v) {__v}
../libcxx/src/barrier.cpp: __atomic_base<__barrier_phase_t> __phase = ATOMIC_VAR_INIT(0);
../libcxx/src/experimental/memory_resource.cpp: ATOMIC_VAR_INIT(&res_init.resources.new_delete_res);
../libcxx/src/ios.cpp:atomic<int> ios_base::__xindex_ = ATOMIC_VAR_INIT(0);
../libcxx/test/libcxx/atomics/atomics.flag/init_bool.pass.cpp:std::atomic_flag global = ATOMIC_FLAG_INIT;
../libcxx/test/std/atomics/atomics.flag/init.pass.cpp:// atomic_flag() = ATOMIC_FLAG_INIT;
../libcxx/test/std/atomics/atomics.flag/init.pass.cpp: std::atomic_flag f = ATOMIC_FLAG_INIT;
../libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp:// #define ATOMIC_VAR_INIT(value)
../libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp: std::atomic<int> v = ATOMIC_VAR_INIT(5);
../libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/ctor.pass.cpp: constexpr Atomic a = ATOMIC_VAR_INIT(t);
../libcxx/test/std/thread/futures/futures.async/async.pass.cpp:std::atomic_bool invoked = ATOMIC_VAR_INIT(false);
================
Comment at: clang/test/Headers/stdatomic-deprecations.c:11
+void func(void) {
+ (void)ATOMIC_VAR_INIT(12); // expected-warning {{macro 'ATOMIC_VAR_INIT' has been marked as deprecated}} \
+ // expected-note at stdatomic.h:* {{macro marked 'deprecated' here}}
----------------
This doesn't look like correct use of the `ATOMIC_VAR_INIT` macro. It should be initializing an atomic, yeah?
(Note for example that if you did `(void)ATOMIC_FLAG_INIT(12)`, even with libc++'s implementation, it would just fail with a syntax error, because `(void){12}` is not a valid expression AFAIK.)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112221/new/
https://reviews.llvm.org/D112221
More information about the cfe-commits
mailing list