+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>
PR libstdc++/40088
@srcdir@/libsupc++/typeinfo \
include/algorithm \
include/array \
+ include/atomic \
include/bitset \
include/chrono \
include/complex \
include/csetjmp \
include/csignal \
include/cstdarg \
- include/cstdatomic \
include/cstdbool \
include/cstddef \
include/cstdint \
</row>
<row>
<entry>29.2</entry>
- <entry>Header <code><cstdatomic></code> synopsis</entry>
+ <entry>Header <code><atomic></code> synopsis</entry>
<entry>Y</entry>
<entry></entry>
</row>
<entry><filename class="headerfile">csetjmp</filename></entry>
<entry><filename class="headerfile">csignal</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>
-<entry><filename class="headerfile">cstdbool</filename></entry>
<entry><filename class="headerfile">cstddef</filename></entry>
<entry><filename class="headerfile">cstdint</filename></entry>
<entry><filename class="headerfile">cstdlib</filename></entry>
<entry><filename class="headerfile">cstdio</filename></entry>
+<entry><filename class="headerfile">cstring</filename></entry>
</row>
<row>
-<entry><filename class="headerfile">cstring</filename></entry>
<entry><filename class="headerfile">ctgmath</filename></entry>
<entry><filename class="headerfile">ctime</filename></entry>
<entry><filename class="headerfile">cuchar</filename></entry>
<entry><filename class="headerfile">cwchar</filename></entry>
+<entry><filename class="headerfile">cwctype</filename></entry>
</row>
<row>
-<entry><filename class="headerfile">cwctype</filename></entry>
<entry><filename class="headerfile">stdatomic.h</filename></entry>
</row>
std_headers = \
${std_srcdir}/algorithm \
${std_srcdir}/array \
+ ${std_srcdir}/atomic \
${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \
${std_srcdir}/chrono \
bits_headers = \
${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \
+ ${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \
${c_base_srcdir}/csetjmp \
${c_base_srcdir}/csignal \
${c_base_srcdir}/cstdarg \
- ${c_base_srcdir}/cstdatomic \
${c_base_srcdir}/cstdbool \
${c_base_srcdir}/cstddef \
${c_base_srcdir}/cstdint \
std_headers = \
${std_srcdir}/algorithm \
${std_srcdir}/array \
+ ${std_srcdir}/atomic \
${std_srcdir}/bitset \
${std_srcdir}/c++0x_warning.h \
${std_srcdir}/chrono \
bits_headers = \
${bits_srcdir}/algorithmfwd.h \
${bits_srcdir}/allocator.h \
+ ${bits_srcdir}/atomic_base.h \
${bits_srcdir}/atomicfwd_c.h \
${bits_srcdir}/atomicfwd_cxx.h \
${bits_srcdir}/atomic_0.h \
${c_base_srcdir}/csetjmp \
${c_base_srcdir}/csignal \
${c_base_srcdir}/cstdarg \
- ${c_base_srcdir}/cstdatomic \
${c_base_srcdir}/cstdbool \
${c_base_srcdir}/cstddef \
${c_base_srcdir}/cstdint \
// Implementation specific defines.
#define _ATOMIC_LOAD_(__a, __x) \
- ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
- volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
+ ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ __atomic_flag_base* __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__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__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); \
*__p = __v; \
atomic_flag_clear_explicit(__g, __x); \
__v; })
#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
- ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ ({__typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
__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); \
__typeof__ _ATOMIC_MEMBER_ __r = *__p; \
*__p __o __v; \
__r; })
#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__(__m) __v = (__m); \
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); \
__typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
if (__t__ == *__q) { *__p = __v; __r = true; } \
atomic_flag() = default;
~atomic_flag() = default;
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.
atomic_flag(bool __i): __atomic_flag_base({ __i }) { }
bool
- test_and_set(memory_order __m = memory_order_seq_cst) volatile;
+ test_and_set(memory_order __m = memory_order_seq_cst);
void
- clear(memory_order __m = memory_order_seq_cst) volatile;
+ clear(memory_order __m = memory_order_seq_cst);
};
/// 29.4.2, address types
atomic_address() = default;
~atomic_address() = default;
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; }
bool
- is_lock_free() const volatile
+ is_lock_free() const
{ return false; }
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_acq_rel);
}
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_acq_rel);
}
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); }
bool
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_acq_rel);
bool
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,
__calculate_memory_order(__m));
bool
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_acq_rel);
bool
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,
__calculate_memory_order(__m));
}
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);
- volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+ void** __p = &(_M_i);
+ __atomic_flag_base* __g = __atomic_flag_for_address(__p);
__atomic_flag_wait_explicit(__g, __m);
void* __r = *__p;
*__p = (void*)((char*)(*__p) + __d);
}
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);
- volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+ void** __p = &(_M_i);
+ __atomic_flag_base* __g = __atomic_flag_for_address(__p);
__atomic_flag_wait_explicit(__g, __m);
void* __r = *__p;
*__p = (void*)((char*)(*__p) - __d);
return __r;
}
- operator void*() const volatile
+ operator void*() const
{ return load(); }
void*
- operator=(void* __v) // XXX volatile
+ operator=(void* __v)
{
store(__v);
return __v;
}
void*
- operator+=(ptrdiff_t __d) volatile
+ operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; }
void*
- operator-=(ptrdiff_t __d) volatile
+ operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; }
};
__atomic_base() = default;
~__atomic_base() = default;
__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.
__atomic_base(__integral_type __i) { _M_i = __i; }
- operator __integral_type() const volatile
+ operator __integral_type() const
{ return load(); }
__integral_type
- operator=(__integral_type __i) // XXX volatile
+ operator=(__integral_type __i)
{
store(__i);
return __i;
}
__integral_type
- operator++(int) volatile
+ operator++(int)
{ return fetch_add(1); }
__integral_type
- operator--(int) volatile
+ operator--(int)
{ return fetch_sub(1); }
__integral_type
- operator++() volatile
+ operator++()
{ return fetch_add(1) + 1; }
__integral_type
- operator--() volatile
+ operator--()
{ return fetch_sub(1) - 1; }
__integral_type
- operator+=(__integral_type __i) volatile
+ operator+=(__integral_type __i)
{ return fetch_add(__i) + __i; }
__integral_type
- operator-=(__integral_type __i) volatile
+ operator-=(__integral_type __i)
{ return fetch_sub(__i) - __i; }
__integral_type
- operator&=(__integral_type __i) volatile
+ operator&=(__integral_type __i)
{ return fetch_and(__i) & __i; }
__integral_type
- operator|=(__integral_type __i) volatile
+ operator|=(__integral_type __i)
{ return fetch_or(__i) | __i; }
__integral_type
- operator^=(__integral_type __i) volatile
+ operator^=(__integral_type __i)
{ return fetch_xor(__i) ^ __i; }
bool
- is_lock_free() const volatile
+ is_lock_free() const
{ return false; }
void
- store(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ store(__integral_type __i, memory_order __m = memory_order_seq_cst)
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
}
__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_acq_rel);
}
__integral_type
- exchange(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, =, __i, __m); }
bool
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_acq_rel);
bool
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,
__calculate_memory_order(__m));
bool
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_acq_rel);
bool
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,
__calculate_memory_order(__m));
}
__integral_type
- fetch_add(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ fetch_add(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, +=, __i, __m); }
__integral_type
- fetch_sub(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ fetch_sub(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, -=, __i, __m); }
__integral_type
- fetch_and(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ fetch_and(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, &=, __i, __m); }
__integral_type
- fetch_or(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ fetch_or(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, |=, __i, __m); }
__integral_type
- fetch_xor(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ fetch_xor(__integral_type __i, memory_order __m = memory_order_seq_cst)
{ return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
};
atomic_bool() = default;
~atomic_bool() = default;
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) { }
bool
- operator=(bool __i) // XXX volatile
+ operator=(bool __i)
{ return _M_base.operator=(__i); }
- operator bool() const volatile
+ operator bool() const
{ return _M_base.load(); }
bool
- is_lock_free() const volatile
+ is_lock_free() const
{ return _M_base.is_lock_free(); }
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); }
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); }
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); }
bool
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); }
bool
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); }
bool
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); }
bool
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); }
};
atomic_flag() = default;
~atomic_flag() = default;
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.
atomic_flag(bool __i): __atomic_flag_base({ __i }) { }
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.
if (__m != memory_order_acquire && __m != memory_order_acq_rel)
}
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_acquire);
atomic_address() = default;
~atomic_address() = default;
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; }
bool
- is_lock_free() const volatile
+ is_lock_free() const
{ return true; }
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_acq_rel);
}
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_acq_rel);
}
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.
return __sync_lock_test_and_set(&_M_i, __v);
bool
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); }
bool
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,
__calculate_memory_order(__m));
bool
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_acq_rel);
bool
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,
__calculate_memory_order(__m));
}
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); }
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); }
- operator void*() const volatile
+ operator void*() const
{ return load(); }
void*
- operator=(void* __v) // XXX volatile
+ operator=(void* __v)
{
store(__v);
return __v;
}
void*
- operator+=(ptrdiff_t __d) volatile
+ operator+=(ptrdiff_t __d)
{ return __sync_add_and_fetch(&_M_i, __d); }
void*
- operator-=(ptrdiff_t __d) volatile
+ operator-=(ptrdiff_t __d)
{ return __sync_sub_and_fetch(&_M_i, __d); }
};
__atomic_base() = default;
~__atomic_base() = default;
__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.
__atomic_base(__integral_type __i) { _M_i = __i; }
- operator __integral_type() const volatile
+ operator __integral_type() const
{ return load(); }
__integral_type
- operator=(__integral_type __i) // XXX volatile
+ operator=(__integral_type __i)
{
store(__i);
return __i;
}
__integral_type
- operator++(int) volatile
+ operator++(int)
{ return fetch_add(1); }
__integral_type
- operator--(int) volatile
+ operator--(int)
{ return fetch_sub(1); }
__integral_type
- operator++() volatile
+ operator++()
{ return __sync_add_and_fetch(&_M_i, 1); }
__integral_type
- operator--() volatile
+ operator--()
{ return __sync_sub_and_fetch(&_M_i, 1); }
__integral_type
- operator+=(__integral_type __i) volatile
+ operator+=(__integral_type __i)
{ return __sync_add_and_fetch(&_M_i, __i); }
__integral_type
- operator-=(__integral_type __i) volatile
+ operator-=(__integral_type __i)
{ return __sync_sub_and_fetch(&_M_i, __i); }
__integral_type
- operator&=(__integral_type __i) volatile
+ operator&=(__integral_type __i)
{ return __sync_and_and_fetch(&_M_i, __i); }
__integral_type
- operator|=(__integral_type __i) volatile
+ operator|=(__integral_type __i)
{ return __sync_or_and_fetch(&_M_i, __i); }
__integral_type
- operator^=(__integral_type __i) volatile
+ operator^=(__integral_type __i)
{ return __sync_xor_and_fetch(&_M_i, __i); }
bool
- is_lock_free() const volatile
+ is_lock_free() const
{ return true; }
void
- store(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ store(__integral_type __i, memory_order __m = memory_order_seq_cst)
{
__glibcxx_assert(__m != memory_order_acquire);
__glibcxx_assert(__m != memory_order_acq_rel);
}
__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_acq_rel);
}
__integral_type
- exchange(__integral_type __i,
- memory_order __m = memory_order_seq_cst) volatile
+ exchange(__integral_type __i, memory_order __m = memory_order_seq_cst)
{
// XXX built-in assumes memory_order_acquire.
return __sync_lock_test_and_set(&_M_i, __i);
bool
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); }
bool
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,
__calculate_memory_order(__m));
bool
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_acq_rel);
bool
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,
__calculate_memory_order(__m));
__integral_type
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); }
__integral_type
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); }
__integral_type
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); }
__integral_type
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); }
__integral_type
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); }
};
atomic_bool() = default;
~atomic_bool() = default;
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) { }
bool
- operator=(bool __i) // XXX volatile
+ operator=(bool __i)
{ return _M_base.operator=(__i); }
- operator bool() const volatile
+ operator bool() const
{ return _M_base.load(); }
bool
- is_lock_free() const volatile
+ is_lock_free() const
{ return _M_base.is_lock_free(); }
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); }
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); }
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); }
bool
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); }
bool
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); }
bool
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); }
bool
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); }
};
} // namespace __atomic2
--- /dev/null
+// -*- 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
* 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
+#include <bits/atomic_base.h>
#ifndef _GLIBCXX_STDATOMIC_H
#define _GLIBCXX_STDATOMIC_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(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;
+#ifdef _GLIBCXX_NAMESPACE_C
#endif
#endif
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
-#include <cstdatomic>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
+#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-/** @file cstdatomic
- * This is a Standard C++ Library file. You should @c \#include this file
- * 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).
+/** @file atomic
+ * This is a Standard C++ Library header.
*/
// 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
-#ifndef _GLIBCXX_STDATOMIC
-#define _GLIBCXX_STDATOMIC 1
+#ifndef _GLIBCXX_ATOMIC
+#define _GLIBCXX_ATOMIC 1
#pragma GCC system_header
# include <c++0x_warning.h>
#endif
-#include <stdatomic.h>
+#include <bits/atomic_base.h>
#include <cstddef>
_GLIBCXX_BEGIN_NAMESPACE(std)
/// kill_dependency
template<typename _Tp>
- inline _Tp
+ inline _Tp
kill_dependency(_Tp __y)
{
_Tp ret(__y);
//
// Three nested namespaces for atomic implementation details.
- //
+ //
// The nested namespace inlined into std:: is determined by the value
// 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
// 1 == __atomic1 == Best available, sometimes lock-free
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(_Tp __i) : _M_i(__i) { }
- operator _Tp() const volatile;
+ operator _Tp() const;
- _Tp
- operator=(_Tp __i) volatile { store(__i); return __i; }
+ _Tp
+ operator=(_Tp __i) { store(__i); return __i; }
- bool
+ bool
is_lock_free() const volatile;
- void
+ void
store(_Tp, memory_order = memory_order_seq_cst) volatile;
- _Tp
+ _Tp
load(memory_order = memory_order_seq_cst) const volatile;
- _Tp
+ _Tp
exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile;
- bool
+ bool
compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile;
- bool
+ bool
compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
- bool
- compare_exchange_weak(_Tp&, _Tp,
+ bool
+ compare_exchange_weak(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile;
- bool
- compare_exchange_strong(_Tp&, _Tp,
+ bool
+ compare_exchange_strong(_Tp&, _Tp,
memory_order = memory_order_seq_cst) volatile;
};
/// Partial specialization for pointer types.
- template<typename _Tp>
+ template<typename _Tp>
struct atomic<_Tp*> : atomic_address
{
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(_Tp* __v) : atomic_address(__v) { }
- void
- store(_Tp*, memory_order = memory_order_seq_cst) volatile;
+ void
+ store(_Tp*, memory_order = memory_order_seq_cst);
- _Tp*
- load(memory_order = memory_order_seq_cst) const volatile;
+ _Tp*
+ load(memory_order = memory_order_seq_cst) const;
- _Tp*
- exchange(_Tp*, memory_order = memory_order_seq_cst) volatile;
+ _Tp*
+ exchange(_Tp*, memory_order = memory_order_seq_cst);
- bool
- compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order) volatile;
+ bool
+ compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order);
- bool
- compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order) volatile;
+ bool
+ compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order);
- bool
- compare_exchange_weak(_Tp*&, _Tp*,
- memory_order = memory_order_seq_cst) volatile;
+ bool
+ compare_exchange_weak(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
- bool
- compare_exchange_strong(_Tp*&, _Tp*,
- memory_order = memory_order_seq_cst) volatile;
+ bool
+ compare_exchange_strong(_Tp*&, _Tp*, memory_order = memory_order_seq_cst);
- _Tp*
- fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+ _Tp*
+ fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
- _Tp*
- fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+ _Tp*
+ fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
- operator _Tp*() const volatile
+ operator _Tp*() const
{ return load(); }
- _Tp*
- operator=(_Tp* __v) volatile
- {
- store(__v);
- return __v;
+ _Tp*
+ operator=(_Tp* __v)
+ {
+ store(__v);
+ return __v;
}
- _Tp*
- operator++(int) volatile { return fetch_add(1); }
+ _Tp*
+ operator++(int) { return fetch_add(1); }
- _Tp*
- operator--(int) volatile { return fetch_sub(1); }
+ _Tp*
+ operator--(int) { return fetch_sub(1); }
- _Tp*
- operator++() volatile { return fetch_add(1) + 1; }
+ _Tp*
+ operator++() { return fetch_add(1) + 1; }
- _Tp*
- operator--() volatile { return fetch_sub(1) - 1; }
+ _Tp*
+ operator--() { return fetch_sub(1) - 1; }
- _Tp*
- operator+=(ptrdiff_t __d) volatile
+ _Tp*
+ operator+=(ptrdiff_t __d)
{ return fetch_add(__d) + __d; }
- _Tp*
- operator-=(ptrdiff_t __d) volatile
+ _Tp*
+ operator-=(ptrdiff_t __d)
{ return fetch_sub(__d) - __d; }
};
/// Explicit specialization for void*
- template<>
+ template<>
struct atomic<void*> : public atomic_address
{
typedef void* __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for bool.
- template<>
+ template<>
struct atomic<bool> : public atomic_bool
{
typedef bool __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for char.
- template<>
+ template<>
struct atomic<char> : public atomic_char
{
typedef char __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for signed char.
- template<>
+ template<>
struct atomic<signed char> : public atomic_schar
- {
+ {
typedef signed char __integral_type;
typedef atomic_schar __base_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for unsigned char.
- template<>
+ template<>
struct atomic<unsigned char> : public atomic_uchar
{
typedef unsigned char __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for short.
- template<>
+ template<>
struct atomic<short> : public atomic_short
{
typedef short __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for unsigned short.
- template<>
+ template<>
struct atomic<unsigned short> : public atomic_ushort
{
typedef unsigned short __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for int.
- template<>
+ template<>
struct atomic<int> : atomic_int
{
typedef int __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for unsigned int.
- template<>
+ template<>
struct atomic<unsigned int> : public atomic_uint
{
typedef unsigned int __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for long.
- template<>
+ template<>
struct atomic<long> : public atomic_long
{
typedef long __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for unsigned long.
- template<>
+ template<>
struct atomic<unsigned long> : public atomic_ulong
{
typedef unsigned long __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for long long.
- template<>
+ template<>
struct atomic<long long> : public atomic_llong
{
typedef long long __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for unsigned long long.
- template<>
+ template<>
struct atomic<unsigned long long> : public atomic_ullong
{
typedef unsigned long long __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for wchar_t.
- template<>
+ template<>
struct atomic<wchar_t> : public atomic_wchar_t
{
typedef wchar_t __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for char16_t.
- template<>
+ template<>
struct atomic<char16_t> : public atomic_char16_t
{
typedef char16_t __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
};
/// Explicit specialization for char32_t.
- template<>
+ template<>
struct atomic<char32_t> : public atomic_char32_t
{
typedef char32_t __integral_type;
atomic() = default;
~atomic() = default;
atomic(const atomic&) = delete;
- atomic& operator=(const atomic&) = delete;
+ atomic& operator=(const atomic&) volatile = delete;
atomic(__integral_type __i) : __base_type(__i) { }
template<typename _Tp>
- _Tp*
- atomic<_Tp*>::load(memory_order __m) const volatile
+ _Tp*
+ atomic<_Tp*>::load(memory_order __m) const
{ return static_cast<_Tp*>(atomic_address::load(__m)); }
template<typename _Tp>
- _Tp*
- atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) volatile
+ _Tp*
+ atomic<_Tp*>::exchange(_Tp* __v, memory_order __m)
{ return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
template<typename _Tp>
- bool
- atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
- memory_order __m2) volatile
- {
+ bool
+ atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
+ memory_order __m2)
+ {
void** __vr = reinterpret_cast<void**>(&__r);
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>
- bool
- atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
+ bool
+ atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
memory_order __m1,
- memory_order __m2) volatile
- {
+ memory_order __m2)
+ {
void** __vr = reinterpret_cast<void**>(&__r);
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>
- bool
+ bool
atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
- memory_order __m) volatile
- {
- return compare_exchange_weak(__r, __v, __m,
+ memory_order __m)
+ {
+ return compare_exchange_weak(__r, __v, __m,
__calculate_memory_order(__m));
}
template<typename _Tp>
- bool
+ bool
atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
- memory_order __m) volatile
- {
+ memory_order __m)
+ {
return compare_exchange_strong(__r, __v, __m,
__calculate_memory_order(__m));
}
template<typename _Tp>
- _Tp*
- atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m) volatile
- {
+ _Tp*
+ atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m)
+ {
void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m);
return static_cast<_Tp*>(__p);
}
template<typename _Tp>
- _Tp*
- atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) volatile
- {
- void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
- return static_cast<_Tp*>(__p);
+ _Tp*
+ atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m)
+ {
+ void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
+ return static_cast<_Tp*>(__p);
}
// Convenience function definitions, atomic_flag.
- inline bool
- atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, memory_order __m)
+ inline bool
+ atomic_flag_test_and_set_explicit(atomic_flag* __a, memory_order __m)
{ return __a->test_and_set(__m); }
- inline void
- atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m)
+ inline void
+ atomic_flag_clear_explicit(atomic_flag* __a, memory_order __m)
{ return __a->clear(__m); }
// Convenience function definitions, atomic_address.
- inline bool
- atomic_is_lock_free(const volatile atomic_address* __a)
+ inline bool
+ atomic_is_lock_free(const atomic_address* __a)
{ return __a->is_lock_free(); }
- inline void
- atomic_store(volatile atomic_address* __a, void* __v)
+ inline void
+ atomic_store(atomic_address* __a, void* __v)
{ __a->store(__v); }
- inline void
- atomic_store_explicit(volatile atomic_address* __a, void* __v,
- memory_order __m)
+ inline void
+ atomic_store_explicit(atomic_address* __a, void* __v, memory_order __m)
{ __a->store(__v, __m); }
- inline void*
- atomic_load(const volatile atomic_address* __a)
+ inline void*
+ atomic_load(const atomic_address* __a)
{ return __a->load(); }
- inline void*
- atomic_load_explicit(const volatile atomic_address* __a, memory_order __m)
+ inline void*
+ atomic_load_explicit(const atomic_address* __a, memory_order __m)
{ return __a->load(__m); }
- inline void*
- atomic_exchange(volatile atomic_address* __a, void* __v)
+ inline void*
+ atomic_exchange(atomic_address* __a, void* __v)
{ return __a->exchange(__v); }
- inline void*
- atomic_exchange_explicit(volatile atomic_address* __a, void* __v,
- memory_order __m)
+ inline void*
+ atomic_exchange_explicit(atomic_address* __a, void* __v, memory_order __m)
{ return __a->exchange(__v, __m); }
- inline bool
- atomic_compare_exchange_weak(volatile atomic_address* __a,
- void** __v1, void* __v2)
- {
- return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst,
- memory_order_seq_cst);
+ inline bool
+ atomic_compare_exchange_weak(atomic_address* __a, void** __v1, void* __v2)
+ {
+ return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst,
+ memory_order_seq_cst);
}
- inline bool
- atomic_compare_exchange_strong(volatile atomic_address* __a,
+ inline bool
+ atomic_compare_exchange_strong(atomic_address* __a,
void** __v1, void* __v2)
- {
- return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
- memory_order_seq_cst);
+ {
+ return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
+ memory_order_seq_cst);
}
- inline bool
- atomic_compare_exchange_weak_explicit(volatile atomic_address* __a,
- void** __v1, void* __v2,
+ inline bool
+ atomic_compare_exchange_weak_explicit(atomic_address* __a,
+ void** __v1, void* __v2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
- inline bool
- atomic_compare_exchange_strong_explicit(volatile atomic_address* __a,
- void** __v1, void* __v2,
- memory_order __m1, memory_order __m2)
+ inline bool
+ atomic_compare_exchange_strong_explicit(atomic_address* __a,
+ void** __v1, void* __v2,
+ memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
- inline void*
- atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __d,
+ inline void*
+ atomic_fetch_add_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_add(__d, __m); }
- inline void*
- atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __d)
+ inline void*
+ atomic_fetch_add(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_add(__d); }
- inline void*
- atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __d,
+ inline void*
+ atomic_fetch_sub_explicit(atomic_address* __a, ptrdiff_t __d,
memory_order __m)
{ return __a->fetch_sub(__d, __m); }
- inline void*
- atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __d)
+ inline void*
+ atomic_fetch_sub(atomic_address* __a, ptrdiff_t __d)
{ return __a->fetch_sub(__d); }
// Convenience function definitions, atomic_bool.
- inline bool
- atomic_is_lock_free(const volatile atomic_bool* __a)
+ inline bool
+ atomic_is_lock_free(const atomic_bool* __a)
{ return __a->is_lock_free(); }
- inline void
- atomic_store(volatile atomic_bool* __a, bool __i)
+ inline void
+ atomic_store(atomic_bool* __a, bool __i)
{ __a->store(__i); }
- inline void
- atomic_store_explicit(volatile atomic_bool* __a, bool __i, memory_order __m)
+ inline void
+ atomic_store_explicit(atomic_bool* __a, bool __i, memory_order __m)
{ __a->store(__i, __m); }
- inline bool
- atomic_load(const volatile atomic_bool* __a)
+ inline bool
+ atomic_load(const atomic_bool* __a)
{ return __a->load(); }
- inline bool
- atomic_load_explicit(const volatile atomic_bool* __a, memory_order __m)
+ inline bool
+ atomic_load_explicit(const atomic_bool* __a, memory_order __m)
{ return __a->load(__m); }
- inline bool
- atomic_exchange(volatile atomic_bool* __a, bool __i)
+ inline bool
+ atomic_exchange(atomic_bool* __a, bool __i)
{ return __a->exchange(__i); }
- inline bool
- atomic_exchange_explicit(volatile atomic_bool* __a, bool __i,
- memory_order __m)
+ inline bool
+ atomic_exchange_explicit(atomic_bool* __a, bool __i, memory_order __m)
{ return __a->exchange(__i, __m); }
- inline bool
- atomic_compare_exchange_weak(volatile atomic_bool* __a, bool* __i1, bool __i2)
- {
- return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst,
- memory_order_seq_cst);
+ inline bool
+ atomic_compare_exchange_weak(atomic_bool* __a, bool* __i1, bool __i2)
+ {
+ return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst,
+ memory_order_seq_cst);
}
- inline bool
- atomic_compare_exchange_strong(volatile atomic_bool* __a,
- bool* __i1, bool __i2)
- {
- return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
- memory_order_seq_cst);
+ inline bool
+ atomic_compare_exchange_strong(atomic_bool* __a, bool* __i1, bool __i2)
+ {
+ return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
+ memory_order_seq_cst);
}
- inline bool
- atomic_compare_exchange_weak_explicit(volatile atomic_bool* __a, bool* __i1,
- bool __i2, memory_order __m1,
+ inline bool
+ atomic_compare_exchange_weak_explicit(atomic_bool* __a, bool* __i1,
+ bool __i2, memory_order __m1,
memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
- inline bool
- atomic_compare_exchange_strong_explicit(volatile atomic_bool* __a,
- bool* __i1, bool __i2,
+ inline bool
+ atomic_compare_exchange_strong_explicit(atomic_bool* __a,
+ bool* __i1, bool __i2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
// Free standing functions. Template argument should be constricted
// to intergral types as specified in the standard.
template<typename _ITp>
- inline void
- atomic_store_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
- memory_order __m)
+ inline void
+ atomic_store_explicit(__atomic_base<_ITp>* __a, _ITp __i, memory_order __m)
{ __a->store(__i, __m); }
template<typename _ITp>
inline _ITp
- atomic_load_explicit(const volatile __atomic_base<_ITp>* __a,
- memory_order __m)
- { return __a->load(__m); }
+ atomic_load_explicit(const __atomic_base<_ITp>* __a, memory_order __m)
+ { return __a->load(__m); }
template<typename _ITp>
- inline _ITp
- atomic_exchange_explicit(volatile __atomic_base<_ITp>* __a,
- _ITp __i, memory_order __m)
- { return __a->exchange(__i, __m); }
+ inline _ITp
+ atomic_exchange_explicit(__atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->exchange(__i, __m); }
template<typename _ITp>
- inline bool
- atomic_compare_exchange_weak_explicit(volatile __atomic_base<_ITp>* __a,
- _ITp* __i1, _ITp __i2,
+ inline bool
+ atomic_compare_exchange_weak_explicit(__atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2,
memory_order __m1, memory_order __m2)
{ return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
template<typename _ITp>
- inline bool
- atomic_compare_exchange_strong_explicit(volatile __atomic_base<_ITp>* __a,
- _ITp* __i1, _ITp __i2,
- memory_order __m1,
+ inline bool
+ atomic_compare_exchange_strong_explicit(__atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2,
+ memory_order __m1,
memory_order __m2)
{ return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ inline _ITp
+ atomic_fetch_add_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_add(__i, __m); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ inline _ITp
+ atomic_fetch_sub_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_sub(__i, __m); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ inline _ITp
+ atomic_fetch_and_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_and(__i, __m); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ inline _ITp
+ atomic_fetch_or_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_or(__i, __m); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ inline _ITp
+ atomic_fetch_xor_explicit(__atomic_base<_ITp>* __a, _ITp __i,
memory_order __m)
{ return __a->fetch_xor(__i, __m); }
template<typename _ITp>
- inline bool
- atomic_is_lock_free(const volatile __atomic_base<_ITp>* __a)
+ inline bool
+ atomic_is_lock_free(const __atomic_base<_ITp>* __a)
{ return __a->is_lock_free(); }
template<typename _ITp>
- inline void
- atomic_store(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ inline void
+ atomic_store(__atomic_base<_ITp>* __a, _ITp __i)
{ atomic_store_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
- inline _ITp
- atomic_load(const volatile __atomic_base<_ITp>* __a)
+ inline _ITp
+ atomic_load(const __atomic_base<_ITp>* __a)
{ return atomic_load_explicit(__a, memory_order_seq_cst); }
template<typename _ITp>
- inline _ITp
- atomic_exchange(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ inline _ITp
+ atomic_exchange(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
- inline bool
- atomic_compare_exchange_weak(volatile __atomic_base<_ITp>* __a,
+ inline bool
+ atomic_compare_exchange_weak(__atomic_base<_ITp>* __a,
_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);
}
template<typename _ITp>
- inline bool
- atomic_compare_exchange_strong(volatile __atomic_base<_ITp>* __a,
+ inline bool
+ atomic_compare_exchange_strong(__atomic_base<_ITp>* __a,
_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);
}
template<typename _ITp>
- inline _ITp
- atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ inline _ITp
+ atomic_fetch_add(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ inline _ITp
+ atomic_fetch_sub(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ inline _ITp
+ atomic_fetch_and(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ inline _ITp
+ atomic_fetch_or(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
template<typename _ITp>
- inline _ITp
- atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ inline _ITp
+ atomic_fetch_xor(__atomic_base<_ITp>* __a, _ITp __i)
{ return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
// @} group atomics
_GLIBCXX_END_NAMESPACE
#endif
-
-
#include <condition_variable>
#include <system_error>
#include <exception>
-#include <cstdatomic>
+#include <atomic>
#include <bits/functexcept.h>
namespace std
// <http://www.gnu.org/licenses/>.
#include "gstdint.h"
-#include <cstdatomic>
+#include <atomic>
#include <mutex>
#define LOGSIZE 4
}
#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,
namespace __atomic0
{
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)
lock_guard<mutex> __lock(get_atomic_mutex());
}
void
- atomic_flag::clear(memory_order) volatile
+ atomic_flag::clear(memory_order)
{
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
lock_guard<mutex> __lock(get_atomic_mutex());
extern "C"
{
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 ()
{
- 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);
}
void
- atomic_flag_clear_explicit(volatile __atomic_flag_base* __a,
+ atomic_flag_clear_explicit(__atomic_flag_base* __a,
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);
}
void
- __atomic_flag_wait_explicit(volatile __atomic_flag_base* __a,
+ __atomic_flag_wait_explicit(__atomic_flag_base* __a,
memory_order __x) throw ()
{
while (atomic_flag_test_and_set_explicit(__a, __x))
{ };
}
- volatile __atomic_flag_base*
- __atomic_flag_for_address(const volatile void* __z) throw ()
+ __atomic_flag_base*
+ __atomic_flag_for_address(const void* __z) throw ()
{
uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
__u += (__u >> 2) + (__u << 4);
}
} // extern "C"
} // 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
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.
// See libstdc++/41662 for details.
-
template<typename _Tp>
struct hash : public std::unary_function<_Tp, size_t>
{
(void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe };
#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
#if (defined(__ppc__) || defined(__ppc64__)) && defined(PIC)
/* __eprintf shouldn't have been made visible from libstdc++, or
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
}
// { dg-error "used here" "" { target *-*-* } 521 }
-// { dg-error "deleted function" "" { target *-*-* } 239 }
-// { dg-error "deleted function" "" { target *-*-* } 257 }
-// { dg-error "deleted function" "" { target *-*-* } 275 }
-// { dg-error "deleted function" "" { target *-*-* } 293 }
-// { dg-error "deleted function" "" { target *-*-* } 311 }
-// { dg-error "deleted function" "" { target *-*-* } 329 }
-// { dg-error "deleted function" "" { target *-*-* } 347 }
-// { dg-error "deleted function" "" { target *-*-* } 365 }
-// { dg-error "deleted function" "" { target *-*-* } 383 }
-// { dg-error "deleted function" "" { target *-*-* } 401 }
-// { dg-error "deleted function" "" { target *-*-* } 419 }
-// { dg-error "deleted function" "" { target *-*-* } 437 }
-// { dg-error "deleted function" "" { target *-*-* } 455 }
-// { dg-error "deleted function" "" { target *-*-* } 473 }
-// { dg-error "deleted function" "" { target *-*-* } 491 }
+// { dg-error "deleted function" "" { target *-*-* } 231 }
+// { dg-error "deleted function" "" { target *-*-* } 249 }
+// { dg-error "deleted function" "" { target *-*-* } 267 }
+// { dg-error "deleted function" "" { target *-*-* } 285 }
+// { dg-error "deleted function" "" { target *-*-* } 303 }
+// { dg-error "deleted function" "" { target *-*-* } 321 }
+// { dg-error "deleted function" "" { target *-*-* } 339 }
+// { dg-error "deleted function" "" { target *-*-* } 357 }
+// { dg-error "deleted function" "" { target *-*-* } 375 }
+// { dg-error "deleted function" "" { target *-*-* } 393 }
+// { dg-error "deleted function" "" { target *-*-* } 411 }
+// { dg-error "deleted function" "" { target *-*-* } 429 }
+// { dg-error "deleted function" "" { target *-*-* } 447 }
+// { dg-error "deleted function" "" { target *-*-* } 465 }
+// { dg-error "deleted function" "" { target *-*-* } 483 }
// { dg-excess-errors "In member function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
{
__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());
return 0;
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
return 0;
}
-// { dg-error "used here" "" { target *-*-* } 560 }
-// { dg-error "deleted function" "" { target *-*-* } 238 }
-// { dg-error "deleted function" "" { target *-*-* } 256 }
-// { dg-error "deleted function" "" { target *-*-* } 274 }
-// { dg-error "deleted function" "" { target *-*-* } 292 }
-// { dg-error "deleted function" "" { target *-*-* } 310 }
-// { dg-error "deleted function" "" { target *-*-* } 328 }
-// { dg-error "deleted function" "" { target *-*-* } 346 }
-// { dg-error "deleted function" "" { target *-*-* } 364 }
-// { dg-error "deleted function" "" { target *-*-* } 382 }
-// { dg-error "deleted function" "" { target *-*-* } 400 }
-// { dg-error "deleted function" "" { target *-*-* } 418 }
-// { dg-error "deleted function" "" { target *-*-* } 436 }
-// { dg-error "deleted function" "" { target *-*-* } 454 }
-// { dg-error "deleted function" "" { target *-*-* } 472 }
-// { dg-error "deleted function" "" { target *-*-* } 490 }
+// { dg-error "used here" "" { target *-*-* } 560 }
+// { dg-error "deleted function" "" { target *-*-* } 248 }
+// { dg-error "deleted function" "" { target *-*-* } 266 }
+// { dg-error "deleted function" "" { target *-*-* } 284 }
+// { dg-error "deleted function" "" { target *-*-* } 302 }
+// { dg-error "deleted function" "" { target *-*-* } 320 }
+// { dg-error "deleted function" "" { target *-*-* } 338 }
+// { dg-error "deleted function" "" { target *-*-* } 356 }
+// { dg-error "deleted function" "" { target *-*-* } 374 }
+// { dg-error "deleted function" "" { target *-*-* } 230 }
+// { dg-error "deleted function" "" { target *-*-* } 410 }
+// { dg-error "deleted function" "" { target *-*-* } 428 }
+// { dg-error "deleted function" "" { target *-*-* } 446 }
+// { dg-error "deleted function" "" { target *-*-* } 464 }
+// { dg-error "deleted function" "" { target *-*-* } 482 }
+// { dg-error "deleted function" "" { target *-*-* } 392 }
// { dg-excess-errors "In member function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
{
__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());
return 0;
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
{
__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());
return 0;
}
--- /dev/null
+// { 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;
+}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_hooks.h>
#include <testsuite_common_types.h>
int main()
{
__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());
return 0;
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_hooks.h>
#include <testsuite_common_types.h>
int main()
{
__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());
return 0;
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
void test01()
{
// Check for required base class.
__gnu_test::has_required_base_class test;
- __gnu_cxx::typelist::apply_generator(test,
- __gnu_test::atomic_integrals::type(),
- __gnu_test::atomics_tl());
+ __gnu_cxx::typelist::apply_generator(test,
+ __gnu_test::atomic_integrals::type(),
+ __gnu_test::atomics_tl());
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
// This file tests explicit instantiation of basic_string
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_character.h>
template class std::atomic<__gnu_test::pod_char>;
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
int main()
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
void test01()
{
test_type t2;
t1 = t2;
}
-// { dg-error "used here" "" { target *-*-* } 30 }
-// { dg-excess-errors "deleted function" }
+// { dg-error "used here" "" { target *-*-* } 29 }
+// { dg-excess-errors "deleted function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
void test01()
{
test_type t1;
test_type t2(t1);
}
-// { dg-error "used here" "" { target *-*-* } 29 }
-// { dg-excess-errors "deleted function" }
+// { dg-error "used here" "" { target *-*-* } 28 }
+// { dg-excess-errors "deleted function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
int main()
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
int main()
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
void test01()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
void test01()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_hooks.h>
int main()
// { dg-options "-std=gnu++0x" }
-// { dg-do compile }
+// { dg-do compile }
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
int main()
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
void test01()
{
test_type t2;
t1 = t2;
}
-// { dg-error "used here" "" { target *-*-* } 30 }
-// { dg-excess-errors "deleted function" }
+// { dg-error "used here" "" { target *-*-* } 29 }
+// { dg-excess-errors "deleted function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
void test01()
{
test_type t1;
test_type t2(t1);
}
-// { dg-error "used here" "" { target *-*-* } 29 }
-// { dg-excess-errors "deleted function" }
+// { dg-error "used here" "" { target *-*-* } 28 }
+// { dg-excess-errors "deleted function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
int main()
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
void test01()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
void test01()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
#include <stdatomic.h>
int main()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
int main()
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
#include <stdatomic.h>
int main()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
int main()
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::assignable test;
- __gnu_cxx::typelist::apply_generator(test,
+ __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type());
return 0;
}
// { dg-error "used here" "" { target *-*-* } 521 }
-// { dg-excess-errors "deleted function" }
-// { dg-excess-errors "deleted function" }
-// { dg-error "instantiated from" "" { target *-*-* } 29 }
-// { dg-error "instantiated from" "" { target *-*-* } 528 }
-// { dg-error "instantiated from" "" { target *-*-* } 170 }
+// { dg-excess-errors "deleted function" }
+// { dg-excess-errors "deleted function" }
+// { dg-error "instantiated from" "" { target *-*-* } 28 }
+// { dg-error "instantiated from" "" { target *-*-* } 528 }
+// { dg-error "instantiated from" "" { target *-*-* } 170 }
// { dg-error "instantiated from" "" { target *-*-* } 399 }
-// { dg-error "instantiated from" "" { target *-*-* } 168 }
+// { dg-error "instantiated from" "" { target *-*-* } 168 }
// { dg-excess-errors "In member function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::copy_constructible test;
- __gnu_cxx::typelist::apply_generator(test,
+ __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type());
return 0;
}
// { dg-error "used here" "" { target *-*-* } 560 }
-// { dg-excess-errors "deleted function" }
-// { dg-excess-errors "deleted function" }
-// { dg-error "instantiated from" "" { target *-*-* } 29 }
-// { dg-error "instantiated from" "" { target *-*-* } 566 }
-// { dg-error "instantiated from" "" { target *-*-* } 170 }
+// { dg-excess-errors "deleted function" }
+// { dg-excess-errors "deleted function" }
+// { dg-error "instantiated from" "" { target *-*-* } 28 }
+// { dg-error "instantiated from" "" { target *-*-* } 566 }
+// { dg-error "instantiated from" "" { target *-*-* } 170 }
// { dg-error "instantiated from" "" { target *-*-* } 399 }
-// { dg-error "instantiated from" "" { target *-*-* } 168 }
+// { dg-error "instantiated from" "" { target *-*-* } 168 }
// { dg-excess-errors "In member function" }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::direct_list_initializable test;
- __gnu_cxx::typelist::apply_generator(test,
- __gnu_test::atomic_integrals::type(),
+ __gnu_cxx::typelist::apply_generator(test,
+ __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type());
return 0;
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
int main()
{
__gnu_test::single_value_constructible test;
- __gnu_cxx::typelist::apply_generator(test,
- __gnu_test::atomic_integrals::type(),
+ __gnu_cxx::typelist::apply_generator(test,
+ __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type());
return 0;
}
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// -*- C++ -*-
-
+
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
+
// 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 <cstdatomic>
+
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// -*- C++ -*-
-
+
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
+
// 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 <cstdatomic>
+
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// -*- C++ -*-
-
+
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
+
// 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 <cstdatomic>
+
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// -*- C++ -*-
-
+
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
+
// 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 <cstdatomic>
+
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// -*- C++ -*-
-
+
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
+
// 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 <cstdatomic>
+
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// -*- C++ -*-
-
+
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-
+
// 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 <cstdatomic>
+
+#include <atomic>
#include <testsuite_common_types.h>
int main()
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_hooks.h>
#include <testsuite_common_types.h>
{
__gnu_test::integral_assignable test;
__gnu_cxx::typelist::apply_generator(test,
- __gnu_test::atomic_integrals::type(),
+ __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type());
return 0;
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_hooks.h>
#include <testsuite_common_types.h>
{
__gnu_test::integral_convertable test;
__gnu_cxx::typelist::apply_generator(test,
- __gnu_test::atomic_integrals::type(),
+ __gnu_test::atomic_integrals::type(),
__gnu_test::integral_types::type());
return 0;
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
void test01()
{
// Check for standard layout requirements
__gnu_test::standard_layout test;
- __gnu_cxx::typelist::apply_generator(test,
+ __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type());
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
-#include <cstdatomic>
+#include <atomic>
#include <testsuite_common_types.h>
void test01()
{
__gnu_test::has_trivial_cons_dtor test;
- __gnu_cxx::typelist::apply_generator(test,
+ __gnu_cxx::typelist::apply_generator(test,
__gnu_test::atomic_integrals::type());
}
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdatomic>
+#include <atomic>
namespace gnu
{
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdatomic>
+#include <atomic>
namespace gnu
{
// with this library; see the file COPYING3. If not see
// <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 }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include <cstdatomic>
+#include <atomic>
void test01()
{
--- /dev/null
+// { 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 }
int main()
{
- volatile atomic_flag f;
- volatile atomic_flag* p = &f;
+ atomic_flag f;
+ atomic_flag* p = &f;
memory_order m = memory_order_relaxed;
// For position only.
#include <tr1/unordered_set>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <cstdatomic>
+#include <atomic>
#include <type_traits>
#endif