[PATCH] D112221: Mark ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT as deprecated
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 9 07:09:19 PST 2021
aaron.ballman added a comment.
In D112221#3118314 <https://reviews.llvm.org/D112221#3118314>, @Quuxplusone wrote:
> 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);
Thanks Arthur!
I don't know enough about libc++ to feel comfortable making those changes yet. For example, does libc++ need to work with other compilers than Clang (compilers which might give diagnostics if you fail to use `ATOMIC_VAR_INIT` in some language mode)? The deprecation is not really a DR, so should the uses be wrapped in language version checks, etc. Or are you saying I don't have to worry about any of that and I can rip this stuff out of libc++ with wild abandon?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112221/new/
https://reviews.llvm.org/D112221
More information about the cfe-commits
mailing list