atomic: Update to N3000.

2009-12-20  Benjamin Kosnik  <bkoz@redhat.com>

	* include/std/atomic: Update to N3000.
	* include/bits/atomic_0.h: Same.
	* include/bits/atomic_2.h: Same.
	* include/c_global/cstdatomic: Move...
	* include/bits/atomic_base.h: ...here.
	* include/c_compatibility/stdatomic.h: Just include atomic_base.h.
	* include/precompiled/stdc++.h: Adjust includes.
	* include/Makefile.am: Adjust files.
	* include/Makefile.in: Regenerate.
	* include/std/future: Adjust.
	* src/atomic.cc: Adjust, adjust exports for compatibility.
	* src/compatibility.cc: Move C++0x stuff...
	* src/compatibility-c++0x.cc: ...here.

	* doc/xml/manual/using.xml: Update.
	* doc/xml/manual/status_cxx200x.xml: Update.
	* doc/doxygen/user.cfg.in: Update.

	* testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic_address/cons/single_value.cc: Same.
	* testsuite/29_atomics/atomic_address/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic_address/cons/default.cc: Same.
	* testsuite/29_atomics/atomic_address/cons/aggregate.cc: Same.
	* testsuite/29_atomics/atomic_address/requirements/
	standard_layout.cc: Same.
	* testsuite/29_atomics/atomic_address/requirements/trivial.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/single_value.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/default.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/copy_list.cc: Same.
	* testsuite/29_atomics/atomic_integral/cons/direct_list.cc: Same.
	* testsuite/29_atomics/atomic_integral/requirements/
	standard_layout.cc: Same.
	* testsuite/29_atomics/atomic_integral/requirements/trivial.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/
	integral_assignment.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/increment.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/bitwise.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/decrement.cc: Same.
	* testsuite/29_atomics/atomic_integral/operators/
	integral_conversion.cc: Same.
	* testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic_flag/cons/default.cc: Same.
	* testsuite/29_atomics/atomic_flag/cons/aggregate.cc: Same.
	* testsuite/29_atomics/atomic_flag/requirements/
	standard_layout.cc: Same.
	* testsuite/29_atomics/atomic_flag/requirements/trivial.cc: Same.
	* testsuite/29_atomics/atomic_flag/clear/1.cc: Same.
	* testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
	* testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Same.
	* testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
	* testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Same.
	* testsuite/29_atomics/headers/stdatomic.h/functions.c
	* testsuite/29_atomics/atomic/cons/assign_neg.cc: Same.
	* testsuite/29_atomics/atomic/cons/single_value.cc: Same.
	* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
	* testsuite/29_atomics/atomic/cons/default.cc: Same.
	* testsuite/29_atomics/atomic/cons/copy_list.cc: Same.
	* testsuite/29_atomics/atomic/cons/direct_list.cc: Same.
	* testsuite/29_atomics/atomic/requirements/explicit_instantiation/
	1.cc: Same.
	* testsuite/29_atomics/atomic/requirements/base_classes.cc: Same.
	* testsuite/29_atomics/atomic/operators/integral_assignment.cc: Same.
	* testsuite/29_atomics/atomic/operators/integral_conversion.cc: Same.
	* testsuite/util/testsuite_common_types.h: Adjust.

	* testsuite/29_atomics/headers/cstdatomic: Move and adjust...
	* testsuite/29_atomics/headers/atomic: ...here.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Same.
	* testsuite/29_atomics/headers/atomic/functions_std_c++0x.cc: Same.
	* testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc: Same.
	* testsuite/29_atomics/headers/atomic/macros.cc: Same.

	* testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Add.
	* testsuite/29_atomics/atomic/cons/user_pod.cc: Add.

From-SVN: r155377
This commit is contained in:
Benjamin Kosnik 2009-12-21 19:00:34 +00:00 committed by Benjamin Kosnik
parent dcc1e1fab4
commit afd88205d8
68 changed files with 1001 additions and 811 deletions

View file

@ -1,3 +1,86 @@
2009-12-20 Benjamin Kosnik <bkoz@redhat.com>
* include/std/atomic: Update to N3000.
* include/bits/atomic_0.h: Same.
* include/bits/atomic_2.h: Same.
* include/c_global/cstdatomic: Move...
* include/bits/atomic_base.h: ...here.
* include/c_compatibility/stdatomic.h: Just include atomic_base.h.
* include/precompiled/stdc++.h: Adjust includes.
* include/Makefile.am: Adjust files.
* include/Makefile.in: Regenerate.
* include/std/future: Adjust.
* src/atomic.cc: Adjust, adjust exports for compatibility.
* src/compatibility.cc: Move C++0x stuff...
* src/compatibility-c++0x.cc: ...here.
* doc/xml/manual/using.xml: Update.
* doc/xml/manual/status_cxx200x.xml: Update.
* doc/doxygen/user.cfg.in: Update.
* testsuite/29_atomics/atomic_address/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic_address/cons/single_value.cc: Same.
* testsuite/29_atomics/atomic_address/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic_address/cons/default.cc: Same.
* testsuite/29_atomics/atomic_address/cons/aggregate.cc: Same.
* testsuite/29_atomics/atomic_address/requirements/
standard_layout.cc: Same.
* testsuite/29_atomics/atomic_address/requirements/trivial.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/single_value.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/default.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/copy_list.cc: Same.
* testsuite/29_atomics/atomic_integral/cons/direct_list.cc: Same.
* testsuite/29_atomics/atomic_integral/requirements/
standard_layout.cc: Same.
* testsuite/29_atomics/atomic_integral/requirements/trivial.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/
integral_assignment.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/increment.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/bitwise.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/decrement.cc: Same.
* testsuite/29_atomics/atomic_integral/operators/
integral_conversion.cc: Same.
* testsuite/29_atomics/atomic_flag/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic_flag/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic_flag/cons/default.cc: Same.
* testsuite/29_atomics/atomic_flag/cons/aggregate.cc: Same.
* testsuite/29_atomics/atomic_flag/requirements/
standard_layout.cc: Same.
* testsuite/29_atomics/atomic_flag/requirements/trivial.cc: Same.
* testsuite/29_atomics/atomic_flag/clear/1.cc: Same.
* testsuite/29_atomics/atomic_flag/test_and_set/explicit.c
* testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc: Same.
* testsuite/29_atomics/atomic_flag/test_and_set/implicit.c
* testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc: Same.
* testsuite/29_atomics/headers/stdatomic.h/functions.c
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Same.
* testsuite/29_atomics/atomic/cons/single_value.cc: Same.
* testsuite/29_atomics/atomic/cons/copy_neg.cc: Same.
* testsuite/29_atomics/atomic/cons/default.cc: Same.
* testsuite/29_atomics/atomic/cons/copy_list.cc: Same.
* testsuite/29_atomics/atomic/cons/direct_list.cc: Same.
* testsuite/29_atomics/atomic/requirements/explicit_instantiation/
1.cc: Same.
* testsuite/29_atomics/atomic/requirements/base_classes.cc: Same.
* testsuite/29_atomics/atomic/operators/integral_assignment.cc: Same.
* testsuite/29_atomics/atomic/operators/integral_conversion.cc: Same.
* testsuite/util/testsuite_common_types.h: Adjust.
* testsuite/29_atomics/headers/cstdatomic: Move and adjust...
* testsuite/29_atomics/headers/atomic: ...here.
* testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Same.
* testsuite/29_atomics/headers/atomic/functions_std_c++0x.cc: Same.
* testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc: Same.
* testsuite/29_atomics/headers/atomic/macros.cc: Same.
* testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Add.
* testsuite/29_atomics/atomic/cons/user_pod.cc: Add.
2009-12-18 Jimmy Guo <jguo@yahoo-inc.com> 2009-12-18 Jimmy Guo <jguo@yahoo-inc.com>
PR libstdc++/40088 PR libstdc++/40088

View file

@ -580,6 +580,7 @@ INPUT = @srcdir@/doc/doxygen/doxygroups.cc \
@srcdir@/libsupc++/typeinfo \ @srcdir@/libsupc++/typeinfo \
include/algorithm \ include/algorithm \
include/array \ include/array \
include/atomic \
include/bitset \ include/bitset \
include/chrono \ include/chrono \
include/complex \ include/complex \
@ -635,7 +636,6 @@ INPUT = @srcdir@/doc/doxygen/doxygroups.cc \
include/csetjmp \ include/csetjmp \
include/csignal \ include/csignal \
include/cstdarg \ include/cstdarg \
include/cstdatomic \
include/cstdbool \ include/cstdbool \
include/cstddef \ include/cstddef \
include/cstdint \ include/cstdint \

View file

@ -2200,7 +2200,7 @@ particular release.
</row> </row>
<row> <row>
<entry>29.2</entry> <entry>29.2</entry>
<entry>Header <code>&lt;cstdatomic&gt;</code> synopsis</entry> <entry>Header <code>&lt;atomic&gt;</code> synopsis</entry>
<entry>Y</entry> <entry>Y</entry>
<entry></entry> <entry></entry>
</row> </row>

View file

@ -329,24 +329,23 @@ mode, i.e. <literal>-std=c++0x</literal> or <literal>-std=gnu++0x</literal>.
<entry><filename class="headerfile">csetjmp</filename></entry> <entry><filename class="headerfile">csetjmp</filename></entry>
<entry><filename class="headerfile">csignal</filename></entry> <entry><filename class="headerfile">csignal</filename></entry>
<entry><filename class="headerfile">cstdarg</filename></entry> <entry><filename class="headerfile">cstdarg</filename></entry>
<entry><filename class="headerfile">cstdatomic</filename></entry> <entry><filename class="headerfile">cstdbool</filename></entry>
</row> </row>
<row> <row>
<entry><filename class="headerfile">cstdbool</filename></entry>
<entry><filename class="headerfile">cstddef</filename></entry> <entry><filename class="headerfile">cstddef</filename></entry>
<entry><filename class="headerfile">cstdint</filename></entry> <entry><filename class="headerfile">cstdint</filename></entry>
<entry><filename class="headerfile">cstdlib</filename></entry> <entry><filename class="headerfile">cstdlib</filename></entry>
<entry><filename class="headerfile">cstdio</filename></entry> <entry><filename class="headerfile">cstdio</filename></entry>
<entry><filename class="headerfile">cstring</filename></entry>
</row> </row>
<row> <row>
<entry><filename class="headerfile">cstring</filename></entry>
<entry><filename class="headerfile">ctgmath</filename></entry> <entry><filename class="headerfile">ctgmath</filename></entry>
<entry><filename class="headerfile">ctime</filename></entry> <entry><filename class="headerfile">ctime</filename></entry>
<entry><filename class="headerfile">cuchar</filename></entry> <entry><filename class="headerfile">cuchar</filename></entry>
<entry><filename class="headerfile">cwchar</filename></entry> <entry><filename class="headerfile">cwchar</filename></entry>
<entry><filename class="headerfile">cwctype</filename></entry>
</row> </row>
<row> <row>
<entry><filename class="headerfile">cwctype</filename></entry>
<entry><filename class="headerfile">stdatomic.h</filename></entry> <entry><filename class="headerfile">stdatomic.h</filename></entry>
</row> </row>

View file

@ -29,6 +29,7 @@ std_builddir = .
std_headers = \ std_headers = \
${std_srcdir}/algorithm \ ${std_srcdir}/algorithm \
${std_srcdir}/array \ ${std_srcdir}/array \
${std_srcdir}/atomic \
${std_srcdir}/bitset \ ${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \ ${std_srcdir}/c++0x_warning.h \
${std_srcdir}/chrono \ ${std_srcdir}/chrono \
@ -78,6 +79,7 @@ bits_builddir = ./bits
bits_headers = \ bits_headers = \
${bits_srcdir}/algorithmfwd.h \ ${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \ ${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \ ${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \ ${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \ ${bits_srcdir}/atomic_0.h \
@ -641,7 +643,6 @@ c_base_headers = \
${c_base_srcdir}/csetjmp \ ${c_base_srcdir}/csetjmp \
${c_base_srcdir}/csignal \ ${c_base_srcdir}/csignal \
${c_base_srcdir}/cstdarg \ ${c_base_srcdir}/cstdarg \
${c_base_srcdir}/cstdatomic \
${c_base_srcdir}/cstdbool \ ${c_base_srcdir}/cstdbool \
${c_base_srcdir}/cstddef \ ${c_base_srcdir}/cstddef \
${c_base_srcdir}/cstdint \ ${c_base_srcdir}/cstdint \

View file

@ -271,6 +271,7 @@ std_builddir = .
std_headers = \ std_headers = \
${std_srcdir}/algorithm \ ${std_srcdir}/algorithm \
${std_srcdir}/array \ ${std_srcdir}/array \
${std_srcdir}/atomic \
${std_srcdir}/bitset \ ${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \ ${std_srcdir}/c++0x_warning.h \
${std_srcdir}/chrono \ ${std_srcdir}/chrono \
@ -320,6 +321,7 @@ bits_builddir = ./bits
bits_headers = \ bits_headers = \
${bits_srcdir}/algorithmfwd.h \ ${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \ ${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \ ${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \ ${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \ ${bits_srcdir}/atomic_0.h \
@ -881,7 +883,6 @@ c_base_headers = \
${c_base_srcdir}/csetjmp \ ${c_base_srcdir}/csetjmp \
${c_base_srcdir}/csignal \ ${c_base_srcdir}/csignal \
${c_base_srcdir}/cstdarg \ ${c_base_srcdir}/cstdarg \
${c_base_srcdir}/cstdatomic \
${c_base_srcdir}/cstdbool \ ${c_base_srcdir}/cstdbool \
${c_base_srcdir}/cstddef \ ${c_base_srcdir}/cstddef \
${c_base_srcdir}/cstdint \ ${c_base_srcdir}/cstdint \

View file

@ -42,26 +42,26 @@ namespace __atomic0
// Implementation specific defines. // Implementation specific defines.
#define _ATOMIC_LOAD_(__a, __x) \ #define _ATOMIC_LOAD_(__a, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \ __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \ __atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \ __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
atomic_flag_clear_explicit(__g, __x); \ atomic_flag_clear_explicit(__g, __x); \
__r; }) __r; })
#define _ATOMIC_STORE_(__a, __m, __x) \ #define _ATOMIC_STORE_(__a, __m, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \ __typeof__(__m) __v = (__m); \
volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \ __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \ __atomic_flag_wait_explicit(__g, __x); \
*__p = __v; \ *__p = __v; \
atomic_flag_clear_explicit(__g, __x); \ atomic_flag_clear_explicit(__g, __x); \
__v; }) __v; })
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \ #define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \ __typeof__(__m) __v = (__m); \
volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \ __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \ __atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \ __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
*__p __o __v; \ *__p __o __v; \
@ -69,11 +69,11 @@ namespace __atomic0
__r; }) __r; })
#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \ #define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \ ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__e) __q = (__e); \ __typeof__(__e) __q = (__e); \
__typeof__(__m) __v = (__m); \ __typeof__(__m) __v = (__m); \
bool __r; \ bool __r; \
volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \ __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \ __atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \ __typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
if (__t__ == *__q) { *__p = __v; __r = true; } \ if (__t__ == *__q) { *__p = __v; __r = true; } \
@ -87,16 +87,16 @@ namespace __atomic0
atomic_flag() = default; atomic_flag() = default;
~atomic_flag() = default; ~atomic_flag() = default;
atomic_flag(const atomic_flag&) = delete; atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) volatile = delete;
// Conversion to ATOMIC_FLAG_INIT. // Conversion to ATOMIC_FLAG_INIT.
atomic_flag(bool __i): __atomic_flag_base({ __i }) { } atomic_flag(bool __i): __atomic_flag_base({ __i }) { }
bool bool
test_and_set(memory_order __m = memory_order_seq_cst) volatile; test_and_set(memory_order __m = memory_order_seq_cst);
void void
clear(memory_order __m = memory_order_seq_cst) volatile; clear(memory_order __m = memory_order_seq_cst);
}; };
/// 29.4.2, address types /// 29.4.2, address types
@ -109,16 +109,16 @@ namespace __atomic0
atomic_address() = default; atomic_address() = default;
~atomic_address() = default; ~atomic_address() = default;
atomic_address(const atomic_address&) = delete; atomic_address(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) = delete; atomic_address& operator=(const atomic_address&) volatile = delete;
atomic_address(void* __v) { _M_i = __v; } atomic_address(void* __v) { _M_i = __v; }
bool bool
is_lock_free() const volatile is_lock_free() const
{ return false; } { return false; }
void void
store(void* __v, memory_order __m = memory_order_seq_cst) volatile store(void* __v, memory_order __m = memory_order_seq_cst)
{ {
__glibcxx_assert(__m != memory_order_acquire); __glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -127,7 +127,7 @@ namespace __atomic0
} }
void* void*
load(memory_order __m = memory_order_seq_cst) const volatile load(memory_order __m = memory_order_seq_cst) const
{ {
__glibcxx_assert(__m != memory_order_release); __glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -135,12 +135,12 @@ namespace __atomic0
} }
void* void*
exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile exchange(void* __v, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, =, __v, __m); } { return _ATOMIC_MODIFY_(this, =, __v, __m); }
bool bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1, compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ {
__glibcxx_assert(__m2 != memory_order_release); __glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel); __glibcxx_assert(__m2 != memory_order_acq_rel);
@ -150,7 +150,7 @@ namespace __atomic0
bool bool
compare_exchange_weak(void*& __v1, void* __v2, compare_exchange_weak(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_weak(__v1, __v2, __m, return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
@ -158,7 +158,7 @@ namespace __atomic0
bool bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1, compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ {
__glibcxx_assert(__m2 != memory_order_release); __glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel); __glibcxx_assert(__m2 != memory_order_acq_rel);
@ -168,17 +168,17 @@ namespace __atomic0
bool bool
compare_exchange_strong(void*& __v1, void* __v2, compare_exchange_strong(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_strong(__v1, __v2, __m, return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
} }
void* void*
fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{ {
void* volatile* __p = &(_M_i); void** __p = &(_M_i);
volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_base* __g = __atomic_flag_for_address(__p);
__atomic_flag_wait_explicit(__g, __m); __atomic_flag_wait_explicit(__g, __m);
void* __r = *__p; void* __r = *__p;
*__p = (void*)((char*)(*__p) + __d); *__p = (void*)((char*)(*__p) + __d);
@ -187,10 +187,10 @@ namespace __atomic0
} }
void* void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{ {
void* volatile* __p = &(_M_i); void** __p = &(_M_i);
volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); __atomic_flag_base* __g = __atomic_flag_for_address(__p);
__atomic_flag_wait_explicit(__g, __m); __atomic_flag_wait_explicit(__g, __m);
void* __r = *__p; void* __r = *__p;
*__p = (void*)((char*)(*__p) - __d); *__p = (void*)((char*)(*__p) - __d);
@ -198,22 +198,22 @@ namespace __atomic0
return __r; return __r;
} }
operator void*() const volatile operator void*() const
{ return load(); } { return load(); }
void* void*
operator=(void* __v) // XXX volatile operator=(void* __v)
{ {
store(__v); store(__v);
return __v; return __v;
} }
void* void*
operator+=(ptrdiff_t __d) volatile operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; } { return fetch_add(__d) + __d; }
void* void*
operator-=(ptrdiff_t __d) volatile operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; } { return fetch_sub(__d) - __d; }
}; };
@ -252,64 +252,63 @@ namespace __atomic0
__atomic_base() = default; __atomic_base() = default;
~__atomic_base() = default; ~__atomic_base() = default;
__atomic_base(const __atomic_base&) = delete; __atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete;
// Requires __integral_type convertible to _M_base._M_i. // Requires __integral_type convertible to _M_base._M_i.
__atomic_base(__integral_type __i) { _M_i = __i; } __atomic_base(__integral_type __i) { _M_i = __i; }
operator __integral_type() const volatile operator __integral_type() const
{ return load(); } { return load(); }
__integral_type __integral_type
operator=(__integral_type __i) // XXX volatile operator=(__integral_type __i)
{ {
store(__i); store(__i);
return __i; return __i;
} }
__integral_type __integral_type
operator++(int) volatile operator++(int)
{ return fetch_add(1); } { return fetch_add(1); }
__integral_type __integral_type
operator--(int) volatile operator--(int)
{ return fetch_sub(1); } { return fetch_sub(1); }
__integral_type __integral_type
operator++() volatile operator++()
{ return fetch_add(1) + 1; } { return fetch_add(1) + 1; }
__integral_type __integral_type
operator--() volatile operator--()
{ return fetch_sub(1) - 1; } { return fetch_sub(1) - 1; }
__integral_type __integral_type
operator+=(__integral_type __i) volatile operator+=(__integral_type __i)
{ return fetch_add(__i) + __i; } { return fetch_add(__i) + __i; }
__integral_type __integral_type
operator-=(__integral_type __i) volatile operator-=(__integral_type __i)
{ return fetch_sub(__i) - __i; } { return fetch_sub(__i) - __i; }
__integral_type __integral_type
operator&=(__integral_type __i) volatile operator&=(__integral_type __i)
{ return fetch_and(__i) & __i; } { return fetch_and(__i) & __i; }
__integral_type __integral_type
operator|=(__integral_type __i) volatile operator|=(__integral_type __i)
{ return fetch_or(__i) | __i; } { return fetch_or(__i) | __i; }
__integral_type __integral_type
operator^=(__integral_type __i) volatile operator^=(__integral_type __i)
{ return fetch_xor(__i) ^ __i; } { return fetch_xor(__i) ^ __i; }
bool bool
is_lock_free() const volatile is_lock_free() const
{ return false; } { return false; }
void void
store(__integral_type __i, store(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ {
__glibcxx_assert(__m != memory_order_acquire); __glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -318,7 +317,7 @@ namespace __atomic0
} }
__integral_type __integral_type
load(memory_order __m = memory_order_seq_cst) const volatile load(memory_order __m = memory_order_seq_cst) const
{ {
__glibcxx_assert(__m != memory_order_release); __glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -326,13 +325,12 @@ namespace __atomic0
} }
__integral_type __integral_type
exchange(__integral_type __i, exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, =, __i, __m); } { return _ATOMIC_MODIFY_(this, =, __i, __m); }
bool bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2, compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
memory_order __m1, memory_order __m2) volatile memory_order __m1, memory_order __m2)
{ {
__glibcxx_assert(__m2 != memory_order_release); __glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel); __glibcxx_assert(__m2 != memory_order_acq_rel);
@ -342,7 +340,7 @@ namespace __atomic0
bool bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2, compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_weak(__i1, __i2, __m, return compare_exchange_weak(__i1, __i2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
@ -350,7 +348,7 @@ namespace __atomic0
bool bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2, compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
memory_order __m1, memory_order __m2) volatile memory_order __m1, memory_order __m2)
{ {
__glibcxx_assert(__m2 != memory_order_release); __glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel); __glibcxx_assert(__m2 != memory_order_acq_rel);
@ -360,35 +358,30 @@ namespace __atomic0
bool bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2, compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_strong(__i1, __i2, __m, return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
} }
__integral_type __integral_type
fetch_add(__integral_type __i, fetch_add(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, +=, __i, __m); } { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
__integral_type __integral_type
fetch_sub(__integral_type __i, fetch_sub(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, -=, __i, __m); } { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
__integral_type __integral_type
fetch_and(__integral_type __i, fetch_and(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, &=, __i, __m); } { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
__integral_type __integral_type
fetch_or(__integral_type __i, fetch_or(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, |=, __i, __m); } { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
__integral_type __integral_type
fetch_xor(__integral_type __i, fetch_xor(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ return _ATOMIC_MODIFY_(this, ^=, __i, __m); } { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
}; };
@ -404,52 +397,52 @@ namespace __atomic0
atomic_bool() = default; atomic_bool() = default;
~atomic_bool() = default; ~atomic_bool() = default;
atomic_bool(const atomic_bool&) = delete; atomic_bool(const atomic_bool&) = delete;
atomic_bool& operator=(const atomic_bool&) = delete; atomic_bool& operator=(const atomic_bool&) volatile = delete;
atomic_bool(bool __i) : _M_base(__i) { } atomic_bool(bool __i) : _M_base(__i) { }
bool bool
operator=(bool __i) // XXX volatile operator=(bool __i)
{ return _M_base.operator=(__i); } { return _M_base.operator=(__i); }
operator bool() const volatile operator bool() const
{ return _M_base.load(); } { return _M_base.load(); }
bool bool
is_lock_free() const volatile is_lock_free() const
{ return _M_base.is_lock_free(); } { return _M_base.is_lock_free(); }
void void
store(bool __i, memory_order __m = memory_order_seq_cst) volatile store(bool __i, memory_order __m = memory_order_seq_cst)
{ _M_base.store(__i, __m); } { _M_base.store(__i, __m); }
bool bool
load(memory_order __m = memory_order_seq_cst) const volatile load(memory_order __m = memory_order_seq_cst) const
{ return _M_base.load(__m); } { return _M_base.load(__m); }
bool bool
exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile exchange(bool __i, memory_order __m = memory_order_seq_cst)
{ return _M_base.exchange(__i, __m); } { return _M_base.exchange(__i, __m); }
bool bool
compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
bool bool
compare_exchange_weak(bool& __i1, bool __i2, compare_exchange_weak(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m); } { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
bool bool
compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool bool
compare_exchange_strong(bool& __i1, bool __i2, compare_exchange_strong(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m); } { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
}; };

View file

@ -49,13 +49,13 @@ namespace __atomic2
atomic_flag() = default; atomic_flag() = default;
~atomic_flag() = default; ~atomic_flag() = default;
atomic_flag(const atomic_flag&) = delete; atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) volatile = delete;
// Conversion to ATOMIC_FLAG_INIT. // Conversion to ATOMIC_FLAG_INIT.
atomic_flag(bool __i): __atomic_flag_base({ __i }) { } atomic_flag(bool __i): __atomic_flag_base({ __i }) { }
bool bool
test_and_set(memory_order __m = memory_order_seq_cst) volatile test_and_set(memory_order __m = memory_order_seq_cst)
{ {
// Redundant synchronize if built-in for lock is a full barrier. // Redundant synchronize if built-in for lock is a full barrier.
if (__m != memory_order_acquire && __m != memory_order_acq_rel) if (__m != memory_order_acquire && __m != memory_order_acq_rel)
@ -64,7 +64,7 @@ namespace __atomic2
} }
void void
clear(memory_order __m = memory_order_seq_cst) volatile clear(memory_order __m = memory_order_seq_cst)
{ {
__glibcxx_assert(__m != memory_order_consume); __glibcxx_assert(__m != memory_order_consume);
__glibcxx_assert(__m != memory_order_acquire); __glibcxx_assert(__m != memory_order_acquire);
@ -87,16 +87,16 @@ namespace __atomic2
atomic_address() = default; atomic_address() = default;
~atomic_address() = default; ~atomic_address() = default;
atomic_address(const atomic_address&) = delete; atomic_address(const atomic_address&) = delete;
atomic_address& operator=(const atomic_address&) = delete; atomic_address& operator=(const atomic_address&) volatile = delete;
atomic_address(void* __v) { _M_i = __v; } atomic_address(void* __v) { _M_i = __v; }
bool bool
is_lock_free() const volatile is_lock_free() const
{ return true; } { return true; }
void void
store(void* __v, memory_order __m = memory_order_seq_cst) volatile store(void* __v, memory_order __m = memory_order_seq_cst)
{ {
__glibcxx_assert(__m != memory_order_acquire); __glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -114,7 +114,7 @@ namespace __atomic2
} }
void* void*
load(memory_order __m = memory_order_seq_cst) const volatile load(memory_order __m = memory_order_seq_cst) const
{ {
__glibcxx_assert(__m != memory_order_release); __glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -126,7 +126,7 @@ namespace __atomic2
} }
void* void*
exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile exchange(void* __v, memory_order __m = memory_order_seq_cst)
{ {
// XXX built-in assumes memory_order_acquire. // XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __v); return __sync_lock_test_and_set(&_M_i, __v);
@ -134,12 +134,12 @@ namespace __atomic2
bool bool
compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1, compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ return compare_exchange_strong(__v1, __v2, __m1, __m2); } { return compare_exchange_strong(__v1, __v2, __m1, __m2); }
bool bool
compare_exchange_weak(void*& __v1, void* __v2, compare_exchange_weak(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_weak(__v1, __v2, __m, return compare_exchange_weak(__v1, __v2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
@ -147,7 +147,7 @@ namespace __atomic2
bool bool
compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1, compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ {
__glibcxx_assert(__m2 != memory_order_release); __glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel); __glibcxx_assert(__m2 != memory_order_acq_rel);
@ -163,36 +163,36 @@ namespace __atomic2
bool bool
compare_exchange_strong(void*& __v1, void* __v2, compare_exchange_strong(void*& __v1, void* __v2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_strong(__v1, __v2, __m, return compare_exchange_strong(__v1, __v2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
} }
void* void*
fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_add(&_M_i, __d); } { return __sync_fetch_and_add(&_M_i, __d); }
void* void*
fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_sub(&_M_i, __d); } { return __sync_fetch_and_sub(&_M_i, __d); }
operator void*() const volatile operator void*() const
{ return load(); } { return load(); }
void* void*
operator=(void* __v) // XXX volatile operator=(void* __v)
{ {
store(__v); store(__v);
return __v; return __v;
} }
void* void*
operator+=(ptrdiff_t __d) volatile operator+=(ptrdiff_t __d)
{ return __sync_add_and_fetch(&_M_i, __d); } { return __sync_add_and_fetch(&_M_i, __d); }
void* void*
operator-=(ptrdiff_t __d) volatile operator-=(ptrdiff_t __d)
{ return __sync_sub_and_fetch(&_M_i, __d); } { return __sync_sub_and_fetch(&_M_i, __d); }
}; };
@ -230,64 +230,63 @@ namespace __atomic2
__atomic_base() = default; __atomic_base() = default;
~__atomic_base() = default; ~__atomic_base() = default;
__atomic_base(const __atomic_base&) = delete; __atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete;
// Requires __integral_type convertible to _M_base._M_i. // Requires __integral_type convertible to _M_base._M_i.
__atomic_base(__integral_type __i) { _M_i = __i; } __atomic_base(__integral_type __i) { _M_i = __i; }
operator __integral_type() const volatile operator __integral_type() const
{ return load(); } { return load(); }
__integral_type __integral_type
operator=(__integral_type __i) // XXX volatile operator=(__integral_type __i)
{ {
store(__i); store(__i);
return __i; return __i;
} }
__integral_type __integral_type
operator++(int) volatile operator++(int)
{ return fetch_add(1); } { return fetch_add(1); }
__integral_type __integral_type
operator--(int) volatile operator--(int)
{ return fetch_sub(1); } { return fetch_sub(1); }
__integral_type __integral_type
operator++() volatile operator++()
{ return __sync_add_and_fetch(&_M_i, 1); } { return __sync_add_and_fetch(&_M_i, 1); }
__integral_type __integral_type
operator--() volatile operator--()
{ return __sync_sub_and_fetch(&_M_i, 1); } { return __sync_sub_and_fetch(&_M_i, 1); }
__integral_type __integral_type
operator+=(__integral_type __i) volatile operator+=(__integral_type __i)
{ return __sync_add_and_fetch(&_M_i, __i); } { return __sync_add_and_fetch(&_M_i, __i); }
__integral_type __integral_type
operator-=(__integral_type __i) volatile operator-=(__integral_type __i)
{ return __sync_sub_and_fetch(&_M_i, __i); } { return __sync_sub_and_fetch(&_M_i, __i); }
__integral_type __integral_type
operator&=(__integral_type __i) volatile operator&=(__integral_type __i)
{ return __sync_and_and_fetch(&_M_i, __i); } { return __sync_and_and_fetch(&_M_i, __i); }
__integral_type __integral_type
operator|=(__integral_type __i) volatile operator|=(__integral_type __i)
{ return __sync_or_and_fetch(&_M_i, __i); } { return __sync_or_and_fetch(&_M_i, __i); }
__integral_type __integral_type
operator^=(__integral_type __i) volatile operator^=(__integral_type __i)
{ return __sync_xor_and_fetch(&_M_i, __i); } { return __sync_xor_and_fetch(&_M_i, __i); }
bool bool
is_lock_free() const volatile is_lock_free() const
{ return true; } { return true; }
void void
store(__integral_type __i, store(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ {
__glibcxx_assert(__m != memory_order_acquire); __glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -305,7 +304,7 @@ namespace __atomic2
} }
__integral_type __integral_type
load(memory_order __m = memory_order_seq_cst) const volatile load(memory_order __m = memory_order_seq_cst) const
{ {
__glibcxx_assert(__m != memory_order_release); __glibcxx_assert(__m != memory_order_release);
__glibcxx_assert(__m != memory_order_acq_rel); __glibcxx_assert(__m != memory_order_acq_rel);
@ -317,8 +316,7 @@ namespace __atomic2
} }
__integral_type __integral_type
exchange(__integral_type __i, exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
memory_order __m = memory_order_seq_cst) volatile
{ {
// XXX built-in assumes memory_order_acquire. // XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __i); return __sync_lock_test_and_set(&_M_i, __i);
@ -326,12 +324,12 @@ namespace __atomic2
bool bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2, compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
memory_order __m1, memory_order __m2) volatile memory_order __m1, memory_order __m2)
{ return compare_exchange_strong(__i1, __i2, __m1, __m2); } { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool bool
compare_exchange_weak(__integral_type& __i1, __integral_type __i2, compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_weak(__i1, __i2, __m, return compare_exchange_weak(__i1, __i2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
@ -339,7 +337,7 @@ namespace __atomic2
bool bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2, compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
memory_order __m1, memory_order __m2) volatile memory_order __m1, memory_order __m2)
{ {
__glibcxx_assert(__m2 != memory_order_release); __glibcxx_assert(__m2 != memory_order_release);
__glibcxx_assert(__m2 != memory_order_acq_rel); __glibcxx_assert(__m2 != memory_order_acq_rel);
@ -355,7 +353,7 @@ namespace __atomic2
bool bool
compare_exchange_strong(__integral_type& __i1, __integral_type __i2, compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ {
return compare_exchange_strong(__i1, __i2, __m, return compare_exchange_strong(__i1, __i2, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
@ -363,27 +361,27 @@ namespace __atomic2
__integral_type __integral_type
fetch_add(__integral_type __i, fetch_add(__integral_type __i,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_add(&_M_i, __i); } { return __sync_fetch_and_add(&_M_i, __i); }
__integral_type __integral_type
fetch_sub(__integral_type __i, fetch_sub(__integral_type __i,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_sub(&_M_i, __i); } { return __sync_fetch_and_sub(&_M_i, __i); }
__integral_type __integral_type
fetch_and(__integral_type __i, fetch_and(__integral_type __i,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_and(&_M_i, __i); } { return __sync_fetch_and_and(&_M_i, __i); }
__integral_type __integral_type
fetch_or(__integral_type __i, fetch_or(__integral_type __i,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_or(&_M_i, __i); } { return __sync_fetch_and_or(&_M_i, __i); }
__integral_type __integral_type
fetch_xor(__integral_type __i, fetch_xor(__integral_type __i,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return __sync_fetch_and_xor(&_M_i, __i); } { return __sync_fetch_and_xor(&_M_i, __i); }
}; };
@ -399,52 +397,52 @@ namespace __atomic2
atomic_bool() = default; atomic_bool() = default;
~atomic_bool() = default; ~atomic_bool() = default;
atomic_bool(const atomic_bool&) = delete; atomic_bool(const atomic_bool&) = delete;
atomic_bool& operator=(const atomic_bool&) = delete; atomic_bool& operator=(const atomic_bool&) volatile = delete;
atomic_bool(bool __i) : _M_base(__i) { } atomic_bool(bool __i) : _M_base(__i) { }
bool bool
operator=(bool __i) // XXX volatile operator=(bool __i)
{ return _M_base.operator=(__i); } { return _M_base.operator=(__i); }
operator bool() const volatile operator bool() const
{ return _M_base.load(); } { return _M_base.load(); }
bool bool
is_lock_free() const volatile is_lock_free() const
{ return _M_base.is_lock_free(); } { return _M_base.is_lock_free(); }
void void
store(bool __i, memory_order __m = memory_order_seq_cst) volatile store(bool __i, memory_order __m = memory_order_seq_cst)
{ _M_base.store(__i, __m); } { _M_base.store(__i, __m); }
bool bool
load(memory_order __m = memory_order_seq_cst) const volatile load(memory_order __m = memory_order_seq_cst) const
{ return _M_base.load(__m); } { return _M_base.load(__m); }
bool bool
exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile exchange(bool __i, memory_order __m = memory_order_seq_cst)
{ return _M_base.exchange(__i, __m); } { return _M_base.exchange(__i, __m); }
bool bool
compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1, compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); } { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
bool bool
compare_exchange_weak(bool& __i1, bool __i2, compare_exchange_weak(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_weak(__i1, __i2, __m); } { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
bool bool
compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1, compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); } { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
bool bool
compare_exchange_strong(bool& __i1, bool __i2, compare_exchange_strong(bool& __i1, bool __i2,
memory_order __m = memory_order_seq_cst) volatile memory_order __m = memory_order_seq_cst)
{ return _M_base.compare_exchange_strong(__i1, __i2, __m); } { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
}; };
} // namespace __atomic2 } // namespace __atomic2

View file

@ -0,0 +1,224 @@
// -*- C++ -*- compatibility header.
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file bits/atomic_base.h
* This is a Standard C++ Library header.
*/
#include <bits/c++config.h>
#include <stddef.h>
#include <stdbool.h> // XXX need to define bool w/o stdbool.h in tr1/cstdbool
#ifndef _GLIBCXX_ATOMIC_BASE_H
#define _GLIBCXX_ATOMIC_BASE_H 1
_GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_BEGIN_EXTERN_C
/**
* @defgroup atomics Atomics
*
* Components for performing atomic operations.
* @{
*/
/// Enumeration for memory_order
typedef enum memory_order
{
memory_order_relaxed,
memory_order_consume,
memory_order_acquire,
memory_order_release,
memory_order_acq_rel,
memory_order_seq_cst
} memory_order;
// Base for atomic_flag.
typedef struct __atomic_flag_base
{
bool _M_i;
} __atomic_flag_base;
#define ATOMIC_FLAG_INIT { false }
/// 29.2 Lock-free Property
#if defined(_GLIBCXX_ATOMIC_BUILTINS_1) && defined(_GLIBCXX_ATOMIC_BUILTINS_2) \
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_ATOMIC_BUILTINS_8)
# define _GLIBCXX_ATOMIC_PROPERTY 2
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic2
#elif defined(_GLIBCXX_ATOMIC_BUILTINS_1)
# define _GLIBCXX_ATOMIC_PROPERTY 1
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic1
#else
# define _GLIBCXX_ATOMIC_PROPERTY 0
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic0
#endif
#define ATOMIC_INTEGRAL_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_ADDRESS_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
// Switch atomic integral base types based on C or C++. In
// addition, for "C" only provide type-generic macros for atomic
// operations. (As C++ accomplishes the same thing with sets of
// overloaded functions.
#ifdef __cplusplus
inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
# include <bits/atomicfwd_cxx.h>
#else
# include <bits/atomicfwd_c.h>
#endif
// Typedefs for other atomic integral types.
typedef atomic_schar atomic_int_least8_t;
typedef atomic_uchar atomic_uint_least8_t;
typedef atomic_short atomic_int_least16_t;
typedef atomic_ushort atomic_uint_least16_t;
typedef atomic_int atomic_int_least32_t;
typedef atomic_uint atomic_uint_least32_t;
typedef atomic_llong atomic_int_least64_t;
typedef atomic_ullong atomic_uint_least64_t;
typedef atomic_schar atomic_int_fast8_t;
typedef atomic_uchar atomic_uint_fast8_t;
typedef atomic_short atomic_int_fast16_t;
typedef atomic_ushort atomic_uint_fast16_t;
typedef atomic_int atomic_int_fast32_t;
typedef atomic_uint atomic_uint_fast32_t;
typedef atomic_llong atomic_int_fast64_t;
typedef atomic_ullong atomic_uint_fast64_t;
typedef atomic_long atomic_intptr_t;
typedef atomic_ulong atomic_uintptr_t;
typedef atomic_long atomic_ssize_t;
typedef atomic_ulong atomic_size_t;
typedef atomic_llong atomic_intmax_t;
typedef atomic_ullong atomic_uintmax_t;
typedef atomic_long atomic_ptrdiff_t;
// Accessor functions for base atomic_flag type.
bool
atomic_flag_test_and_set_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
inline bool
atomic_flag_test_and_set(__atomic_flag_base* __a)
{ return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
void
atomic_flag_clear_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
inline void
atomic_flag_clear(__atomic_flag_base* __a)
{ atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
void
__atomic_flag_wait_explicit(__atomic_flag_base*, memory_order)
_GLIBCXX_NOTHROW;
_GLIBCXX_CONST __atomic_flag_base*
__atomic_flag_for_address(const void* __z) _GLIBCXX_NOTHROW;
// Implementation specific defines.
#define _ATOMIC_LOAD_(__a, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_STORE_(__a, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
*__p = __v; \
atomic_flag_clear_explicit(__g, __x); \
__v; })
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
*__p __o __v; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__e) __q = (__e); \
__typeof__(__m) __v = (__m); \
bool __r; \
atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
if (__t__ == *__q) { *__p = __v; __r = true; } \
else { *__q = __t__; __r = false; } \
atomic_flag_clear_explicit(__g, __x); \
__r; })
// @} group atomics
_GLIBCXX_END_EXTERN_C
_GLIBCXX_END_NAMESPACE
// Inject into global namespace.
#ifdef __cplusplus
#include <atomic>
using std::memory_order;
using std::memory_order_relaxed;
using std::memory_order_consume;
using std::memory_order_acquire;
using std::memory_order_release;
using std::memory_order_acq_rel;
using std::memory_order_seq_cst;
using std::atomic_flag;
using std::atomic_bool;
using std::atomic_char;
using std::atomic_schar;
using std::atomic_uchar;
using std::atomic_short;
using std::atomic_ushort;
using std::atomic_int;
using std::atomic_uint;
using std::atomic_long;
using std::atomic_ulong;
using std::atomic_llong;
using std::atomic_ullong;
using std::atomic_wchar_t;
using std::atomic_char16_t;
using std::atomic_char32_t;
using std::atomic_address;
using std::atomic;
#endif
#endif

View file

@ -26,196 +26,12 @@
* This is a Standard C++ Library header. * This is a Standard C++ Library header.
*/ */
#include <bits/c++config.h> #include <bits/atomic_base.h>
#include <stddef.h>
#include <stdbool.h> // XXX need to define bool w/o stdbool.h in tr1/cstdbool
#ifndef _GLIBCXX_STDATOMIC_H #ifndef _GLIBCXX_STDATOMIC_H
#define _GLIBCXX_STDATOMIC_H 1 #define _GLIBCXX_STDATOMIC_H 1
_GLIBCXX_BEGIN_NAMESPACE(std) #ifdef _GLIBCXX_NAMESPACE_C
_GLIBCXX_BEGIN_EXTERN_C
/**
* @defgroup atomics Atomics
*
* Components for performing atomic operations.
* @{
*/
/// Enumeration for memory_order
typedef enum memory_order
{
memory_order_relaxed,
memory_order_consume,
memory_order_acquire,
memory_order_release,
memory_order_acq_rel,
memory_order_seq_cst
} memory_order;
// Base for atomic_flag.
typedef struct __atomic_flag_base
{
bool _M_i;
} __atomic_flag_base;
#define ATOMIC_FLAG_INIT { false }
/// 29.2 Lock-free Property
#if defined(_GLIBCXX_ATOMIC_BUILTINS_1) && defined(_GLIBCXX_ATOMIC_BUILTINS_2) \
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_ATOMIC_BUILTINS_8)
# define _GLIBCXX_ATOMIC_PROPERTY 2
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic2
#elif defined(_GLIBCXX_ATOMIC_BUILTINS_1)
# define _GLIBCXX_ATOMIC_PROPERTY 1
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic1
#else
# define _GLIBCXX_ATOMIC_PROPERTY 0
# define _GLIBCXX_ATOMIC_NAMESPACE __atomic0
#endif
#define ATOMIC_INTEGRAL_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
#define ATOMIC_ADDRESS_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
// Switch atomic integral base types based on C or C++. In
// addition, for "C" only provide type-generic macros for atomic
// operations. (As C++ accomplishes the same thing with sets of
// overloaded functions.
#ifdef __cplusplus
inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
# include <bits/atomicfwd_cxx.h>
#else
# include <bits/atomicfwd_c.h>
#endif
// Typedefs for other atomic integral types.
typedef atomic_schar atomic_int_least8_t;
typedef atomic_uchar atomic_uint_least8_t;
typedef atomic_short atomic_int_least16_t;
typedef atomic_ushort atomic_uint_least16_t;
typedef atomic_int atomic_int_least32_t;
typedef atomic_uint atomic_uint_least32_t;
typedef atomic_llong atomic_int_least64_t;
typedef atomic_ullong atomic_uint_least64_t;
typedef atomic_schar atomic_int_fast8_t;
typedef atomic_uchar atomic_uint_fast8_t;
typedef atomic_short atomic_int_fast16_t;
typedef atomic_ushort atomic_uint_fast16_t;
typedef atomic_int atomic_int_fast32_t;
typedef atomic_uint atomic_uint_fast32_t;
typedef atomic_llong atomic_int_fast64_t;
typedef atomic_ullong atomic_uint_fast64_t;
typedef atomic_long atomic_intptr_t;
typedef atomic_ulong atomic_uintptr_t;
typedef atomic_long atomic_ssize_t;
typedef atomic_ulong atomic_size_t;
typedef atomic_llong atomic_intmax_t;
typedef atomic_ullong atomic_uintmax_t;
typedef atomic_long atomic_ptrdiff_t;
// Accessor functions for base atomic_flag type.
bool
atomic_flag_test_and_set_explicit(volatile __atomic_flag_base*, memory_order) _GLIBCXX_NOTHROW;
inline bool
atomic_flag_test_and_set(volatile __atomic_flag_base* __a)
{ return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
void
atomic_flag_clear_explicit(volatile __atomic_flag_base*, memory_order) _GLIBCXX_NOTHROW;
inline void
atomic_flag_clear(volatile __atomic_flag_base* __a)
{ atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
void
__atomic_flag_wait_explicit(volatile __atomic_flag_base*, memory_order) _GLIBCXX_NOTHROW;
_GLIBCXX_CONST volatile __atomic_flag_base*
__atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW;
// Implementation specific defines.
#define _ATOMIC_LOAD_(__a, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_STORE_(__a, __m, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
*__p = __v; \
atomic_flag_clear_explicit(__g, __x); \
__v; })
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__m) __v = (__m); \
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
*__p __o __v; \
atomic_flag_clear_explicit(__g, __x); \
__r; })
#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__typeof__(__e) __q = (__e); \
__typeof__(__m) __v = (__m); \
bool __r; \
volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
__atomic_flag_wait_explicit(__g, __x); \
__typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
if (__t__ == *__q) { *__p = __v; __r = true; } \
else { *__q = __t__; __r = false; } \
atomic_flag_clear_explicit(__g, __x); \
__r; })
// @} group atomics
_GLIBCXX_END_EXTERN_C
_GLIBCXX_END_NAMESPACE
// Inject into global namespace.
#ifdef __cplusplus
#include <cstdatomic>
using std::memory_order;
using std::memory_order_relaxed;
using std::memory_order_consume;
using std::memory_order_acquire;
using std::memory_order_release;
using std::memory_order_acq_rel;
using std::memory_order_seq_cst;
using std::atomic_flag;
using std::atomic_bool;
using std::atomic_char;
using std::atomic_schar;
using std::atomic_uchar;
using std::atomic_short;
using std::atomic_ushort;
using std::atomic_int;
using std::atomic_uint;
using std::atomic_long;
using std::atomic_ulong;
using std::atomic_llong;
using std::atomic_ullong;
using std::atomic_wchar_t;
using std::atomic_char16_t;
using std::atomic_char32_t;
using std::atomic_address;
using std::atomic;
#endif #endif
#endif #endif

View file

@ -53,7 +53,6 @@
#include <ccomplex> #include <ccomplex>
#include <cfenv> #include <cfenv>
#include <cinttypes> #include <cinttypes>
#include <cstdatomic>
#include <cstdbool> #include <cstdbool>
#include <cstdint> #include <cstdint>
#include <ctgmath> #include <ctgmath>
@ -97,6 +96,7 @@
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array> #include <array>
#include <atomic>
#include <chrono> #include <chrono>
#include <condition_variable> #include <condition_variable>
#include <forward_list> #include <forward_list>

View file

@ -23,21 +23,15 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
/** @file cstdatomic /** @file atomic
* This is a Standard C++ Library file. You should @c \#include this file * This is a Standard C++ Library header.
* in your programs, rather than any of the "*.h" implementation files.
*
* This is the C++ version of the Standard C Library header @c stdatomic.h,
* and its contents are (mostly) the same as that header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros in C).
*/ */
// Based on "C++ Atomic Types and Operations" by Hans Boehm and Lawrence Crowl. // Based on "C++ Atomic Types and Operations" by Hans Boehm and Lawrence Crowl.
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html
#ifndef _GLIBCXX_STDATOMIC #ifndef _GLIBCXX_ATOMIC
#define _GLIBCXX_STDATOMIC 1 #define _GLIBCXX_ATOMIC 1
#pragma GCC system_header #pragma GCC system_header
@ -45,7 +39,7 @@
# include <c++0x_warning.h> # include <c++0x_warning.h>
#endif #endif
#include <stdatomic.h> #include <bits/atomic_base.h>
#include <cstddef> #include <cstddef>
_GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_BEGIN_NAMESPACE(std)
@ -57,7 +51,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/// kill_dependency /// kill_dependency
template<typename _Tp> template<typename _Tp>
inline _Tp inline _Tp
kill_dependency(_Tp __y) kill_dependency(_Tp __y)
{ {
_Tp ret(__y); _Tp ret(__y);
@ -76,10 +70,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// //
// Three nested namespaces for atomic implementation details. // Three nested namespaces for atomic implementation details.
// //
// The nested namespace inlined into std:: is determined by the value // The nested namespace inlined into std:: is determined by the value
// of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting // of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting
// ATOMIC_*_LOCK_FREE macros. See file stdatomic.h. // ATOMIC_*_LOCK_FREE macros. See file atomic_base.h.
// //
// 0 == __atomic0 == Never lock-free // 0 == __atomic0 == Never lock-free
// 1 == __atomic1 == Best available, sometimes lock-free // 1 == __atomic1 == Best available, sometimes lock-free
@ -99,117 +93,115 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(_Tp __i) : _M_i(__i) { } atomic(_Tp __i) : _M_i(__i) { }
operator _Tp() const volatile; operator _Tp() const;
_Tp _Tp
operator=(_Tp __i) volatile { store(__i); return __i; } operator=(_Tp __i) { store(__i); return __i; }
bool bool
is_lock_free() const volatile; is_lock_free() const volatile;
void void
store(_Tp, memory_order = memory_order_seq_cst) volatile; store(_Tp, memory_order = memory_order_seq_cst) volatile;
_Tp _Tp
load(memory_order = memory_order_seq_cst) const volatile; load(memory_order = memory_order_seq_cst) const volatile;
_Tp _Tp
exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile; exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile;
bool bool
compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile; compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile;
bool bool
compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile; compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
bool bool
compare_exchange_weak(_Tp&, _Tp, compare_exchange_weak(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile; memory_order = memory_order_seq_cst) volatile;
bool bool
compare_exchange_strong(_Tp&, _Tp, compare_exchange_strong(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile; memory_order = memory_order_seq_cst) volatile;
}; };
/// Partial specialization for pointer types. /// Partial specialization for pointer types.
template<typename _Tp> template<typename _Tp>
struct atomic<_Tp*> : atomic_address struct atomic<_Tp*> : atomic_address
{ {
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(_Tp* __v) : atomic_address(__v) { } atomic(_Tp* __v) : atomic_address(__v) { }
void void
store(_Tp*, memory_order = memory_order_seq_cst) volatile; store(_Tp*, memory_order = memory_order_seq_cst);
_Tp* _Tp*
load(memory_order = memory_order_seq_cst) const volatile; load(memory_order = memory_order_seq_cst) const;
_Tp* _Tp*
exchange(_Tp*, memory_order = memory_order_seq_cst) volatile; exchange(_Tp*, memory_order = memory_order_seq_cst);
bool bool
compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order) volatile; compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order);
bool bool
compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order) volatile; compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order);
bool bool
compare_exchange_weak(_Tp*&, _Tp*, compare_exchange_weak(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
memory_order = memory_order_seq_cst) volatile;
bool bool
compare_exchange_strong(_Tp*&, _Tp*, compare_exchange_strong(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
memory_order = memory_order_seq_cst) volatile;
_Tp* _Tp*
fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
_Tp* _Tp*
fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile; fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
operator _Tp*() const volatile operator _Tp*() const
{ return load(); } { return load(); }
_Tp* _Tp*
operator=(_Tp* __v) volatile operator=(_Tp* __v)
{ {
store(__v); store(__v);
return __v; return __v;
} }
_Tp* _Tp*
operator++(int) volatile { return fetch_add(1); } operator++(int) { return fetch_add(1); }
_Tp* _Tp*
operator--(int) volatile { return fetch_sub(1); } operator--(int) { return fetch_sub(1); }
_Tp* _Tp*
operator++() volatile { return fetch_add(1) + 1; } operator++() { return fetch_add(1) + 1; }
_Tp* _Tp*
operator--() volatile { return fetch_sub(1) - 1; } operator--() { return fetch_sub(1) - 1; }
_Tp* _Tp*
operator+=(ptrdiff_t __d) volatile operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; } { return fetch_add(__d) + __d; }
_Tp* _Tp*
operator-=(ptrdiff_t __d) volatile operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; } { return fetch_sub(__d) - __d; }
}; };
/// Explicit specialization for void* /// Explicit specialization for void*
template<> template<>
struct atomic<void*> : public atomic_address struct atomic<void*> : public atomic_address
{ {
typedef void* __integral_type; typedef void* __integral_type;
@ -218,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -227,7 +219,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for bool. /// Explicit specialization for bool.
template<> template<>
struct atomic<bool> : public atomic_bool struct atomic<bool> : public atomic_bool
{ {
typedef bool __integral_type; typedef bool __integral_type;
@ -236,7 +228,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -245,7 +237,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for char. /// Explicit specialization for char.
template<> template<>
struct atomic<char> : public atomic_char struct atomic<char> : public atomic_char
{ {
typedef char __integral_type; typedef char __integral_type;
@ -254,7 +246,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -263,16 +255,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for signed char. /// Explicit specialization for signed char.
template<> template<>
struct atomic<signed char> : public atomic_schar struct atomic<signed char> : public atomic_schar
{ {
typedef signed char __integral_type; typedef signed char __integral_type;
typedef atomic_schar __base_type; typedef atomic_schar __base_type;
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -281,7 +273,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for unsigned char. /// Explicit specialization for unsigned char.
template<> template<>
struct atomic<unsigned char> : public atomic_uchar struct atomic<unsigned char> : public atomic_uchar
{ {
typedef unsigned char __integral_type; typedef unsigned char __integral_type;
@ -290,7 +282,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -299,7 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for short. /// Explicit specialization for short.
template<> template<>
struct atomic<short> : public atomic_short struct atomic<short> : public atomic_short
{ {
typedef short __integral_type; typedef short __integral_type;
@ -308,7 +300,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -317,7 +309,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for unsigned short. /// Explicit specialization for unsigned short.
template<> template<>
struct atomic<unsigned short> : public atomic_ushort struct atomic<unsigned short> : public atomic_ushort
{ {
typedef unsigned short __integral_type; typedef unsigned short __integral_type;
@ -326,7 +318,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -335,7 +327,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for int. /// Explicit specialization for int.
template<> template<>
struct atomic<int> : atomic_int struct atomic<int> : atomic_int
{ {
typedef int __integral_type; typedef int __integral_type;
@ -344,7 +336,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -353,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for unsigned int. /// Explicit specialization for unsigned int.
template<> template<>
struct atomic<unsigned int> : public atomic_uint struct atomic<unsigned int> : public atomic_uint
{ {
typedef unsigned int __integral_type; typedef unsigned int __integral_type;
@ -362,7 +354,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -371,7 +363,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for long. /// Explicit specialization for long.
template<> template<>
struct atomic<long> : public atomic_long struct atomic<long> : public atomic_long
{ {
typedef long __integral_type; typedef long __integral_type;
@ -380,7 +372,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -389,7 +381,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for unsigned long. /// Explicit specialization for unsigned long.
template<> template<>
struct atomic<unsigned long> : public atomic_ulong struct atomic<unsigned long> : public atomic_ulong
{ {
typedef unsigned long __integral_type; typedef unsigned long __integral_type;
@ -398,7 +390,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -407,7 +399,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for long long. /// Explicit specialization for long long.
template<> template<>
struct atomic<long long> : public atomic_llong struct atomic<long long> : public atomic_llong
{ {
typedef long long __integral_type; typedef long long __integral_type;
@ -416,7 +408,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -425,7 +417,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for unsigned long long. /// Explicit specialization for unsigned long long.
template<> template<>
struct atomic<unsigned long long> : public atomic_ullong struct atomic<unsigned long long> : public atomic_ullong
{ {
typedef unsigned long long __integral_type; typedef unsigned long long __integral_type;
@ -434,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -443,7 +435,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for wchar_t. /// Explicit specialization for wchar_t.
template<> template<>
struct atomic<wchar_t> : public atomic_wchar_t struct atomic<wchar_t> : public atomic_wchar_t
{ {
typedef wchar_t __integral_type; typedef wchar_t __integral_type;
@ -452,7 +444,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -461,7 +453,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for char16_t. /// Explicit specialization for char16_t.
template<> template<>
struct atomic<char16_t> : public atomic_char16_t struct atomic<char16_t> : public atomic_char16_t
{ {
typedef char16_t __integral_type; typedef char16_t __integral_type;
@ -470,7 +462,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -479,7 +471,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}; };
/// Explicit specialization for char32_t. /// Explicit specialization for char32_t.
template<> template<>
struct atomic<char32_t> : public atomic_char32_t struct atomic<char32_t> : public atomic_char32_t
{ {
typedef char32_t __integral_type; typedef char32_t __integral_type;
@ -488,7 +480,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
atomic() = default; atomic() = default;
~atomic() = default; ~atomic() = default;
atomic(const atomic&) = delete; atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete; atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { } atomic(__integral_type __i) : __base_type(__i) { }
@ -498,212 +490,207 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp> template<typename _Tp>
_Tp* _Tp*
atomic<_Tp*>::load(memory_order __m) const volatile atomic<_Tp*>::load(memory_order __m) const
{ return static_cast<_Tp*>(atomic_address::load(__m)); } { return static_cast<_Tp*>(atomic_address::load(__m)); }
template<typename _Tp> template<typename _Tp>
_Tp* _Tp*
atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) volatile atomic<_Tp*>::exchange(_Tp* __v, memory_order __m)
{ return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); } { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
template<typename _Tp> template<typename _Tp>
bool bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1, atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ {
void** __vr = reinterpret_cast<void**>(&__r); void** __vr = reinterpret_cast<void**>(&__r);
void* __vv = static_cast<void*>(__v); void* __vv = static_cast<void*>(__v);
return atomic_address::compare_exchange_weak(*__vr, __vv, __m1, __m2); return atomic_address::compare_exchange_weak(*__vr, __vv, __m1, __m2);
} }
template<typename _Tp> template<typename _Tp>
bool bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v, atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m1, memory_order __m1,
memory_order __m2) volatile memory_order __m2)
{ {
void** __vr = reinterpret_cast<void**>(&__r); void** __vr = reinterpret_cast<void**>(&__r);
void* __vv = static_cast<void*>(__v); void* __vv = static_cast<void*>(__v);
return atomic_address::compare_exchange_strong(*__vr, __vv, __m1, __m2); return atomic_address::compare_exchange_strong(*__vr, __vv, __m1, __m2);
} }
template<typename _Tp> template<typename _Tp>
bool bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
memory_order __m) volatile memory_order __m)
{ {
return compare_exchange_weak(__r, __v, __m, return compare_exchange_weak(__r, __v, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
} }
template<typename _Tp> template<typename _Tp>
bool bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v, atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m) volatile memory_order __m)
{ {
return compare_exchange_strong(__r, __v, __m, return compare_exchange_strong(__r, __v, __m,
__calculate_memory_order(__m)); __calculate_memory_order(__m));
} }
template<typename _Tp> template<typename _Tp>
_Tp* _Tp*
atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m) volatile atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m)
{ {
void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m); void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m);
return static_cast<_Tp*>(__p); return static_cast<_Tp*>(__p);
} }
template<typename _Tp> template<typename _Tp>
_Tp* _Tp*
atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) volatile atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m)
{ {
void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m); void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
return static_cast<_Tp*>(__p); return static_cast<_Tp*>(__p);
} }
// Convenience function definitions, atomic_flag. // Convenience function definitions, atomic_flag.
inline bool inline bool
atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, memory_order __m) atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m)
{ return __a->test_and_set(__m); } { return __a->test_and_set(__m); }
inline void inline void
atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m) atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m)
{ return __a->clear(__m); } { return __a->clear(__m); }
// Convenience function definitions, atomic_address. // Convenience function definitions, atomic_address.
inline bool inline bool
atomic_is_lock_free(const volatile atomic_address* __a) atomic_is_lock_free(const atomic_address* __a)
{ return __a->is_lock_free(); } { return __a->is_lock_free(); }
inline void inline void
atomic_store(volatile atomic_address* __a, void* __v) atomic_store(atomic_address* __a, void* __v)
{ __a->store(__v); } { __a->store(__v); }
inline void inline void
atomic_store_explicit(volatile atomic_address* __a, void* __v, atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m)
memory_order __m)
{ __a->store(__v, __m); } { __a->store(__v, __m); }
inline void* inline void*
atomic_load(const volatile atomic_address* __a) atomic_load(const atomic_address* __a)
{ return __a->load(); } { return __a->load(); }
inline void* inline void*
atomic_load_explicit(const volatile atomic_address* __a, memory_order __m) atomic_load_explicit(const atomic_address* __a, memory_order __m)
{ return __a->load(__m); } { return __a->load(__m); }
inline void* inline void*
atomic_exchange(volatile atomic_address* __a, void* __v) atomic_exchange(atomic_address* __a, void* __v)
{ return __a->exchange(__v); } { return __a->exchange(__v); }
inline void* inline void*
atomic_exchange_explicit(volatile atomic_address* __a, void* __v, atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m)
memory_order __m)
{ return __a->exchange(__v, __m); } { return __a->exchange(__v, __m); }
inline bool inline bool
atomic_compare_exchange_weak(volatile atomic_address* __a, atomic_compare_exchange_weak(atomic_address* __a, void** __v1, void* __v2)
void** __v1, void* __v2) {
{ return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst,
return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst, memory_order_seq_cst);
memory_order_seq_cst);
} }
inline bool inline bool
atomic_compare_exchange_strong(volatile atomic_address* __a, atomic_compare_exchange_strong(atomic_address* __a,
void** __v1, void* __v2) void** __v1, void* __v2)
{ {
return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst, return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
memory_order_seq_cst); memory_order_seq_cst);
} }
inline bool inline bool
atomic_compare_exchange_weak_explicit(volatile atomic_address* __a, atomic_compare_exchange_weak_explicit(atomic_address* __a,
void** __v1, void* __v2, void** __v1, void* __v2,
memory_order __m1, memory_order __m2) memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); } { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
inline bool inline bool
atomic_compare_exchange_strong_explicit(volatile atomic_address* __a, atomic_compare_exchange_strong_explicit(atomic_address* __a,
void** __v1, void* __v2, void** __v1, void* __v2,
memory_order __m1, memory_order __m2) memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); } { return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
inline void* inline void*
atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __d, atomic_fetch_add_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m) memory_order __m)
{ return __a->fetch_add(__d, __m); } { return __a->fetch_add(__d, __m); }
inline void* inline void*
atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __d) atomic_fetch_add(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_add(__d); } { return __a->fetch_add(__d); }
inline void* inline void*
atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __d, atomic_fetch_sub_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m) memory_order __m)
{ return __a->fetch_sub(__d, __m); } { return __a->fetch_sub(__d, __m); }
inline void* inline void*
atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __d) atomic_fetch_sub(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_sub(__d); } { return __a->fetch_sub(__d); }
// Convenience function definitions, atomic_bool. // Convenience function definitions, atomic_bool.
inline bool inline bool
atomic_is_lock_free(const volatile atomic_bool* __a) atomic_is_lock_free(const atomic_bool* __a)
{ return __a->is_lock_free(); } { return __a->is_lock_free(); }
inline void inline void
atomic_store(volatile atomic_bool* __a, bool __i) atomic_store(atomic_bool* __a, bool __i)
{ __a->store(__i); } { __a->store(__i); }
inline void inline void
atomic_store_explicit(volatile atomic_bool* __a, bool __i, memory_order __m) atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m)
{ __a->store(__i, __m); } { __a->store(__i, __m); }
inline bool inline bool
atomic_load(const volatile atomic_bool* __a) atomic_load(const atomic_bool* __a)
{ return __a->load(); } { return __a->load(); }
inline bool inline bool
atomic_load_explicit(const volatile atomic_bool* __a, memory_order __m) atomic_load_explicit(const atomic_bool* __a, memory_order __m)
{ return __a->load(__m); } { return __a->load(__m); }
inline bool inline bool
atomic_exchange(volatile atomic_bool* __a, bool __i) atomic_exchange(atomic_bool* __a, bool __i)
{ return __a->exchange(__i); } { return __a->exchange(__i); }
inline bool inline bool
atomic_exchange_explicit(volatile atomic_bool* __a, bool __i, atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m)
memory_order __m)
{ return __a->exchange(__i, __m); } { return __a->exchange(__i, __m); }
inline bool inline bool
atomic_compare_exchange_weak(volatile atomic_bool* __a, bool* __i1, bool __i2) atomic_compare_exchange_weak(atomic_bool* __a, bool* __i1, bool __i2)
{ {
return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst, return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst,
memory_order_seq_cst); memory_order_seq_cst);
} }
inline bool inline bool
atomic_compare_exchange_strong(volatile atomic_bool* __a, atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2)
bool* __i1, bool __i2) {
{ return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst, memory_order_seq_cst);
memory_order_seq_cst);
} }
inline bool inline bool
atomic_compare_exchange_weak_explicit(volatile atomic_bool* __a, bool* __i1, atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1,
bool __i2, memory_order __m1, bool __i2, memory_order __m1,
memory_order __m2) memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
inline bool inline bool
atomic_compare_exchange_strong_explicit(volatile atomic_bool* __a, atomic_compare_exchange_strong_explicit(atomic_bool* __a,
bool* __i1, bool __i2, bool* __i1, bool __i2,
memory_order __m1, memory_order __m2) memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
@ -712,131 +699,129 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Free standing functions. Template argument should be constricted // Free standing functions. Template argument should be constricted
// to intergral types as specified in the standard. // to intergral types as specified in the standard.
template<typename _ITp> template<typename _ITp>
inline void inline void
atomic_store_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, atomic_store_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m)
memory_order __m)
{ __a->store(__i, __m); } { __a->store(__i, __m); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_load_explicit(const volatile __atomic_base<_ITp>* __a, atomic_load_explicit(const __atomic_base<_ITp>* __a, memory_order __m)
memory_order __m) { return __a->load(__m); }
{ return __a->load(__m); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_exchange_explicit(volatile __atomic_base<_ITp>* __a, atomic_exchange_explicit(__atomic_base<_ITp>* __a, _ITp __i,
_ITp __i, memory_order __m) memory_order __m)
{ return __a->exchange(__i, __m); } { return __a->exchange(__i, __m); }
template<typename _ITp> template<typename _ITp>
inline bool inline bool
atomic_compare_exchange_weak_explicit(volatile __atomic_base<_ITp>* __a, atomic_compare_exchange_weak_explicit(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2, _ITp* __i1, _ITp __i2,
memory_order __m1, memory_order __m2) memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); } { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
template<typename _ITp> template<typename _ITp>
inline bool inline bool
atomic_compare_exchange_strong_explicit(volatile __atomic_base<_ITp>* __a, atomic_compare_exchange_strong_explicit(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2, _ITp* __i1, _ITp __i2,
memory_order __m1, memory_order __m1,
memory_order __m2) memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); } { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m) memory_order __m)
{ return __a->fetch_add(__i, __m); } { return __a->fetch_add(__i, __m); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m) memory_order __m)
{ return __a->fetch_sub(__i, __m); } { return __a->fetch_sub(__i, __m); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m) memory_order __m)
{ return __a->fetch_and(__i, __m); } { return __a->fetch_and(__i, __m); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m) memory_order __m)
{ return __a->fetch_or(__i, __m); } { return __a->fetch_or(__i, __m); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i, atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m) memory_order __m)
{ return __a->fetch_xor(__i, __m); } { return __a->fetch_xor(__i, __m); }
template<typename _ITp> template<typename _ITp>
inline bool inline bool
atomic_is_lock_free(const volatile __atomic_base<_ITp>* __a) atomic_is_lock_free(const __atomic_base<_ITp>* __a)
{ return __a->is_lock_free(); } { return __a->is_lock_free(); }
template<typename _ITp> template<typename _ITp>
inline void inline void
atomic_store(volatile __atomic_base<_ITp>* __a, _ITp __i) atomic_store(__atomic_base<_ITp>* __a, _ITp __i)
{ atomic_store_explicit(__a, __i, memory_order_seq_cst); } { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_load(const volatile __atomic_base<_ITp>* __a) atomic_load(const __atomic_base<_ITp>* __a)
{ return atomic_load_explicit(__a, memory_order_seq_cst); } { return atomic_load_explicit(__a, memory_order_seq_cst); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_exchange(volatile __atomic_base<_ITp>* __a, _ITp __i) atomic_exchange(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); } { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp> template<typename _ITp>
inline bool inline bool
atomic_compare_exchange_weak(volatile __atomic_base<_ITp>* __a, atomic_compare_exchange_weak(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2) _ITp* __i1, _ITp __i2)
{ {
return atomic_compare_exchange_weak_explicit(__a, __i1, __i2, return atomic_compare_exchange_weak_explicit(__a, __i1, __i2,
memory_order_seq_cst, memory_order_seq_cst,
memory_order_seq_cst); memory_order_seq_cst);
} }
template<typename _ITp> template<typename _ITp>
inline bool inline bool
atomic_compare_exchange_strong(volatile __atomic_base<_ITp>* __a, atomic_compare_exchange_strong(__atomic_base<_ITp>* __a,
_ITp* __i1, _ITp __i2) _ITp* __i1, _ITp __i2)
{ {
return atomic_compare_exchange_strong_explicit(__a, __i1, __i2, return atomic_compare_exchange_strong_explicit(__a, __i1, __i2,
memory_order_seq_cst, memory_order_seq_cst,
memory_order_seq_cst); memory_order_seq_cst);
} }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i) atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); } { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i) atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); } { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i) atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); } { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i) atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); } { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp> template<typename _ITp>
inline _ITp inline _ITp
atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i) atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); } { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
// @} group atomics // @} group atomics
@ -844,5 +829,3 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE _GLIBCXX_END_NAMESPACE
#endif #endif

View file

@ -41,7 +41,7 @@
#include <condition_variable> #include <condition_variable>
#include <system_error> #include <system_error>
#include <exception> #include <exception>
#include <cstdatomic> #include <atomic>
#include <bits/functexcept.h> #include <bits/functexcept.h>
namespace std namespace std

View file

@ -24,7 +24,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include "gstdint.h" #include "gstdint.h"
#include <cstdatomic> #include <atomic>
#include <mutex> #include <mutex>
#define LOGSIZE 4 #define LOGSIZE 4
@ -40,7 +40,7 @@ namespace
} }
#endif #endif
std::__atomic_flag_base volatile flag_table[ 1 << LOGSIZE ] = std::__atomic_flag_base flag_table[ 1 << LOGSIZE ] =
{ {
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
@ -54,7 +54,7 @@ namespace std
namespace __atomic0 namespace __atomic0
{ {
bool bool
atomic_flag::test_and_set(memory_order) volatile atomic_flag::test_and_set(memory_order)
{ {
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
lock_guard<mutex> __lock(get_atomic_mutex()); lock_guard<mutex> __lock(get_atomic_mutex());
@ -65,7 +65,7 @@ namespace std
} }
void void
atomic_flag::clear(memory_order) volatile atomic_flag::clear(memory_order)
{ {
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
lock_guard<mutex> __lock(get_atomic_mutex()); lock_guard<mutex> __lock(get_atomic_mutex());
@ -77,31 +77,31 @@ namespace std
extern "C" extern "C"
{ {
bool bool
atomic_flag_test_and_set_explicit(volatile __atomic_flag_base* __a, atomic_flag_test_and_set_explicit(__atomic_flag_base* __a,
memory_order __m) throw () memory_order __m) throw ()
{ {
volatile atomic_flag* d = static_cast<volatile atomic_flag*>(__a); atomic_flag* d = static_cast<volatile atomic_flag*>(__a);
return d->test_and_set(__m); return d->test_and_set(__m);
} }
void void
atomic_flag_clear_explicit(volatile __atomic_flag_base* __a, atomic_flag_clear_explicit(__atomic_flag_base* __a,
memory_order __m) throw () memory_order __m) throw ()
{ {
volatile atomic_flag* d = static_cast<volatile atomic_flag*>(__a); atomic_flag* d = static_cast<volatile atomic_flag*>(__a);
return d->clear(__m); return d->clear(__m);
} }
void void
__atomic_flag_wait_explicit(volatile __atomic_flag_base* __a, __atomic_flag_wait_explicit(__atomic_flag_base* __a,
memory_order __x) throw () memory_order __x) throw ()
{ {
while (atomic_flag_test_and_set_explicit(__a, __x)) while (atomic_flag_test_and_set_explicit(__a, __x))
{ }; { };
} }
volatile __atomic_flag_base* __atomic_flag_base*
__atomic_flag_for_address(const volatile void* __z) throw () __atomic_flag_for_address(const void* __z) throw ()
{ {
uintptr_t __u = reinterpret_cast<uintptr_t>(__z); uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
__u += (__u >> 2) + (__u << 4); __u += (__u >> 2) + (__u << 4);
@ -114,3 +114,24 @@ namespace std
} }
} // extern "C" } // extern "C"
} // namespace std } // namespace std
// XXX GLIBCXX_ABI Deprecated
// gcc-4.5.0
// <atomic> signature changes
// The rename syntax for default exported names is
// asm (".symver name1,exportedname@GLIBCXX_3.4")
// asm (".symver name2,exportedname@@GLIBCXX_3.4.5")
// In the future, GLIBCXX_ABI > 6 should remove all uses of
// _GLIBCXX_*_SYMVER macros in this file.
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
asm (".symver " #cur "," #old "@@" #version);
#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE)
_GLIBCXX_ASM_SYMVER(_ZNSt9__atomic011atomic_flag5clearESt12memory_order, _ZNVSt9__atomic011atomic_flag5clearESt12memory_order, GLIBCXX_3.4.11)
_GLIBCXX_ASM_SYMVER(_ZNSt9__atomic011atomic_flag12test_and_setESt12memory_order, _ZNVSt9__atomic011atomic_flag12test_and_setESt12memory_order, GLIBCXX_3.4.11)
#endif

View file

@ -33,9 +33,23 @@
namespace std namespace std
{ {
// gcc-4.4.0
// <mutex> exported std::lock_error
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
class lock_error : public exception
{
public:
virtual const char*
_GLIBCXX_CONST what() const throw();
};
const char*
lock_error::what() const throw()
{ return "std::lock_error"; }
#endif
// We need these due to the symbols exported since GLIBCXX_3.4.10. // We need these due to the symbols exported since GLIBCXX_3.4.10.
// See libstdc++/41662 for details. // See libstdc++/41662 for details.
template<typename _Tp> template<typename _Tp>
struct hash : public std::unary_function<_Tp, size_t> struct hash : public std::unary_function<_Tp, size_t>
{ {

View file

@ -513,25 +513,6 @@ extern __attribute__((used, weak)) const void * const _ZTIPKe[4]
(void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe };
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT #endif // _GLIBCXX_LONG_DOUBLE_COMPAT
// gcc-4.4.0
// <mutex> exported std::lock_error
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
namespace std
{
class lock_error : public exception
{
public:
virtual const char*
_GLIBCXX_CONST what() const throw();
};
const char*
lock_error::what() const throw()
{ return "std::lock_error"; }
}
#endif
#ifdef _GLIBCXX_SYMVER_DARWIN #ifdef _GLIBCXX_SYMVER_DARWIN
#if (defined(__ppc__) || defined(__ppc64__)) && defined(PIC) #if (defined(__ppc__) || defined(__ppc64__)) && defined(PIC)
/* __eprintf shouldn't have been made visible from libstdc++, or /* __eprintf shouldn't have been made visible from libstdc++, or

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
@ -30,19 +29,19 @@ int main()
} }
// { dg-error "used here" "" { target *-*-* } 521 } // { dg-error "used here" "" { target *-*-* } 521 }
// { dg-error "deleted function" "" { target *-*-* } 239 } // { dg-error "deleted function" "" { target *-*-* } 231 }
// { dg-error "deleted function" "" { target *-*-* } 257 } // { dg-error "deleted function" "" { target *-*-* } 249 }
// { dg-error "deleted function" "" { target *-*-* } 275 } // { dg-error "deleted function" "" { target *-*-* } 267 }
// { dg-error "deleted function" "" { target *-*-* } 293 } // { dg-error "deleted function" "" { target *-*-* } 285 }
// { dg-error "deleted function" "" { target *-*-* } 311 } // { dg-error "deleted function" "" { target *-*-* } 303 }
// { dg-error "deleted function" "" { target *-*-* } 329 } // { dg-error "deleted function" "" { target *-*-* } 321 }
// { dg-error "deleted function" "" { target *-*-* } 347 } // { dg-error "deleted function" "" { target *-*-* } 339 }
// { dg-error "deleted function" "" { target *-*-* } 365 } // { dg-error "deleted function" "" { target *-*-* } 357 }
// { dg-error "deleted function" "" { target *-*-* } 383 } // { dg-error "deleted function" "" { target *-*-* } 375 }
// { dg-error "deleted function" "" { target *-*-* } 401 } // { dg-error "deleted function" "" { target *-*-* } 393 }
// { dg-error "deleted function" "" { target *-*-* } 419 } // { dg-error "deleted function" "" { target *-*-* } 411 }
// { dg-error "deleted function" "" { target *-*-* } 437 } // { dg-error "deleted function" "" { target *-*-* } 429 }
// { dg-error "deleted function" "" { target *-*-* } 455 } // { dg-error "deleted function" "" { target *-*-* } 447 }
// { dg-error "deleted function" "" { target *-*-* } 473 } // { dg-error "deleted function" "" { target *-*-* } 465 }
// { dg-error "deleted function" "" { target *-*-* } 491 } // { dg-error "deleted function" "" { target *-*-* } 483 }
// { dg-excess-errors "In member function" } // { dg-excess-errors "In member function" }

View file

@ -17,14 +17,13 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::copy_list_initializable test; __gnu_test::copy_list_initializable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(), __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
@ -29,20 +28,20 @@ int main()
return 0; return 0;
} }
// { dg-error "used here" "" { target *-*-* } 560 } // { dg-error "used here" "" { target *-*-* } 560 }
// { dg-error "deleted function" "" { target *-*-* } 238 } // { dg-error "deleted function" "" { target *-*-* } 248 }
// { dg-error "deleted function" "" { target *-*-* } 256 } // { dg-error "deleted function" "" { target *-*-* } 266 }
// { dg-error "deleted function" "" { target *-*-* } 274 } // { dg-error "deleted function" "" { target *-*-* } 284 }
// { dg-error "deleted function" "" { target *-*-* } 292 } // { dg-error "deleted function" "" { target *-*-* } 302 }
// { dg-error "deleted function" "" { target *-*-* } 310 } // { dg-error "deleted function" "" { target *-*-* } 320 }
// { dg-error "deleted function" "" { target *-*-* } 328 } // { dg-error "deleted function" "" { target *-*-* } 338 }
// { dg-error "deleted function" "" { target *-*-* } 346 } // { dg-error "deleted function" "" { target *-*-* } 356 }
// { dg-error "deleted function" "" { target *-*-* } 364 } // { dg-error "deleted function" "" { target *-*-* } 374 }
// { dg-error "deleted function" "" { target *-*-* } 382 } // { dg-error "deleted function" "" { target *-*-* } 230 }
// { dg-error "deleted function" "" { target *-*-* } 400 } // { dg-error "deleted function" "" { target *-*-* } 410 }
// { dg-error "deleted function" "" { target *-*-* } 418 } // { dg-error "deleted function" "" { target *-*-* } 428 }
// { dg-error "deleted function" "" { target *-*-* } 436 } // { dg-error "deleted function" "" { target *-*-* } 446 }
// { dg-error "deleted function" "" { target *-*-* } 454 } // { dg-error "deleted function" "" { target *-*-* } 464 }
// { dg-error "deleted function" "" { target *-*-* } 472 } // { dg-error "deleted function" "" { target *-*-* } 482 }
// { dg-error "deleted function" "" { target *-*-* } 490 } // { dg-error "deleted function" "" { target *-*-* } 392 }
// { dg-excess-errors "In member function" } // { dg-excess-errors "In member function" }

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -17,14 +17,13 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::direct_list_initializable test; __gnu_test::direct_list_initializable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(), __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -17,14 +17,13 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::single_value_constructible test; __gnu_test::single_value_constructible test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(), __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -0,0 +1,39 @@
// { dg-options "-std=gnu++0x" }
// { dg-do link { xfail *-*-* } }
// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <atomic>
struct dwordp
{
int* p1;
int* p2;
};
void atomics()
{
std::atomic<dwordp> a;
bool b = a.is_lock_free(); // { dg-excess-errors "undefined reference to" }
}
int main()
{
atomics();
return 0;
}

View file

@ -17,15 +17,14 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::integral_assignable test; __gnu_test::integral_assignable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(), __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -17,15 +17,14 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::integral_convertable test; __gnu_test::integral_convertable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(), __gnu_cxx::typelist::apply_generator(test, __gnu_test::atomics_tl(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -18,14 +18,14 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cstdatomic> #include <atomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
void test01() void test01()
{ {
// Check for required base class. // Check for required base class.
__gnu_test::has_required_base_class test; __gnu_test::has_required_base_class test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type(), __gnu_test::atomic_integrals::type(),
__gnu_test::atomics_tl()); __gnu_test::atomics_tl());
} }

View file

@ -18,10 +18,9 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// This file tests explicit instantiation of basic_string // This file tests explicit instantiation of basic_string
#include <cstdatomic> #include <atomic>
#include <testsuite_character.h> #include <testsuite_character.h>
template class std::atomic<__gnu_test::pod_char>; template class std::atomic<__gnu_test::pod_char>;

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
int main() int main()
{ {

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
void test01() void test01()
{ {
@ -29,5 +28,5 @@ void test01()
test_type t2; test_type t2;
t1 = t2; t1 = t2;
} }
// { dg-error "used here" "" { target *-*-* } 30 } // { dg-error "used here" "" { target *-*-* } 29 }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
void test01() void test01()
{ {
@ -28,5 +27,5 @@ void test01()
test_type t1; test_type t1;
test_type t2(t1); test_type t2(t1);
} }
// { dg-error "used here" "" { target *-*-* } 29 } // { dg-error "used here" "" { target *-*-* } 28 }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
int main() int main()
{ {

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
int main() int main()
{ {

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
void test01() void test01()

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
void test01() void test01()

View file

@ -17,7 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cstdatomic> #include <atomic>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
int main() int main()

View file

@ -1,5 +1,5 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// //
@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
int main() int main()
{ {

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
void test01() void test01()
{ {
@ -29,5 +28,5 @@ void test01()
test_type t2; test_type t2;
t1 = t2; t1 = t2;
} }
// { dg-error "used here" "" { target *-*-* } 30 } // { dg-error "used here" "" { target *-*-* } 29 }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
void test01() void test01()
{ {
@ -28,5 +27,5 @@ void test01()
test_type t1; test_type t1;
test_type t2(t1); test_type t2(t1);
} }
// { dg-error "used here" "" { target *-*-* } 29 } // { dg-error "used here" "" { target *-*-* } 28 }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
int main() int main()
{ {

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
void test01() void test01()

View file

@ -18,8 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
void test01() void test01()

View file

@ -17,7 +17,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <stdatomic.h> #include <stdatomic.h>
int main() int main()

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
int main() int main()
{ {

View file

@ -17,7 +17,6 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <stdatomic.h> #include <stdatomic.h>
int main() int main()

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
int main() int main()
{ {

View file

@ -18,24 +18,23 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::assignable test; __gnu_test::assignable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type()); __gnu_test::atomic_integrals::type());
return 0; return 0;
} }
// { dg-error "used here" "" { target *-*-* } 521 } // { dg-error "used here" "" { target *-*-* } 521 }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }
// { dg-error "instantiated from" "" { target *-*-* } 29 } // { dg-error "instantiated from" "" { target *-*-* } 28 }
// { dg-error "instantiated from" "" { target *-*-* } 528 } // { dg-error "instantiated from" "" { target *-*-* } 528 }
// { dg-error "instantiated from" "" { target *-*-* } 170 } // { dg-error "instantiated from" "" { target *-*-* } 170 }
// { dg-error "instantiated from" "" { target *-*-* } 399 } // { dg-error "instantiated from" "" { target *-*-* } 399 }
// { dg-error "instantiated from" "" { target *-*-* } 168 } // { dg-error "instantiated from" "" { target *-*-* } 168 }
// { dg-excess-errors "In member function" } // { dg-excess-errors "In member function" }

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -18,24 +18,23 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::copy_constructible test; __gnu_test::copy_constructible test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type()); __gnu_test::atomic_integrals::type());
return 0; return 0;
} }
// { dg-error "used here" "" { target *-*-* } 560 } // { dg-error "used here" "" { target *-*-* } 560 }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }
// { dg-excess-errors "deleted function" } // { dg-excess-errors "deleted function" }
// { dg-error "instantiated from" "" { target *-*-* } 29 } // { dg-error "instantiated from" "" { target *-*-* } 28 }
// { dg-error "instantiated from" "" { target *-*-* } 566 } // { dg-error "instantiated from" "" { target *-*-* } 566 }
// { dg-error "instantiated from" "" { target *-*-* } 170 } // { dg-error "instantiated from" "" { target *-*-* } 170 }
// { dg-error "instantiated from" "" { target *-*-* } 399 } // { dg-error "instantiated from" "" { target *-*-* } 399 }
// { dg-error "instantiated from" "" { target *-*-* } 168 } // { dg-error "instantiated from" "" { target *-*-* } 168 }
// { dg-excess-errors "In member function" } // { dg-excess-errors "In member function" }

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -17,15 +17,14 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::direct_list_initializable test; __gnu_test::direct_list_initializable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type(), __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -17,15 +17,14 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()
{ {
__gnu_test::single_value_constructible test; __gnu_test::single_value_constructible test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type(), __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -1,25 +1,24 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 3, or (at // published by the Free Software Foundation; either version 3, or (at
// your option) any later version. // your option) any later version.
// This library is distributed in the hope that it will be useful, but // This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of // WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING3. If not see // along with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -1,25 +1,24 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 3, or (at // published by the Free Software Foundation; either version 3, or (at
// your option) any later version. // your option) any later version.
// This library is distributed in the hope that it will be useful, but // This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of // WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING3. If not see // along with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -1,25 +1,24 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 3, or (at // published by the Free Software Foundation; either version 3, or (at
// your option) any later version. // your option) any later version.
// This library is distributed in the hope that it will be useful, but // This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of // WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING3. If not see // along with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -1,25 +1,24 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 3, or (at // published by the Free Software Foundation; either version 3, or (at
// your option) any later version. // your option) any later version.
// This library is distributed in the hope that it will be useful, but // This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of // WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING3. If not see // along with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -1,25 +1,24 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 3, or (at // published by the Free Software Foundation; either version 3, or (at
// your option) any later version. // your option) any later version.
// This library is distributed in the hope that it will be useful, but // This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of // WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING3. If not see // along with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -1,25 +1,24 @@
// { dg-options "-std=gnu++0x" } // { dg-options "-std=gnu++0x" }
// { dg-do compile } // { dg-do compile }
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2008, 2009 Free Software Foundation, Inc. // Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as // modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 3, or (at // published by the Free Software Foundation; either version 3, or (at
// your option) any later version. // your option) any later version.
// This library is distributed in the hope that it will be useful, but // This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of // WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details. // General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING3. If not see // along with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
int main() int main()

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
@ -26,7 +25,7 @@ int main()
{ {
__gnu_test::integral_assignable test; __gnu_test::integral_assignable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type(), __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -17,8 +17,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
@ -26,7 +25,7 @@ int main()
{ {
__gnu_test::integral_convertable test; __gnu_test::integral_convertable test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type(), __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type()); __gnu_test::integral_types::type());
return 0; return 0;
} }

View file

@ -19,13 +19,13 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cstdatomic> #include <atomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
void test01() void test01()
{ {
// Check for standard layout requirements // Check for standard layout requirements
__gnu_test::standard_layout test; __gnu_test::standard_layout test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type()); __gnu_test::atomic_integrals::type());
} }

View file

@ -18,13 +18,12 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <atomic>
#include <cstdatomic>
#include <testsuite_common_types.h> #include <testsuite_common_types.h>
void test01() void test01()
{ {
__gnu_test::has_trivial_cons_dtor test; __gnu_test::has_trivial_cons_dtor test;
__gnu_cxx::typelist::apply_generator(test, __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type()); __gnu_test::atomic_integrals::type());
} }

View file

@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cstdatomic> #include <atomic>
namespace gnu namespace gnu
{ {

View file

@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cstdatomic> #include <atomic>
namespace gnu namespace gnu
{ {

View file

@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cstdatomic> // { dg-excess-errors "In file included from" } #include <atomic> // { dg-excess-errors "In file included from" }
// { dg-error "upcoming ISO" "" { target *-*-* } 31 } // { dg-error "upcoming ISO" "" { target *-*-* } 31 }

View file

@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <cstdatomic> #include <atomic>
void test01() void test01()
{ {

View file

@ -0,0 +1,78 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <atomic>
void test01()
{
// Not global scoped, only namespace std.
using memory_order;
using memory_order_relaxed;
using memory_order_consume;
using memory_order_acquire;
using memory_order_release;
using memory_order_acq_rel;
using memory_order_seq_cst;
using atomic_flag;
using atomic_bool;
using atomic_char;
using atomic_schar;
using atomic_uchar;
using atomic_short;
using atomic_ushort;
using atomic_int;
using atomic_uint;
using atomic_long;
using atomic_ulong;
using atomic_llong;
using atomic_ullong;
using atomic_wchar_t;
using atomic_char16_t;
using atomic_char32_t;
using atomic_address;
}
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 26 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 27 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 28 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 29 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 30 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 31 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 32 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 34 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 36 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 37 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 38 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 39 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 40 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 41 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 42 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 43 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 44 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 45 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 46 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 47 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 48 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 49 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 50 }
// { dg-error "expected nested-name-specifier" "" { target *-*-* } 52 }

View file

@ -22,8 +22,8 @@
int main() int main()
{ {
volatile atomic_flag f; atomic_flag f;
volatile atomic_flag* p = &f; atomic_flag* p = &f;
memory_order m = memory_order_relaxed; memory_order m = memory_order_relaxed;
// For position only. // For position only.

View file

@ -44,7 +44,7 @@
#include <tr1/unordered_set> #include <tr1/unordered_set>
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <cstdatomic> #include <atomic>
#include <type_traits> #include <type_traits>
#endif #endif