[PATCH] [libcxx] Allow <atomic> to be used in c++03.
Eric Fiselier
eric at efcs.ca
Fri Nov 14 18:24:15 PST 2014
Hi mclow.lists, danalbert,
Everything in atomic works in C++03 except for `ATOMIC_VAR_INIT` and `ATOMIC_FLAG_INIT`. These macros are required to allow:
```
std::atomic_flag f = ATOMIC_FLAG_INIT;
// ATOMIC_VAR_INIT is defined as
#define ATOMIC_VAR_INIT {false}
```
In c++11 aggregate initialization to construct the atomic type. However in c++03 it uses copy initialization. Since atomic types are not copy-able this results in a compile error.
There doesn't seem to be a way to implement these macros in C++03. For that reason they are simply removed when `__cplusplus < 201103L`.
http://reviews.llvm.org/D6284
Files:
include/atomic
test/atomics/atomics.flag/init.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6284.16258.patch
Type: text/x-patch
Size: 10332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141115/66f482a9/attachment.bin>
More information about the cfe-commits
mailing list