summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/Makefile.am28
-rw-r--r--libstdc++-v3/include/Makefile.in30
-rw-r--r--libstdc++-v3/include/backward/hashtable.h26
-rw-r--r--libstdc++-v3/include/bits/atomic_0.h677
-rw-r--r--libstdc++-v3/include/bits/atomic_2.h685
-rw-r--r--libstdc++-v3/include/bits/atomic_base.h721
-rw-r--r--libstdc++-v3/include/bits/basic_string.h51
-rw-r--r--libstdc++-v3/include/bits/c++config5
-rw-r--r--libstdc++-v3/include/bits/random.h11
-rw-r--r--libstdc++-v3/include/bits/random.tcc8
-rw-r--r--libstdc++-v3/include/c_global/cstdalign44
-rw-r--r--libstdc++-v3/include/debug/string10
-rw-r--r--libstdc++-v3/include/ext/vstring.h11
-rw-r--r--libstdc++-v3/include/std/atomic101
-rw-r--r--libstdc++-v3/include/std/complex11
-rw-r--r--libstdc++-v3/include/std/future53
-rw-r--r--libstdc++-v3/include/std/mutex6
-rw-r--r--libstdc++-v3/include/tr1/complex11
-rw-r--r--libstdc++-v3/include/tr2/bool_set22
-rw-r--r--libstdc++-v3/include/tr2/dynamic_bitset22
-rw-r--r--libstdc++-v3/include/tr2/type_traits20
21 files changed, 970 insertions, 1583 deletions
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 74acbf0c88a..121a6427ec2 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -83,8 +83,6 @@ bits_headers = \
${bits_srcdir}/alloc_traits.h \
${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
- ${bits_srcdir}/atomic_0.h \
- ${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \
${bits_srcdir}/basic_ios.tcc \
${bits_srcdir}/basic_string.h \
@@ -636,6 +634,7 @@ c_base_headers = \
${c_base_srcdir}/cmath \
${c_base_srcdir}/csetjmp \
${c_base_srcdir}/csignal \
+ ${c_base_srcdir}/cstdalign \
${c_base_srcdir}/cstdarg \
${c_base_srcdir}/cstdbool \
${c_base_srcdir}/cstddef \
@@ -855,7 +854,6 @@ thread_host_headers = \
${host_builddir}/gthr.h \
${host_builddir}/gthr-single.h \
${host_builddir}/gthr-posix.h \
- ${host_builddir}/gthr-tpf.h \
${host_builddir}/gthr-default.h
@@ -1122,43 +1120,35 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
# Host includes for threads
uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
-${host_builddir}/gthr.h: ${toplevel_srcdir}/gcc/gthr.h stamp-${host_alias}
+${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias}
sed -e '/^#pragma/b' \
-e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
-e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
- < ${toplevel_srcdir}/gcc/gthr.h > $@
+ < $< > $@
-${host_builddir}/gthr-single.h: ${toplevel_srcdir}/gcc/gthr-single.h \
+${host_builddir}/gthr-single.h: ${toplevel_srcdir}/libgcc/gthr-single.h \
stamp-${host_alias}
sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
-e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
- < ${toplevel_srcdir}/gcc/gthr-single.h > $@
+ < $< > $@
-${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/gcc/gthr-posix.h \
+${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/libgcc/gthr-posix.h \
stamp-${host_alias}
sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
-e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
-e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
-e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
- < ${toplevel_srcdir}/gcc/gthr-posix.h > $@
+ < $< > $@
-${host_builddir}/gthr-tpf.h: ${toplevel_srcdir}/gcc/gthr-tpf.h \
- stamp-${host_alias}
- sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
- -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
- -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
- -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
- < ${toplevel_srcdir}/gcc/gthr-tpf.h > $@
-
-${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \
+${host_builddir}/gthr-default.h: ${toplevel_builddir}/libgcc/gthr-default.h \
stamp-${host_alias}
sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
-e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
-e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
-e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
- < ${toplevel_srcdir}/gcc/${glibcxx_thread_h} > $@
+ < $< > $@
# Build two precompiled C++ includes, stdc++.h.gch/*.gch
${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 8b805ba9acb..70c0781d513 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -213,7 +213,6 @@ glibcxx_builddir = @glibcxx_builddir@
glibcxx_localedir = @glibcxx_localedir@
glibcxx_prefixdir = @glibcxx_prefixdir@
glibcxx_srcdir = @glibcxx_srcdir@
-glibcxx_thread_h = @glibcxx_thread_h@
glibcxx_toolexecdir = @glibcxx_toolexecdir@
glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@
gxx_include_dir = @gxx_include_dir@
@@ -253,6 +252,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+toplevel_builddir = @toplevel_builddir@
toplevel_srcdir = @toplevel_srcdir@
# May be used by various substitution variables.
@@ -335,8 +335,6 @@ bits_headers = \
${bits_srcdir}/alloc_traits.h \
${bits_srcdir}/allocator.h \
${bits_srcdir}/atomic_base.h \
- ${bits_srcdir}/atomic_0.h \
- ${bits_srcdir}/atomic_2.h \
${bits_srcdir}/basic_ios.h \
${bits_srcdir}/basic_ios.tcc \
${bits_srcdir}/basic_string.h \
@@ -887,6 +885,7 @@ c_base_headers = \
${c_base_srcdir}/cmath \
${c_base_srcdir}/csetjmp \
${c_base_srcdir}/csignal \
+ ${c_base_srcdir}/cstdalign \
${c_base_srcdir}/cstdarg \
${c_base_srcdir}/cstdbool \
${c_base_srcdir}/cstddef \
@@ -1099,7 +1098,6 @@ thread_host_headers = \
${host_builddir}/gthr.h \
${host_builddir}/gthr-single.h \
${host_builddir}/gthr-posix.h \
- ${host_builddir}/gthr-tpf.h \
${host_builddir}/gthr-default.h
pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
@@ -1510,43 +1508,35 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
echo "" >> $@ ;\
echo "#endif // _GLIBCXX_CXX_CONFIG_H" >> $@
-${host_builddir}/gthr.h: ${toplevel_srcdir}/gcc/gthr.h stamp-${host_alias}
+${host_builddir}/gthr.h: ${toplevel_srcdir}/libgcc/gthr.h stamp-${host_alias}
sed -e '/^#pragma/b' \
-e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
-e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
- < ${toplevel_srcdir}/gcc/gthr.h > $@
+ < $< > $@
-${host_builddir}/gthr-single.h: ${toplevel_srcdir}/gcc/gthr-single.h \
+${host_builddir}/gthr-single.h: ${toplevel_srcdir}/libgcc/gthr-single.h \
stamp-${host_alias}
sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
-e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
- < ${toplevel_srcdir}/gcc/gthr-single.h > $@
+ < $< > $@
-${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/gcc/gthr-posix.h \
+${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/libgcc/gthr-posix.h \
stamp-${host_alias}
sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
-e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
-e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
-e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
- < ${toplevel_srcdir}/gcc/gthr-posix.h > $@
+ < $< > $@
-${host_builddir}/gthr-tpf.h: ${toplevel_srcdir}/gcc/gthr-tpf.h \
- stamp-${host_alias}
- sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
- -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
- -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
- -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
- < ${toplevel_srcdir}/gcc/gthr-tpf.h > $@
-
-${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \
+${host_builddir}/gthr-default.h: ${toplevel_builddir}/libgcc/gthr-default.h \
stamp-${host_alias}
sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
-e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
-e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
-e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
-e 's,^#include "\(.*\)",#include <bits/\1>,g' \
- < ${toplevel_srcdir}/gcc/${glibcxx_thread_h} > $@
+ < $< > $@
# Build two precompiled C++ includes, stdc++.h.gch/*.gch
${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
diff --git a/libstdc++-v3/include/backward/hashtable.h b/libstdc++-v3/include/backward/hashtable.h
index 91b0c602cec..dbba097d130 100644
--- a/libstdc++-v3/include/backward/hashtable.h
+++ b/libstdc++-v3/include/backward/hashtable.h
@@ -209,7 +209,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Note: assumes long is at least 32 bits.
enum { _S_num_primes = 29 };
- static const unsigned long __stl_prime_list[_S_num_primes] =
+ template<typename _PrimeType>
+ struct _Hashtable_prime_list
+ {
+ static const _PrimeType __stl_prime_list[_S_num_primes];
+
+ static const _PrimeType*
+ _S_get_prime_list();
+ };
+
+ template<typename _PrimeType> const _PrimeType
+ _Hashtable_prime_list<_PrimeType>::__stl_prime_list[_S_num_primes] =
{
5ul, 53ul, 97ul, 193ul, 389ul,
769ul, 1543ul, 3079ul, 6151ul, 12289ul,
@@ -219,11 +229,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
805306457ul, 1610612741ul, 3221225473ul, 4294967291ul
};
+ template<class _PrimeType> inline const _PrimeType*
+ _Hashtable_prime_list<_PrimeType>::_S_get_prime_list()
+ {
+ return __stl_prime_list;
+ }
+
inline unsigned long
__stl_next_prime(unsigned long __n)
{
- const unsigned long* __first = __stl_prime_list;
- const unsigned long* __last = __stl_prime_list + (int)_S_num_primes;
+ const unsigned long* __first = _Hashtable_prime_list<unsigned long>::_S_get_prime_list();
+ const unsigned long* __last = __first + (int)_S_num_primes;
const unsigned long* pos = std::lower_bound(__first, __last, __n);
return pos == __last ? *(__last - 1) : *pos;
}
@@ -417,7 +433,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size_type
max_bucket_count() const
- { return __stl_prime_list[(int)_S_num_primes - 1]; }
+ { return _Hashtable_prime_list<unsigned long>::
+ _S_get_prime_list()[(int)_S_num_primes - 1];
+ }
size_type
elems_in_bucket(size_type __bucket) const
diff --git a/libstdc++-v3/include/bits/atomic_0.h b/libstdc++-v3/include/bits/atomic_0.h
deleted file mode 100644
index 4f8b0929f16..00000000000
--- a/libstdc++-v3/include/bits/atomic_0.h
+++ /dev/null
@@ -1,677 +0,0 @@
-// -*- C++ -*- header.
-
-// Copyright (C) 2008, 2009, 2010, 2011
-// 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_0.h
- * This is an internal header file, included by other library headers.
- * Do not attempt to use it directly. @headername{atomic}
- */
-
-#ifndef _GLIBCXX_ATOMIC_0_H
-#define _GLIBCXX_ATOMIC_0_H 1
-
-#pragma GCC system_header
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-// 0 == __atomic0 == Never lock-free
-namespace __atomic0
-{
- _GLIBCXX_BEGIN_EXTERN_C
-
- void
- atomic_flag_clear_explicit(__atomic_flag_base*, memory_order)
- _GLIBCXX_NOTHROW;
-
- void
- __atomic_flag_wait_explicit(__atomic_flag_base*, memory_order)
- _GLIBCXX_NOTHROW;
-
- _GLIBCXX_CONST __atomic_flag_base*
- __atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW;
-
- _GLIBCXX_END_EXTERN_C
-
- // Implementation specific defines.
-#define _ATOMIC_MEMBER_ _M_i
-
- // Implementation specific defines.
-#define _ATOMIC_LOAD_(__a, __x) \
- ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
- __i_type* __p = &_ATOMIC_MEMBER_; \
- __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- __i_type __r = *__p; \
- atomic_flag_clear_explicit(__g, __x); \
- __r; })
-
-#define _ATOMIC_STORE_(__a, __n, __x) \
- ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
- __i_type* __p = &_ATOMIC_MEMBER_; \
- __typeof__(__n) __w = (__n); \
- __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- *__p = __w; \
- atomic_flag_clear_explicit(__g, __x); \
- __w; })
-
-#define _ATOMIC_MODIFY_(__a, __o, __n, __x) \
- ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
- __i_type* __p = &_ATOMIC_MEMBER_; \
- __typeof__(__n) __w = (__n); \
- __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- __i_type __r = *__p; \
- *__p __o __w; \
- atomic_flag_clear_explicit(__g, __x); \
- __r; })
-
-#define _ATOMIC_CMPEXCHNG_(__a, __e, __n, __x) \
- ({typedef __typeof__(_ATOMIC_MEMBER_) __i_type; \
- __i_type* __p = &_ATOMIC_MEMBER_; \
- __typeof__(__e) __q = (__e); \
- __typeof__(__n) __w = (__n); \
- bool __r; \
- __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
- __atomic_flag_wait_explicit(__g, __x); \
- __i_type __t = *__p; \
- if (*__q == __t) \
- { \
- *__p = (__i_type)__w; \
- __r = true; \
- } \
- else { *__q = __t; __r = false; } \
- atomic_flag_clear_explicit(__g, __x); \
- __r; })
-
-
- /// atomic_flag
- struct atomic_flag : public __atomic_flag_base
- {
- atomic_flag() noexcept = default;
- ~atomic_flag() noexcept = 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) noexcept : __atomic_flag_base({ __i }) { }
-
- bool
- test_and_set(memory_order __m = memory_order_seq_cst) noexcept;
-
- bool
- test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept;
-
- void
- clear(memory_order __m = memory_order_seq_cst) noexcept;
-
- void
- clear(memory_order __m = memory_order_seq_cst) volatile noexcept;
- };
-
-
- /// Base class for atomic integrals.
- //
- // For each of the integral types, define atomic_[integral type] struct
- //
- // atomic_bool bool
- // atomic_char char
- // atomic_schar signed char
- // atomic_uchar unsigned char
- // atomic_short short
- // atomic_ushort unsigned short
- // atomic_int int
- // atomic_uint unsigned int
- // atomic_long long
- // atomic_ulong unsigned long
- // atomic_llong long long
- // atomic_ullong unsigned long long
- // atomic_char16_t char16_t
- // atomic_char32_t char32_t
- // atomic_wchar_t wchar_t
-
- // Base type.
- // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or 8 bytes,
- // since that is what GCC built-in functions for atomic memory access work on.
- template<typename _ITp>
- struct __atomic_base
- {
- private:
- typedef _ITp __int_type;
-
- __int_type _M_i;
-
- public:
- __atomic_base() noexcept = default;
- ~__atomic_base() noexcept = default;
- __atomic_base(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) volatile = delete;
-
- // Requires __int_type convertible to _M_base._M_i.
- constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { }
-
- operator __int_type() const noexcept
- { return load(); }
-
- operator __int_type() const volatile noexcept
- { return load(); }
-
- __int_type
- operator=(__int_type __i) noexcept
- {
- store(__i);
- return __i;
- }
-
- __int_type
- operator=(__int_type __i) volatile noexcept
- {
- store(__i);
- return __i;
- }
-
- __int_type
- operator++(int) noexcept
- { return fetch_add(1); }
-
- __int_type
- operator++(int) volatile noexcept
- { return fetch_add(1); }
-
- __int_type
- operator--(int) noexcept
- { return fetch_sub(1); }
-
- __int_type
- operator--(int) volatile noexcept
- { return fetch_sub(1); }
-
- __int_type
- operator++() noexcept
- { return fetch_add(1) + 1; }
-
- __int_type
- operator++() volatile noexcept
- { return fetch_add(1) + 1; }
-
- __int_type
- operator--() noexcept
- { return fetch_sub(1) - 1; }
-
- __int_type
- operator--() volatile noexcept
- { return fetch_sub(1) - 1; }
-
- __int_type
- operator+=(__int_type __i) noexcept
- { return fetch_add(__i) + __i; }
-
- __int_type
- operator+=(__int_type __i) volatile noexcept
- { return fetch_add(__i) + __i; }
-
- __int_type
- operator-=(__int_type __i) noexcept
- { return fetch_sub(__i) - __i; }
-
- __int_type
- operator-=(__int_type __i) volatile noexcept
- { return fetch_sub(__i) - __i; }
-
- __int_type
- operator&=(__int_type __i) noexcept
- { return fetch_and(__i) & __i; }
-
- __int_type
- operator&=(__int_type __i) volatile noexcept
- { return fetch_and(__i) & __i; }
-
- __int_type
- operator|=(__int_type __i) noexcept
- { return fetch_or(__i) | __i; }
-
- __int_type
- operator|=(__int_type __i) volatile noexcept
- { return fetch_or(__i) | __i; }
-
- __int_type
- operator^=(__int_type __i) noexcept
- { return fetch_xor(__i) ^ __i; }
-
- __int_type
- operator^=(__int_type __i) volatile noexcept
- { return fetch_xor(__i) ^ __i; }
-
- bool
- is_lock_free() const noexcept
- { return false; }
-
- bool
- is_lock_free() const volatile noexcept
- { return false; }
-
- void
- store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
- _ATOMIC_STORE_(this, __i, __m);
- }
-
- void
- store(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
- _ATOMIC_STORE_(this, __i, __m);
- }
-
- __int_type
- load(memory_order __m = memory_order_seq_cst) const noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
- return _ATOMIC_LOAD_(this, __m);
- }
-
- __int_type
- load(memory_order __m = memory_order_seq_cst) const volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
- return _ATOMIC_LOAD_(this, __m);
- }
-
- __int_type
- exchange(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return _ATOMIC_MODIFY_(this, =, __i, __m); }
-
- __int_type
- exchange(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return _ATOMIC_MODIFY_(this, =, __i, __m); }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m1, memory_order __m2) noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
- return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
- }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m1,
- memory_order __m2) volatile noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
- return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
- }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- return compare_exchange_weak(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- return compare_exchange_weak(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m1, memory_order __m2) noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
- return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m1,
- memory_order __m2) volatile noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
- return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- return compare_exchange_strong(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- return compare_exchange_strong(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- __int_type
- fetch_add(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
-
- __int_type
- fetch_add(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
-
- __int_type
- fetch_sub(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
-
- __int_type
- fetch_sub(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
-
- __int_type
- fetch_and(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
-
- __int_type
- fetch_and(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
-
- __int_type
- fetch_or(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
-
- __int_type
- fetch_or(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
-
- __int_type
- fetch_xor(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
-
- __int_type
- fetch_xor(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
- };
-
-
- /// Partial specialization for pointer types.
- template<typename _PTp>
- struct __atomic_base<_PTp*>
- {
- private:
- typedef _PTp* __return_pointer_type;
- typedef void* __pointer_type;
- __pointer_type _M_i;
-
- public:
- __atomic_base() noexcept = default;
- ~__atomic_base() noexcept = default;
- __atomic_base(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) volatile = delete;
-
- // Requires __pointer_type convertible to _M_i.
- constexpr __atomic_base(__return_pointer_type __p) noexcept
- : _M_i (__p) { }
-
- operator __return_pointer_type() const noexcept
- { return reinterpret_cast<__return_pointer_type>(load()); }
-
- operator __return_pointer_type() const volatile noexcept
- { return reinterpret_cast<__return_pointer_type>(load()); }
-
- __return_pointer_type
- operator=(__pointer_type __p) noexcept
- {
- store(__p);
- return reinterpret_cast<__return_pointer_type>(__p);
- }
-
- __return_pointer_type
- operator=(__pointer_type __p) volatile noexcept
- {
- store(__p);
- return reinterpret_cast<__return_pointer_type>(__p);
- }
-
- __return_pointer_type
- operator++(int) noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_add(1)); }
-
- __return_pointer_type
- operator++(int) volatile noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_add(1)); }
-
- __return_pointer_type
- operator--(int) noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_sub(1)); }
-
- __return_pointer_type
- operator--(int) volatile noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_sub(1)); }
-
- __return_pointer_type
- operator++() noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_add(1) + 1); }
-
- __return_pointer_type
- operator++() volatile noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_add(1) + 1); }
-
- __return_pointer_type
- operator--() noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_sub(1) - 1); }
-
- __return_pointer_type
- operator--() volatile noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_sub(1) - 1); }
-
- __return_pointer_type
- operator+=(ptrdiff_t __d) noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_add(__d) + __d); }
-
- __return_pointer_type
- operator+=(ptrdiff_t __d) volatile noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_add(__d) + __d); }
-
- __return_pointer_type
- operator-=(ptrdiff_t __d) noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_sub(__d) - __d); }
-
- __return_pointer_type
- operator-=(ptrdiff_t __d) volatile noexcept
- { return reinterpret_cast<__return_pointer_type>(fetch_sub(__d) - __d); }
-
- bool
- is_lock_free() const noexcept
- { return true; }
-
- bool
- is_lock_free() const volatile noexcept
- { return true; }
-
- void
- store(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
- _ATOMIC_STORE_(this, __p, __m);
- }
-
- void
- store(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
- volatile __pointer_type* __p2 = &_M_i;
- __typeof__(__p) __w = (__p);
- __atomic_flag_base* __g = __atomic_flag_for_address(__p2);
- __atomic_flag_wait_explicit(__g, __m);
- *__p2 = reinterpret_cast<__pointer_type>(__w);
- atomic_flag_clear_explicit(__g, __m);
- __w;
- }
-
- __return_pointer_type
- load(memory_order __m = memory_order_seq_cst) const noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
- void* __v = _ATOMIC_LOAD_(this, __m);
- return reinterpret_cast<__return_pointer_type>(__v);
- }
-
- __return_pointer_type
- load(memory_order __m = memory_order_seq_cst) const volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
- void* __v = _ATOMIC_LOAD_(this, __m);
- return reinterpret_cast<__return_pointer_type>(__v);
- }
-
- __return_pointer_type
- exchange(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- void* __v = _ATOMIC_MODIFY_(this, =, __p, __m);
- return reinterpret_cast<__return_pointer_type>(__v);
- }
-
- __return_pointer_type
- exchange(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- volatile __pointer_type* __p2 = &_M_i;
- __typeof__(__p) __w = (__p);
- __atomic_flag_base* __g = __atomic_flag_for_address(__p2);
- __atomic_flag_wait_explicit(__g, __m);
- __pointer_type __r = *__p2;
- *__p2 = __w;
- atomic_flag_clear_explicit(__g, __m);
- __r;
- return reinterpret_cast<__return_pointer_type>(_M_i);
- }
-
- bool
- compare_exchange_strong(__return_pointer_type& __rp1, __pointer_type __p2,
- memory_order __m1, memory_order __m2) noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
- __pointer_type& __p1 = reinterpret_cast<void*&>(__rp1);
- return _ATOMIC_CMPEXCHNG_(this, &__p1, __p2, __m1);
- }
-
- bool
- compare_exchange_strong(__return_pointer_type& __rp1, __pointer_type __p2,
- memory_order __m1,
- memory_order __m2) volatile noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
- __pointer_type& __p1 = reinterpret_cast<void*&>(__rp1);
- return _ATOMIC_CMPEXCHNG_(this, &__p1, __p2, __m1);
- }
-
- __return_pointer_type
- fetch_add(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- void* __v = _ATOMIC_MODIFY_(this, +=, __d, __m);
- return reinterpret_cast<__return_pointer_type>(__v);
- }
-
- __return_pointer_type
- fetch_add(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- void* __v = _ATOMIC_MODIFY_(this, +=, __d, __m);
- return reinterpret_cast<__return_pointer_type>(__v);
- }
-
- __return_pointer_type
- fetch_sub(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- void* __v = _ATOMIC_MODIFY_(this, -=, __d, __m);
- return reinterpret_cast<__return_pointer_type>(__v);
- }
-
- __return_pointer_type
- fetch_sub(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- void* __v = _ATOMIC_MODIFY_(this, -=, __d, __m);
- return reinterpret_cast<__return_pointer_type>(__v);
- }
- };
-
-#undef _ATOMIC_LOAD_
-#undef _ATOMIC_STORE_
-#undef _ATOMIC_MODIFY_
-#undef _ATOMIC_CMPEXCHNG_
-} // namespace __atomic0
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace std
-
-#endif
diff --git a/libstdc++-v3/include/bits/atomic_2.h b/libstdc++-v3/include/bits/atomic_2.h
deleted file mode 100644
index 072e82a0a9f..00000000000
--- a/libstdc++-v3/include/bits/atomic_2.h
+++ /dev/null
@@ -1,685 +0,0 @@
-// -*- C++ -*- header.
-
-// Copyright (C) 2008, 2009, 2010, 2011
-// 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_2.h
- * This is an internal header file, included by other library headers.
- * Do not attempt to use it directly. @headername{atomic}
- */
-
-#ifndef _GLIBCXX_ATOMIC_2_H
-#define _GLIBCXX_ATOMIC_2_H 1
-
-#pragma GCC system_header
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-// 2 == __atomic2 == Always lock-free
-// Assumed:
-// _GLIBCXX_ATOMIC_BUILTINS_1
-// _GLIBCXX_ATOMIC_BUILTINS_2
-// _GLIBCXX_ATOMIC_BUILTINS_4
-// _GLIBCXX_ATOMIC_BUILTINS_8
-namespace __atomic2
-{
- /// atomic_flag
- struct atomic_flag : public __atomic_flag_base
- {
- atomic_flag() noexcept = default;
- ~atomic_flag() noexcept = 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) noexcept : __atomic_flag_base({ __i }) { }
-
- bool
- test_and_set(memory_order __m = memory_order_seq_cst) noexcept
- {
- // Redundant synchronize if built-in for lock is a full barrier.
- if (__m != memory_order_acquire && __m != memory_order_acq_rel)
- __sync_synchronize();
- return __sync_lock_test_and_set(&_M_i, 1);
- }
-
- bool
- test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- // Redundant synchronize if built-in for lock is a full barrier.
- if (__m != memory_order_acquire && __m != memory_order_acq_rel)
- __sync_synchronize();
- return __sync_lock_test_and_set(&_M_i, 1);
- }
-
- void
- clear(memory_order __m = memory_order_seq_cst) noexcept
- {
- __glibcxx_assert(__m != memory_order_consume);
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
-
- __sync_lock_release(&_M_i);
- if (__m != memory_order_acquire && __m != memory_order_acq_rel)
- __sync_synchronize();
- }
-
- void
- clear(memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_consume);
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
-
- __sync_lock_release(&_M_i);
- if (__m != memory_order_acquire && __m != memory_order_acq_rel)
- __sync_synchronize();
- }
- };
-
-
- /// Base class for atomic integrals.
- //
- // For each of the integral types, define atomic_[integral type] struct
- //
- // atomic_bool bool
- // atomic_char char
- // atomic_schar signed char
- // atomic_uchar unsigned char
- // atomic_short short
- // atomic_ushort unsigned short
- // atomic_int int
- // atomic_uint unsigned int
- // atomic_long long
- // atomic_ulong unsigned long
- // atomic_llong long long
- // atomic_ullong unsigned long long
- // atomic_char16_t char16_t
- // atomic_char32_t char32_t
- // atomic_wchar_t wchar_t
- //
- // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or
- // 8 bytes, since that is what GCC built-in functions for atomic
- // memory access expect.
- template<typename _ITp>
- struct __atomic_base
- {
- private:
- typedef _ITp __int_type;
-
- __int_type _M_i;
-
- public:
- __atomic_base() noexcept = default;
- ~__atomic_base() noexcept = default;
- __atomic_base(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) volatile = delete;
-
- // Requires __int_type convertible to _M_i.
- constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { }
-
- operator __int_type() const noexcept
- { return load(); }
-
- operator __int_type() const volatile noexcept
- { return load(); }
-
- __int_type
- operator=(__int_type __i) noexcept
- {
- store(__i);
- return __i;
- }
-
- __int_type
- operator=(__int_type __i) volatile noexcept
- {
- store(__i);
- return __i;
- }
-
- __int_type
- operator++(int) noexcept
- { return fetch_add(1); }
-
- __int_type
- operator++(int) volatile noexcept
- { return fetch_add(1); }
-
- __int_type
- operator--(int) noexcept
- { return fetch_sub(1); }
-
- __int_type
- operator--(int) volatile noexcept
- { return fetch_sub(1); }
-
- __int_type
- operator++() noexcept
- { return __sync_add_and_fetch(&_M_i, 1); }
-
- __int_type
- operator++() volatile noexcept
- { return __sync_add_and_fetch(&_M_i, 1); }
-
- __int_type
- operator--() noexcept
- { return __sync_sub_and_fetch(&_M_i, 1); }
-
- __int_type
- operator--() volatile noexcept
- { return __sync_sub_and_fetch(&_M_i, 1); }
-
- __int_type
- operator+=(__int_type __i) noexcept
- { return __sync_add_and_fetch(&_M_i, __i); }
-
- __int_type
- operator+=(__int_type __i) volatile noexcept
- { return __sync_add_and_fetch(&_M_i, __i); }
-
- __int_type
- operator-=(__int_type __i) noexcept
- { return __sync_sub_and_fetch(&_M_i, __i); }
-
- __int_type
- operator-=(__int_type __i) volatile noexcept
- { return __sync_sub_and_fetch(&_M_i, __i); }
-
- __int_type
- operator&=(__int_type __i) noexcept
- { return __sync_and_and_fetch(&_M_i, __i); }
-
- __int_type
- operator&=(__int_type __i) volatile noexcept
- { return __sync_and_and_fetch(&_M_i, __i); }
-
- __int_type
- operator|=(__int_type __i) noexcept
- { return __sync_or_and_fetch(&_M_i, __i); }
-
- __int_type
- operator|=(__int_type __i) volatile noexcept
- { return __sync_or_and_fetch(&_M_i, __i); }
-
- __int_type
- operator^=(__int_type __i) noexcept
- { return __sync_xor_and_fetch(&_M_i, __i); }
-
- __int_type
- operator^=(__int_type __i) volatile noexcept
- { return __sync_xor_and_fetch(&_M_i, __i); }
-
- bool
- is_lock_free() const noexcept
- { return true; }
-
- bool
- is_lock_free() const volatile noexcept
- { return true; }
-
- void
- store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
-
- if (__m == memory_order_relaxed)
- _M_i = __i;
- else
- {
- // write_mem_barrier();
- _M_i = __i;
- if (__m == memory_order_seq_cst)
- __sync_synchronize();
- }
- }
-
- void
- store(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
-
- if (__m == memory_order_relaxed)
- _M_i = __i;
- else
- {
- // write_mem_barrier();
- _M_i = __i;
- if (__m == memory_order_seq_cst)
- __sync_synchronize();
- }
- }
-
- __int_type
- load(memory_order __m = memory_order_seq_cst) const noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
-
- __sync_synchronize();
- __int_type __ret = _M_i;
- __sync_synchronize();
- return __ret;
- }
-
- __int_type
- load(memory_order __m = memory_order_seq_cst) const volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
-
- __sync_synchronize();
- __int_type __ret = _M_i;
- __sync_synchronize();
- return __ret;
- }
-
- __int_type
- exchange(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- // XXX built-in assumes memory_order_acquire.
- return __sync_lock_test_and_set(&_M_i, __i);
- }
-
-
- __int_type
- exchange(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- // XXX built-in assumes memory_order_acquire.
- return __sync_lock_test_and_set(&_M_i, __i);
- }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m1, memory_order __m2) noexcept
- { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m1,
- memory_order __m2) volatile noexcept
- { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- return compare_exchange_weak(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- bool
- compare_exchange_weak(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- return compare_exchange_weak(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m1, memory_order __m2) noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
-
- __int_type __i1o = __i1;
- __int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
-
- // Assume extra stores (of same value) allowed in true case.
- __i1 = __i1n;
- return __i1o == __i1n;
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m1,
- memory_order __m2) volatile noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
-
- __int_type __i1o = __i1;
- __int_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
-
- // Assume extra stores (of same value) allowed in true case.
- __i1 = __i1n;
- return __i1o == __i1n;
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- return compare_exchange_strong(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- bool
- compare_exchange_strong(__int_type& __i1, __int_type __i2,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- return compare_exchange_strong(__i1, __i2, __m,
- __calculate_memory_order(__m));
- }
-
- __int_type
- fetch_add(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return __sync_fetch_and_add(&_M_i, __i); }
-
- __int_type
- fetch_add(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __sync_fetch_and_add(&_M_i, __i); }
-
- __int_type
- fetch_sub(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return __sync_fetch_and_sub(&_M_i, __i); }
-
- __int_type
- fetch_sub(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __sync_fetch_and_sub(&_M_i, __i); }
-
- __int_type
- fetch_and(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return __sync_fetch_and_and(&_M_i, __i); }
-
- __int_type
- fetch_and(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __sync_fetch_and_and(&_M_i, __i); }
-
- __int_type
- fetch_or(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return __sync_fetch_and_or(&_M_i, __i); }
-
- __int_type
- fetch_or(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __sync_fetch_and_or(&_M_i, __i); }
-
- __int_type
- fetch_xor(__int_type __i,
- memory_order __m = memory_order_seq_cst) noexcept
- { return __sync_fetch_and_xor(&_M_i, __i); }
-
- __int_type
- fetch_xor(__int_type __i,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __sync_fetch_and_xor(&_M_i, __i); }
- };
-
-
- /// Partial specialization for pointer types.
- template<typename _PTp>
- struct __atomic_base<_PTp*>
- {
- private:
- typedef _PTp* __pointer_type;
-
- __pointer_type _M_p;
-
- public:
- __atomic_base() noexcept = default;
- ~__atomic_base() noexcept = default;
- __atomic_base(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) = delete;
- __atomic_base& operator=(const __atomic_base&) volatile = delete;
-
- // Requires __pointer_type convertible to _M_p.
- constexpr __atomic_base(__pointer_type __p) noexcept : _M_p (__p) { }
-
- operator __pointer_type() const noexcept
- { return load(); }
-
- operator __pointer_type() const volatile noexcept
- { return load(); }
-
- __pointer_type
- operator=(__pointer_type __p) noexcept
- {
- store(__p);
- return __p;
- }
-
- __pointer_type
- operator=(__pointer_type __p) volatile noexcept
- {
- store(__p);
- return __p;
- }
-
- __pointer_type
- operator++(int) noexcept
- { return fetch_add(1); }
-
- __pointer_type
- operator++(int) volatile noexcept
- { return fetch_add(1); }
-
- __pointer_type
- operator--(int) noexcept
- { return fetch_sub(1); }
-
- __pointer_type
- operator--(int) volatile noexcept
- { return fetch_sub(1); }
-
- __pointer_type
- operator++() noexcept
- { return fetch_add(1) + 1; }
-
- __pointer_type
- operator++() volatile noexcept
- { return fetch_add(1) + 1; }
-
- __pointer_type
- operator--() noexcept
- { return fetch_sub(1) -1; }
-
- __pointer_type
- operator--() volatile noexcept
- { return fetch_sub(1) -1; }
-
- __pointer_type
- operator+=(ptrdiff_t __d) noexcept
- { return fetch_add(__d) + __d; }
-
- __pointer_type
- operator+=(ptrdiff_t __d) volatile noexcept
- { return fetch_add(__d) + __d; }
-
- __pointer_type
- operator-=(ptrdiff_t __d) noexcept
- { return fetch_sub(__d) - __d; }
-
- __pointer_type
- operator-=(ptrdiff_t __d) volatile noexcept
- { return fetch_sub(__d) - __d; }
-
- bool
- is_lock_free() const noexcept
- { return true; }
-
- bool
- is_lock_free() const volatile noexcept
- { return true; }
-
- void
- store(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
-
- if (__m == memory_order_relaxed)
- _M_p = __p;
- else
- {
- // write_mem_barrier();
- _M_p = __p;
- if (__m == memory_order_seq_cst)
- __sync_synchronize();
- }
- }
-
- void
- store(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_acquire);
- __glibcxx_assert(__m != memory_order_acq_rel);
- __glibcxx_assert(__m != memory_order_consume);
-
- if (__m == memory_order_relaxed)
- _M_p = __p;
- else
- {
- // write_mem_barrier();
- _M_p = __p;
- if (__m == memory_order_seq_cst)
- __sync_synchronize();
- }
- }
-
- __pointer_type
- load(memory_order __m = memory_order_seq_cst) const noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
-
- __sync_synchronize();
- __pointer_type __ret = _M_p;
- __sync_synchronize();
- return __ret;
- }
-
- __pointer_type
- load(memory_order __m = memory_order_seq_cst) const volatile noexcept
- {
- __glibcxx_assert(__m != memory_order_release);
- __glibcxx_assert(__m != memory_order_acq_rel);
-
- __sync_synchronize();
- __pointer_type __ret = _M_p;
- __sync_synchronize();
- return __ret;
- }
-
- __pointer_type
- exchange(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) noexcept
- {
- // XXX built-in assumes memory_order_acquire.
- return __sync_lock_test_and_set(&_M_p, __p);
- }
-
-
- __pointer_type
- exchange(__pointer_type __p,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- // XXX built-in assumes memory_order_acquire.
- return __sync_lock_test_and_set(&_M_p, __p);
- }
-
- bool
- compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
- memory_order __m1,
- memory_order __m2) noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
-
- __pointer_type __p1o = __p1;
- __pointer_type __p1n = __sync_val_compare_and_swap(&_M_p, __p1o, __p2);
-
- // Assume extra stores (of same value) allowed in true case.
- __p1 = __p1n;
- return __p1o == __p1n;
- }
-
- bool
- compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
- memory_order __m1,
- memory_order __m2) volatile noexcept
- {
- __glibcxx_assert(__m2 != memory_order_release);
- __glibcxx_assert(__m2 != memory_order_acq_rel);
- __glibcxx_assert(__m2 <= __m1);
-
- __pointer_type __p1o = __p1;
- __pointer_type __p1n = __sync_val_compare_and_swap(&_M_p, __p1o, __p2);
-
- // Assume extra stores (of same value) allowed in true case.
- __p1 = __p1n;
- return __p1o == __p1n;
- }
-
- __pointer_type
- fetch_add(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) noexcept
- { return __sync_fetch_and_add(&_M_p, __d); }
-
- __pointer_type
- fetch_add(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __sync_fetch_and_add(&_M_p, __d); }
-
- __pointer_type
- fetch_sub(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) noexcept
- { return __sync_fetch_and_sub(&_M_p, __d); }
-
- __pointer_type
- fetch_sub(ptrdiff_t __d,
- memory_order __m = memory_order_seq_cst) volatile noexcept
- { return __sync_fetch_and_sub(&_M_p, __d); }
- };
-
-} // namespace __atomic2
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace std
-
-#endif
diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index ebb7d58ac72..5327c1bfa21 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -69,10 +69,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
void
- atomic_thread_fence(memory_order) noexcept;
+ atomic_thread_fence(memory_order __m) noexcept;
void
- atomic_signal_fence(memory_order) noexcept;
+ atomic_signal_fence(memory_order __m) noexcept;
/// kill_dependency
template<typename _Tp>
@@ -83,86 +83,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __ret;
}
- /**
- * @brief Base type for atomic_flag.
- *
- * Base type is POD with data, allowing atomic_flag to derive from
- * it and meet the standard layout type requirement. In addition to
- * compatibilty with a C interface, this allows different
- * implementations of atomic_flag to use the same atomic operation
- * functions, via a standard conversion to the __atomic_flag_base
- * argument.
- */
- _GLIBCXX_BEGIN_EXTERN_C
+ /// Lock-free Property
- struct __atomic_flag_base
- {
- bool _M_i;
- };
+#define LOCKFREE_PROP(T) (__atomic_always_lock_free (sizeof (T), 0) ? 2 : 1)
- _GLIBCXX_END_EXTERN_C
-
-#define ATOMIC_FLAG_INIT { false }
+#define ATOMIC_CHAR_LOCK_FREE LOCKFREE_PROP (char)
+#define ATOMIC_CHAR16_T_LOCK_FREE LOCKFREE_PROP (char16_t)
+#define ATOMIC_CHAR32_T_LOCK_FREE LOCKFREE_PROP (char32_t)
+#define ATOMIC_WCHAR_T_LOCK_FREE LOCKFREE_PROP (wchar_t)
+#define ATOMIC_SHORT_LOCK_FREE LOCKFREE_PROP (short)
+#define ATOMIC_INT_LOCK_FREE LOCKFREE_PROP (int)
+#define ATOMIC_LONG_LOCK_FREE LOCKFREE_PROP (long)
+#define ATOMIC_LLONG_LOCK_FREE LOCKFREE_PROP (long long)
// Base types for atomics.
- //
- // 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.
- //
- // 0 == __atomic0 == Never lock-free
- // 1 == __atomic1 == Best available, sometimes lock-free
- // 2 == __atomic2 == Always lock-free
-
- namespace __atomic0
- {
- struct atomic_flag;
-
- template<typename _IntTp>
- struct __atomic_base;
- }
-
- namespace __atomic2
- {
- struct atomic_flag;
-
- template<typename _IntTp>
- struct __atomic_base;
- }
-
- namespace __atomic1
- {
- using __atomic2::atomic_flag;
- using __atomic0::__atomic_base;
- }
-
- /// 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_CHAR_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-#define ATOMIC_CHAR16_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-#define ATOMIC_CHAR32_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-#define ATOMIC_WCHAR_T_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-#define ATOMIC_SHORT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-#define ATOMIC_INT_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-#define ATOMIC_LONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-#define ATOMIC_LLONG_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
-
- inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
-
+ template<typename _IntTp>
+ struct __atomic_base;
/// atomic_char
typedef __atomic_base<char> atomic_char;
@@ -287,6 +224,636 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
struct atomic<_Tp*>;
+
+ /**
+ * @brief Base type for atomic_flag.
+ *
+ * Base type is POD with data, allowing atomic_flag to derive from
+ * it and meet the standard layout type requirement. In addition to
+ * compatibilty with a C interface, this allows different
+ * implementations of atomic_flag to use the same atomic operation
+ * functions, via a standard conversion to the __atomic_flag_base
+ * argument.
+ */
+ _GLIBCXX_BEGIN_EXTERN_C
+
+ struct __atomic_flag_base
+ {
+ bool _M_i;
+ };
+
+ _GLIBCXX_END_EXTERN_C
+
+#define ATOMIC_FLAG_INIT { false }
+
+ /// atomic_flag
+ struct atomic_flag : public __atomic_flag_base
+ {
+ atomic_flag() noexcept = default;
+ ~atomic_flag() noexcept = 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) noexcept : __atomic_flag_base({ __i }) { }
+
+ bool
+ test_and_set(memory_order __m = memory_order_seq_cst) noexcept
+ {
+ /* The standard *requires* this to be lock free. If exchange is not
+ always lock free, the resort to the old test_and_set. */
+ if (__atomic_always_lock_free (sizeof (_M_i), 0))
+ return __atomic_exchange_n(&_M_i, 1, __m);
+ else
+ {
+ /* Sync test and set is only guaranteed to be acquire. */
+ if (__m == memory_order_seq_cst || __m == memory_order_release
+ || __m == memory_order_acq_rel)
+ atomic_thread_fence (__m);
+ return __sync_lock_test_and_set (&_M_i, 1);
+ }
+ }
+
+ bool
+ test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ /* The standard *requires* this to be lock free. If exchange is not
+ always lock free, the resort to the old test_and_set. */
+ if (__atomic_always_lock_free (sizeof (_M_i), 0))
+ return __atomic_exchange_n(&_M_i, 1, __m);
+ else
+ {
+ /* Sync test and set is only guaranteed to be acquire. */
+ if (__m == memory_order_seq_cst || __m == memory_order_release
+ || __m == memory_order_acq_rel)
+ atomic_thread_fence (__m);
+ return __sync_lock_test_and_set (&_M_i, 1);
+ }
+ }
+
+ void
+ clear(memory_order __m = memory_order_seq_cst) noexcept
+ {
+ __glibcxx_assert(__m != memory_order_consume);
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ /* The standard *requires* this to be lock free. If store is not always
+ lock free, the resort to the old style __sync_lock_release. */
+ if (__atomic_always_lock_free (sizeof (_M_i), 0))
+ __atomic_store_n(&_M_i, 0, __m);
+ else
+ {
+ __sync_lock_release (&_M_i, 0);
+ /* __sync_lock_release is only guaranteed to be a release barrier. */
+ if (__m == memory_order_seq_cst)
+ atomic_thread_fence (__m);
+ }
+ }
+
+ void
+ clear(memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ __glibcxx_assert(__m != memory_order_consume);
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ /* The standard *requires* this to be lock free. If store is not always
+ lock free, the resort to the old style __sync_lock_release. */
+ if (__atomic_always_lock_free (sizeof (_M_i), 0))
+ __atomic_store_n(&_M_i, 0, __m);
+ else
+ {
+ __sync_lock_release (&_M_i, 0);
+ /* __sync_lock_release is only guaranteed to be a release barrier. */
+ if (__m == memory_order_seq_cst)
+ atomic_thread_fence (__m);
+ }
+ }
+ };
+
+
+ /// Base class for atomic integrals.
+ //
+ // For each of the integral types, define atomic_[integral type] struct
+ //
+ // atomic_bool bool
+ // atomic_char char
+ // atomic_schar signed char
+ // atomic_uchar unsigned char
+ // atomic_short short
+ // atomic_ushort unsigned short
+ // atomic_int int
+ // atomic_uint unsigned int
+ // atomic_long long
+ // atomic_ulong unsigned long
+ // atomic_llong long long
+ // atomic_ullong unsigned long long
+ // atomic_char16_t char16_t
+ // atomic_char32_t char32_t
+ // atomic_wchar_t wchar_t
+ //
+ // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or
+ // 8 bytes, since that is what GCC built-in functions for atomic
+ // memory access expect.
+ template<typename _ITp>
+ struct __atomic_base
+ {
+ private:
+ typedef _ITp __int_type;
+
+ __int_type _M_i;
+
+ public:
+ __atomic_base() noexcept = default;
+ ~__atomic_base() noexcept = default;
+ __atomic_base(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) volatile = delete;
+
+ // Requires __int_type convertible to _M_i.
+ constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { }
+
+ operator __int_type() const noexcept
+ { return load(); }
+
+ operator __int_type() const volatile noexcept
+ { return load(); }
+
+ __int_type
+ operator=(__int_type __i) noexcept
+ {
+ store(__i);
+ return __i;
+ }
+
+ __int_type
+ operator=(__int_type __i) volatile noexcept
+ {
+ store(__i);
+ return __i;
+ }
+
+ __int_type
+ operator++(int) noexcept
+ { return fetch_add(1); }
+
+ __int_type
+ operator++(int) volatile noexcept
+ { return fetch_add(1); }
+
+ __int_type
+ operator--(int) noexcept
+ { return fetch_sub(1); }
+
+ __int_type
+ operator--(int) volatile noexcept
+ { return fetch_sub(1); }
+
+ __int_type
+ operator++() noexcept
+ { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); }
+
+ __int_type
+ operator++() volatile noexcept
+ { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); }
+
+ __int_type
+ operator--() noexcept
+ { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); }
+
+ __int_type
+ operator--() volatile noexcept
+ { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); }
+
+ __int_type
+ operator+=(__int_type __i) noexcept
+ { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator+=(__int_type __i) volatile noexcept
+ { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator-=(__int_type __i) noexcept
+ { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator-=(__int_type __i) volatile noexcept
+ { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator&=(__int_type __i) noexcept
+ { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator&=(__int_type __i) volatile noexcept
+ { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator|=(__int_type __i) noexcept
+ { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator|=(__int_type __i) volatile noexcept
+ { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator^=(__int_type __i) noexcept
+ { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ __int_type
+ operator^=(__int_type __i) volatile noexcept
+ { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); }
+
+ bool
+ is_lock_free() const noexcept
+ { return __atomic_is_lock_free (sizeof (_M_i), &_M_i); }
+
+ bool
+ is_lock_free() const volatile noexcept
+ { return __atomic_is_lock_free (sizeof (_M_i), &_M_i); }
+
+ void
+ store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+
+ __atomic_store_n(&_M_i, __i, __m);
+ }
+
+ void
+ store(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+
+ __atomic_store_n(&_M_i, __i, __m);
+ }
+
+ __int_type
+ load(memory_order __m = memory_order_seq_cst) const noexcept
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ return __atomic_load_n(&_M_i, __m);
+ }
+
+ __int_type
+ load(memory_order __m = memory_order_seq_cst) const volatile noexcept
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ return __atomic_load_n(&_M_i, __m);
+ }
+
+ __int_type
+ exchange(__int_type __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ {
+ return __atomic_exchange_n(&_M_i, __i, __m);
+ }
+
+
+ __int_type
+ exchange(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ return __atomic_exchange_n(&_M_i, __i, __m);
+ }
+
+ bool
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m1, memory_order __m2) noexcept
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2);
+ }
+
+ bool
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m1,
+ memory_order __m2) volatile noexcept
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2);
+ }
+
+ bool
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) noexcept
+ {
+ return compare_exchange_weak(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_weak(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ return compare_exchange_weak(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m1, memory_order __m2) noexcept
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2);
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m1,
+ memory_order __m2) volatile noexcept
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2);
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) noexcept
+ {
+ return compare_exchange_strong(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(__int_type& __i1, __int_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ return compare_exchange_strong(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ __int_type
+ fetch_add(__int_type __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return __atomic_fetch_add(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_add(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return __atomic_fetch_add(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_sub(__int_type __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return __atomic_fetch_sub(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_sub(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return __atomic_fetch_sub(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_and(__int_type __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return __atomic_fetch_and(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_and(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return __atomic_fetch_and(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_or(__int_type __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return __atomic_fetch_or(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_or(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return __atomic_fetch_or(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_xor(__int_type __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return __atomic_fetch_xor(&_M_i, __i, __m); }
+
+ __int_type
+ fetch_xor(__int_type __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return __atomic_fetch_xor(&_M_i, __i, __m); }
+ };
+
+
+ /// Partial specialization for pointer types.
+ template<typename _PTp>
+ struct __atomic_base<_PTp*>
+ {
+ private:
+ typedef _PTp* __pointer_type;
+
+ __pointer_type _M_p;
+
+ public:
+ __atomic_base() noexcept = default;
+ ~__atomic_base() noexcept = default;
+ __atomic_base(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) volatile = delete;
+
+ // Requires __pointer_type convertible to _M_p.
+ constexpr __atomic_base(__pointer_type __p) noexcept : _M_p (__p) { }
+
+ operator __pointer_type() const noexcept
+ { return load(); }
+
+ operator __pointer_type() const volatile noexcept
+ { return load(); }
+
+ __pointer_type
+ operator=(__pointer_type __p) noexcept
+ {
+ store(__p);
+ return __p;
+ }
+
+ __pointer_type
+ operator=(__pointer_type __p) volatile noexcept
+ {
+ store(__p);
+ return __p;
+ }
+
+ __pointer_type
+ operator++(int) noexcept
+ { return fetch_add(1); }
+
+ __pointer_type
+ operator++(int) volatile noexcept
+ { return fetch_add(1); }
+
+ __pointer_type
+ operator--(int) noexcept
+ { return fetch_sub(1); }
+
+ __pointer_type
+ operator--(int) volatile noexcept
+ { return fetch_sub(1); }
+
+ __pointer_type
+ operator++() noexcept
+ { return __atomic_add_fetch(&_M_p, 1, memory_order_seq_cst); }
+
+ __pointer_type
+ operator++() volatile noexcept
+ { return __atomic_add_fetch(&_M_p, 1, memory_order_seq_cst); }
+
+ __pointer_type
+ operator--() noexcept
+ { return __atomic_sub_fetch(&_M_p, 1, memory_order_seq_cst); }
+
+ __pointer_type
+ operator--() volatile noexcept
+ { return __atomic_sub_fetch(&_M_p, 1, memory_order_seq_cst); }
+
+ __pointer_type
+ operator+=(ptrdiff_t __d) noexcept
+ { return __atomic_add_fetch(&_M_p, __d, memory_order_seq_cst); }
+
+ __pointer_type
+ operator+=(ptrdiff_t __d) volatile noexcept
+ { return __atomic_add_fetch(&_M_p, __d, memory_order_seq_cst); }
+
+ __pointer_type
+ operator-=(ptrdiff_t __d) noexcept
+ { return __atomic_sub_fetch(&_M_p, __d, memory_order_seq_cst); }
+
+ __pointer_type
+ operator-=(ptrdiff_t __d) volatile noexcept
+ { return __atomic_sub_fetch(&_M_p, __d, memory_order_seq_cst); }
+
+ bool
+ is_lock_free() const noexcept
+ { return __atomic_is_lock_free (sizeof (_M_p), &_M_p); }
+
+ bool
+ is_lock_free() const volatile noexcept
+ { return __atomic_is_lock_free (sizeof (_M_p), &_M_p); }
+
+ void
+ store(__pointer_type __p,
+ memory_order __m = memory_order_seq_cst) noexcept
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+
+ __atomic_store_n(&_M_p, __p, __m);
+ }
+
+ void
+ store(__pointer_type __p,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ __glibcxx_assert(__m != memory_order_acquire);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+ __glibcxx_assert(__m != memory_order_consume);
+
+ __atomic_store_n(&_M_p, __p, __m);
+ }
+
+ __pointer_type
+ load(memory_order __m = memory_order_seq_cst) const noexcept
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ return __atomic_load_n(&_M_p, __m);
+ }
+
+ __pointer_type
+ load(memory_order __m = memory_order_seq_cst) const volatile noexcept
+ {
+ __glibcxx_assert(__m != memory_order_release);
+ __glibcxx_assert(__m != memory_order_acq_rel);
+
+ return __atomic_load_n(&_M_p, __m);
+ }
+
+ __pointer_type
+ exchange(__pointer_type __p,
+ memory_order __m = memory_order_seq_cst) noexcept
+ {
+ return __atomic_exchange_n(&_M_p, __p, __m);
+ }
+
+
+ __pointer_type
+ exchange(__pointer_type __p,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ {
+ return __atomic_exchange_n(&_M_p, __p, __m);
+ }
+
+ bool
+ compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+ memory_order __m1,
+ memory_order __m2) noexcept
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2);
+ }
+
+ bool
+ compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2,
+ memory_order __m1,
+ memory_order __m2) volatile noexcept
+ {
+ __glibcxx_assert(__m2 != memory_order_release);
+ __glibcxx_assert(__m2 != memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2);
+ }
+
+ __pointer_type
+ fetch_add(ptrdiff_t __d,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return __atomic_fetch_add(&_M_p, __d, __m); }
+
+ __pointer_type
+ fetch_add(ptrdiff_t __d,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return __atomic_fetch_add(&_M_p, __d, __m); }
+
+ __pointer_type
+ fetch_sub(ptrdiff_t __d,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return __atomic_fetch_sub(&_M_p, __d, __m); }
+
+ __pointer_type
+ fetch_sub(ptrdiff_t __d,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return __atomic_fetch_sub(&_M_p, __d, __m); }
+ };
+
// @} group atomics
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 0edb8b2f8df..00f9bccd419 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -865,6 +865,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return _M_data()[__n];
}
+ /**
+ * @brief Provides access to the data contained in the %string.
+ * @param __n The index of the character to access.
+ * @return Read/write reference to the character.
+ * @throw std::out_of_range If @a n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter is
+ * first checked that it is in the range of the string. The function
+ * throws out_of_range if the check fails. Success results in
+ * unsharing the string.
+ */
+ reference
+ at(size_type __n)
+ {
+ if (__n >= size())
+ __throw_out_of_range(__N("basic_string::at"));
+ _M_leak();
+ return _M_data()[__n];
+ }
+
#ifdef __GXX_EXPERIMENTAL_CXX0X__
/**
* Returns a read/write reference to the data at the first
@@ -899,26 +919,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return operator[](this->size() - 1); }
#endif
- /**
- * @brief Provides access to the data contained in the %string.
- * @param __n The index of the character to access.
- * @return Read/write reference to the character.
- * @throw std::out_of_range If @a n is an invalid index.
- *
- * This function provides for safer data access. The parameter is
- * first checked that it is in the range of the string. The function
- * throws out_of_range if the check fails. Success results in
- * unsharing the string.
- */
- reference
- at(size_type __n)
- {
- if (__n >= size())
- __throw_out_of_range(__N("basic_string::at"));
- _M_leak();
- return _M_data()[__n];
- }
-
// Modifiers:
/**
* @brief Append a string to this string.
@@ -1394,6 +1394,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
iterator
erase(iterator __first, iterator __last);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Remove the last character.
+ *
+ * The string must be non-empty.
+ */
+ void
+ pop_back()
+ { erase(size()-1, 1); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Replace characters with value from another string.
* @param __pos Index of first character to replace.
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index f77da5ee1a7..e76e7423021 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -148,6 +148,8 @@
namespace __detail { }
}
+ namespace tr2 { }
+
namespace decimal { }
namespace chrono { }
@@ -197,6 +199,9 @@ namespace std
namespace __detail { inline namespace __7 { } }
}
+ namespace tr2
+ { inline namespace __7 { } }
+
namespace decimal { inline namespace __7 { } }
namespace chrono { inline namespace __7 { } }
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index 7c66d633863..d109224d1bf 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -491,7 +491,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const mersenne_twister_engine& __lhs,
const mersenne_twister_engine& __rhs)
- { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }
+ { return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x)
+ && __lhs._M_p == __rhs._M_p); }
/**
* @brief Inserts the current state of a % mersenne_twister_engine
@@ -705,7 +706,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const subtract_with_carry_engine& __lhs,
const subtract_with_carry_engine& __rhs)
- { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }
+ { return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x)
+ && __lhs._M_carry == __rhs._M_carry
+ && __lhs._M_p == __rhs._M_p); }
/**
* @brief Inserts the current state of a % subtract_with_carry_engine
@@ -1370,7 +1373,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend bool
operator==(const shuffle_order_engine& __lhs,
const shuffle_order_engine& __rhs)
- { return __lhs._M_b == __rhs._M_b; }
+ { return (__lhs._M_b == __rhs._M_b
+ && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v)
+ && __lhs._M_y == __rhs._M_y); }
/**
* @brief Inserts the current state of a %shuffle_order_engine random
diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc
index 0e74848ff3c..8936a62316a 100644
--- a/libstdc++-v3/include/bits/random.tcc
+++ b/libstdc++-v3/include/bits/random.tcc
@@ -471,9 +471,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
__os.fill(__space);
- for (size_t __i = 0; __i < __n - 1; ++__i)
+ for (size_t __i = 0; __i < __n; ++__i)
__os << __x._M_x[__i] << __space;
- __os << __x._M_x[__n - 1];
+ __os << __x._M_p;
__os.flags(__flags);
__os.fill(__fill);
@@ -498,6 +498,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (size_t __i = 0; __i < __n; ++__i)
__is >> __x._M_x[__i];
+ __is >> __x._M_p;
__is.flags(__flags);
return __is;
@@ -627,7 +628,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (size_t __i = 0; __i < __r; ++__i)
__os << __x._M_x[__i] << __space;
- __os << __x._M_carry;
+ __os << __x._M_carry << __space << __x._M_p;
__os.flags(__flags);
__os.fill(__fill);
@@ -649,6 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (size_t __i = 0; __i < __r; ++__i)
__is >> __x._M_x[__i];
__is >> __x._M_carry;
+ __is >> __x._M_p;
__is.flags(__flags);
return __is;
diff --git a/libstdc++-v3/include/c_global/cstdalign b/libstdc++-v3/include/c_global/cstdalign
new file mode 100644
index 00000000000..31f0c1b384e
--- /dev/null
+++ b/libstdc++-v3/include/c_global/cstdalign
@@ -0,0 +1,44 @@
+// <cstdalign> -*- C++ -*-
+
+// Copyright (C) 2011 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 include/cstdalign
+ * This is a Standard C++ Library header.
+ */
+
+#pragma GCC system_header
+
+#ifndef _GLIBCXX_CSTDALIGN
+#define _GLIBCXX_CSTDALIGN 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <bits/c++0x_warning.h>
+#else
+# include <bits/c++config.h>
+# if _GLIBCXX_HAVE_STDALIGN_H
+# include <stdalign.h>
+# endif
+#endif
+
+#endif
+
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 7856b240b86..6350f6de5e5 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -580,6 +580,16 @@ namespace __gnu_debug
return iterator(__res, this);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ pop_back()
+ {
+ __glibcxx_check_nonempty();
+ _Base::pop_back();
+ this->_M_invalidate_all();
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
basic_string&
replace(size_type __pos1, size_type __n1, const basic_string& __str)
{
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index 5720daf3919..a613e364d3a 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -1140,6 +1140,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return iterator(this->_M_data() + __pos);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Remove the last character.
+ *
+ * The string must be non-empty.
+ */
+ void
+ pop_back()
+ { this->_M_erase(size()-1, 1); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
/**
* @brief Replace characters with value from another string.
* @param __pos Index of first character to replace.
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index b3fa7d8120b..70f613f5c50 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -39,8 +39,6 @@
#endif
#include <bits/atomic_base.h>
-#include <bits/atomic_0.h>
-#include <bits/atomic_2.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -167,69 +165,116 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr atomic(_Tp __i) noexcept : _M_i(__i) { }
- operator _Tp() const noexcept;
+ operator _Tp() const noexcept
+ { return load(); }
- operator _Tp() const volatile noexcept;
+ operator _Tp() const volatile noexcept
+ { return load(); }
_Tp
- operator=(_Tp __i) noexcept { store(__i); return __i; }
+ operator=(_Tp __i) noexcept
+ { store(__i); return __i; }
_Tp
- operator=(_Tp __i) volatile noexcept { store(__i); return __i; }
+ operator=(_Tp __i) volatile noexcept
+ { store(__i); return __i; }
bool
- is_lock_free() const noexcept;
+ is_lock_free() const noexcept
+ { return __atomic_is_lock_free(sizeof(_M_i), &_M_i); }
bool
- is_lock_free() const volatile noexcept;
+ is_lock_free() const volatile noexcept
+ { return __atomic_is_lock_free(sizeof(_M_i), &_M_i); }
void
- store(_Tp, memory_order = memory_order_seq_cst) noexcept;
+ store(_Tp __i, memory_order _m = memory_order_seq_cst) noexcept
+ { __atomic_store(&_M_i, &__i, _m); }
void
- store(_Tp, memory_order = memory_order_seq_cst) volatile noexcept;
+ store(_Tp __i, memory_order _m = memory_order_seq_cst) volatile noexcept
+ { __atomic_store(&_M_i, &__i, _m); }
_Tp
- load(memory_order = memory_order_seq_cst) const noexcept;
+ load(memory_order _m = memory_order_seq_cst) const noexcept
+ {
+ _Tp tmp;
+ __atomic_load(&_M_i, &tmp, _m);
+ return tmp;
+ }
_Tp
- load(memory_order = memory_order_seq_cst) const volatile noexcept;
+ load(memory_order _m = memory_order_seq_cst) const volatile noexcept
+ {
+ _Tp tmp;
+ __atomic_load(&_M_i, &tmp, _m);
+ return tmp;
+ }
_Tp
- exchange(_Tp __i, memory_order = memory_order_seq_cst) noexcept;
+ exchange(_Tp __i, memory_order _m = memory_order_seq_cst) noexcept
+ {
+ _Tp tmp;
+ __atomic_exchange(&_M_i, &__i, &tmp, _m);
+ return tmp;
+ }
_Tp
- exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile noexcept;
+ exchange(_Tp __i,
+ memory_order _m = memory_order_seq_cst) volatile noexcept
+ {
+ _Tp tmp;
+ __atomic_exchange(&_M_i, &__i, &tmp, _m);
+ return tmp;
+ }
bool
- compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) noexcept;
+ compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s,
+ memory_order __f) noexcept
+ {
+ return __atomic_compare_exchange(&_M_i, &__e, &__i, true, __s, __f);
+ }
bool
- compare_exchange_weak(_Tp&, _Tp, memory_order,
- memory_order) volatile noexcept;
+ compare_exchange_weak(_Tp& __e, _Tp __i, memory_order __s,
+ memory_order __f) volatile noexcept
+ {
+ return __atomic_compare_exchange(&_M_i, &__e, &__i, true, __s, __f);
+ }
bool
- compare_exchange_weak(_Tp&, _Tp,
- memory_order = memory_order_seq_cst) noexcept;
+ compare_exchange_weak(_Tp& __e, _Tp __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return compare_exchange_weak(__e, __i, __m, __m); }
bool
- compare_exchange_weak(_Tp&, _Tp,
- memory_order = memory_order_seq_cst) volatile noexcept;
+ compare_exchange_weak(_Tp& __e, _Tp __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return compare_exchange_weak(__e, __i, __m, __m); }
bool
- compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) noexcept;
+ compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s,
+ memory_order __f) noexcept
+ {
+ return __atomic_compare_exchange(&_M_i, &__e, &__i, false, __s, __f);
+ }
bool
- compare_exchange_strong(_Tp&, _Tp, memory_order,
- memory_order) volatile noexcept;
+ compare_exchange_strong(_Tp& __e, _Tp __i, memory_order __s,
+ memory_order __f) volatile noexcept
+ {
+ return __atomic_compare_exchange(&_M_i, &__e, &__i, false, __s, __f);
+ }
bool
- compare_exchange_strong(_Tp&, _Tp,
- memory_order = memory_order_seq_cst) noexcept;
+ compare_exchange_strong(_Tp& __e, _Tp __i,
+ memory_order __m = memory_order_seq_cst) noexcept
+ { return compare_exchange_strong(__e, __i, __m, __m); }
bool
- compare_exchange_strong(_Tp&, _Tp,
- memory_order = memory_order_seq_cst) volatile noexcept;
+ compare_exchange_strong(_Tp& __e, _Tp __i,
+ memory_order __m = memory_order_seq_cst) volatile noexcept
+ { return compare_exchange_strong(__e, __i, __m, __m); }
};
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 3c41b483cd2..d7423433803 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -1686,14 +1686,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::complex<_Tp>
__complex_acosh(const std::complex<_Tp>& __z)
{
- std::complex<_Tp> __t((__z.real() - __z.imag())
- * (__z.real() + __z.imag()) - _Tp(1.0),
- _Tp(2.0) * __z.real() * __z.imag());
- __t = std::sqrt(__t);
- if (__z.real() < _Tp())
- __t = -__t;
-
- return std::log(__t + __z);
+ // Kahan's formula.
+ return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0)))
+ + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index 497b964833f..cc8779b40b3 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -955,6 +955,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_storage(__future_base::_S_allocate_result<_Res>(__a))
{ }
+ template<typename _Allocator>
+ promise(allocator_arg_t, const _Allocator&, promise&& __rhs)
+ : _M_future(std::move(__rhs._M_future)),
+ _M_storage(std::move(__rhs._M_storage))
+ { }
+
promise(const promise&) = delete;
~promise()
@@ -1047,6 +1053,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_storage(__future_base::_S_allocate_result<_Res&>(__a))
{ }
+ template<typename _Allocator>
+ promise(allocator_arg_t, const _Allocator&, promise&& __rhs)
+ : _M_future(std::move(__rhs._M_future)),
+ _M_storage(std::move(__rhs._M_storage))
+ { }
+
promise(const promise&) = delete;
~promise()
@@ -1122,6 +1134,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_storage(__future_base::_S_allocate_result<void>(__a))
{ }
+ template<typename _Allocator>
+ promise(allocator_arg_t, const _Allocator&, promise&& __rhs)
+ : _M_future(std::move(__rhs._M_future)),
+ _M_storage(std::move(__rhs._M_storage))
+ { }
+
promise(const promise&) = delete;
~promise()
@@ -1270,6 +1288,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return std::forward<_Tp>(__t); }
};
+ template<typename _Task, typename _Fn, bool
+ = is_same<_Task, typename remove_reference<_Fn>::type>::value>
+ struct __is_same_pkgdtask
+ { typedef void __type; };
+
+ template<typename _Task, typename _Fn>
+ struct __is_same_pkgdtask<_Task, _Fn, true>
+ { };
+
/// packaged_task
template<typename _Res, typename... _ArgTypes>
class packaged_task<_Res(_ArgTypes...)>
@@ -1281,13 +1308,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Construction and destruction
packaged_task() noexcept { }
- template<typename _Fn>
+ template<typename _Allocator>
+ explicit
+ packaged_task(allocator_arg_t, const _Allocator& __a) noexcept
+ { }
+
+ template<typename _Fn, typename = typename
+ __is_same_pkgdtask<packaged_task, _Fn>::__type>
explicit
packaged_task(_Fn&& __fn)
: _M_state(std::make_shared<_State_type>(std::forward<_Fn>(__fn)))
{ }
- template<typename _Fn, typename _Allocator>
+ template<typename _Fn, typename _Allocator, typename = typename
+ __is_same_pkgdtask<packaged_task, _Fn>::__type>
explicit
packaged_task(allocator_arg_t, const _Allocator& __a, _Fn&& __fn)
: _M_state(std::allocate_shared<_State_type>(__a,
@@ -1301,13 +1335,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
// No copy
- packaged_task(packaged_task&) = delete;
- packaged_task& operator=(packaged_task&) = delete;
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
+
+ template<typename _Allocator>
+ explicit
+ packaged_task(allocator_arg_t, const _Allocator&,
+ const packaged_task&) = delete;
// Move support
packaged_task(packaged_task&& __other) noexcept
{ this->swap(__other); }
+ template<typename _Allocator>
+ explicit
+ packaged_task(allocator_arg_t, const _Allocator&,
+ packaged_task&& __other) noexcept
+ { this->swap(__other); }
+
packaged_task& operator=(packaged_task&& __other) noexcept
{
packaged_task(std::move(__other)).swap(*this);
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 4d154ff6f0c..bc2675b2b68 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -760,11 +760,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
private:
typedef __gthread_once_t __native_type;
- __native_type _M_once;
+ __native_type _M_once = __GTHREAD_ONCE_INIT;
public:
/// Constructor
- constexpr once_flag() noexcept : _M_once(__GTHREAD_ONCE_INIT) { }
+ constexpr once_flag() noexcept = default;
/// Deleted copy constructor
once_flag(const once_flag&) = delete;
@@ -796,7 +796,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__get_once_mutex();
#endif
- extern "C" void __once_proxy();
+ extern "C" void __once_proxy(void);
/// call_once
template<typename _Callable, typename... _Args>
diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex
index d831eeb0146..689ea167ba2 100644
--- a/libstdc++-v3/include/tr1/complex
+++ b/libstdc++-v3/include/tr1/complex
@@ -185,14 +185,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::complex<_Tp>
__complex_acosh(const std::complex<_Tp>& __z)
{
- std::complex<_Tp> __t((__z.real() - __z.imag())
- * (__z.real() + __z.imag()) - _Tp(1.0),
- _Tp(2.0) * __z.real() * __z.imag());
- __t = std::sqrt(__t);
- if (__z.real() < _Tp())
- __t = -__t;
-
- return std::log(__t + __z);
+ // Kahan's formula.
+ return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0)))
+ + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0))));
}
#if _GLIBCXX_USE_C99_COMPLEX_TR1
diff --git a/libstdc++-v3/include/tr2/bool_set b/libstdc++-v3/include/tr2/bool_set
index fe322675991..f577ed0c76c 100644
--- a/libstdc++-v3/include/tr2/bool_set
+++ b/libstdc++-v3/include/tr2/bool_set
@@ -26,16 +26,6 @@
* This is a TR2 C++ Library header.
*/
-//
-// Sort of an implementation of bool_set in n2136 Hervé Brönnimann,
-// Guillaume Melquiond, Sylvain Pion.
-//
-// The implicit conversion to bool is slippery! I may use the new
-// explicit conversion. This has been specialized in the language so
-// that in contexts requiring a bool the conversion happens
-// implicitly. Thus most objections should be eliminated.
-//
-
#ifndef _GLIBCXX_TR2_BOOL_SET
#define _GLIBCXX_TR2_BOOL_SET 1
@@ -50,6 +40,17 @@ namespace tr2
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ /**
+ * bool_set
+ *
+ * See N2136, Bool_set: multi-valued logic
+ * by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion.
+ *
+ * The implicit conversion to bool is slippery! I may use the new
+ * explicit conversion. This has been specialized in the language
+ * so that in contexts requiring a bool the conversion happens
+ * implicitly. Thus most objections should be eliminated.
+ */
class bool_set
{
public:
@@ -60,7 +61,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Constructor from bool.
bool_set(bool __t) : _M_b(_Bool_set_val(__t)) { }
- ///
// I'm not sure about this.
bool contains(bool_set __b) const
{ return this->is_singleton() && this->equals(__b); }
diff --git a/libstdc++-v3/include/tr2/dynamic_bitset b/libstdc++-v3/include/tr2/dynamic_bitset
index 5a4b7943bbe..b5c3bf3fcc8 100644
--- a/libstdc++-v3/include/tr2/dynamic_bitset
+++ b/libstdc++-v3/include/tr2/dynamic_bitset
@@ -120,11 +120,11 @@ public:
}
void
- _M_assign(const __dynamic_bitset_base<block_type, allocator_type>& __b)
+ _M_assign(const __dynamic_bitset_base& __b)
{ this->_M_w = __b._M_w; }
void
- _M_swap(__dynamic_bitset_base<block_type, allocator_type>& __b)
+ _M_swap(__dynamic_bitset_base& __b)
{ this->_M_w.swap(__b._M_w); }
void
@@ -178,7 +178,7 @@ public:
{ return this->_M_w[_M_w.size() - 1]; }
void
- _M_do_and(const __dynamic_bitset_base<block_type, allocator_type>& __x)
+ _M_do_and(const __dynamic_bitset_base& __x)
{
if (__x._M_w.size() == this->_M_w.size())
for (size_t __i = 0; __i < this->_M_w.size(); ++__i)
@@ -188,7 +188,7 @@ public:
}
void
- _M_do_or(const __dynamic_bitset_base<block_type, allocator_type>& __x)
+ _M_do_or(const __dynamic_bitset_base& __x)
{
if (__x._M_w.size() == this->_M_w.size())
for (size_t __i = 0; __i < this->_M_w.size(); ++__i)
@@ -198,7 +198,7 @@ public:
}
void
- _M_do_xor(const __dynamic_bitset_base<block_type, allocator_type>& __x)
+ _M_do_xor(const __dynamic_bitset_base& __x)
{
if (__x._M_w.size() == this->_M_w.size())
for (size_t __i = 0; __i < this->_M_w.size(); ++__i)
@@ -208,7 +208,7 @@ public:
}
void
- _M_do_dif(const __dynamic_bitset_base<block_type, allocator_type>& __x)
+ _M_do_dif(const __dynamic_bitset_base& __x)
{
if (__x._M_w.size() == this->_M_w.size())
for (size_t __i = 0; __i < this->_M_w.size(); ++__i)
@@ -245,7 +245,7 @@ public:
}
bool
- _M_is_equal(const __dynamic_bitset_base<block_type, allocator_type>& __x) const
+ _M_is_equal(const __dynamic_bitset_base& __x) const
{
if (__x.size() == this->size())
{
@@ -259,7 +259,7 @@ public:
}
bool
- _M_is_less(const __dynamic_bitset_base<block_type, allocator_type>& __x) const
+ _M_is_less(const __dynamic_bitset_base& __x) const
{
if (__x.size() == this->size())
{
@@ -296,7 +296,7 @@ public:
}
bool
- _M_is_subset_of(const __dynamic_bitset_base<block_type, allocator_type>& __b)
+ _M_is_subset_of(const __dynamic_bitset_base& __b)
{
if (__b.size() == this->size())
{
@@ -310,7 +310,7 @@ public:
}
bool
- _M_is_proper_subset_of(const __dynamic_bitset_base<block_type, allocator_type>& __b) const
+ _M_is_proper_subset_of(const __dynamic_bitset_base& __b) const
{
if (this->is_subset_of(__b))
{
@@ -387,7 +387,7 @@ public:
this->_M_w[__wshift] = this->_M_w[0] << __offset;
}
- ////std::fill(this->_M_w.begin(), this->_M_w.begin() + __wshift,
+ //// std::fill(this->_M_w.begin(), this->_M_w.begin() + __wshift,
//// static_cast<_WordT>(0));
}
}
diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits
index 73edf1137e4..4ec41181047 100644
--- a/libstdc++-v3/include/tr2/type_traits
+++ b/libstdc++-v3/include/tr2/type_traits
@@ -43,19 +43,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @defgroup metaprogramming Type Traits
* @ingroup utilities
*
- * Compile time type transformation and information.
* @{
*/
+ /**
+ * See N2965: Type traits and base classes
+ * by Michael Spertus
+ */
+
+ /**
+ * Simple typelist. Compile-time list of types.
+ */
template<typename... _Elements>
struct typelist;
+ /// Specialization for an empty typelist.
template<>
struct typelist<>
{
typedef std::true_type empty;
};
+ /// Partial specialization.
template<typename _First, typename... _Rest>
struct typelist<_First, _Rest...>
{
@@ -72,23 +81,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
};
- // Sequence abstraction metafunctions default to looking in the type
+ /// Sequence abstraction metafunctions for manipulating a typelist.
+
+
+ /// Return the first type in a typelist.
template<typename _Tp>
struct first : public _Tp::first { };
+ /// Return the typelist minus the first type.
template<typename _Tp>
struct rest : public _Tp::rest { };
+ /// Query to see if a typelist is empty.
template<typename _Tp>
struct empty : public _Tp::empty { };
+ /// Enumerate all the base classes of a class. Form of a typelist.
template<typename _Tp>
struct bases
{
typedef typelist<__bases(_Tp)...> type;
};
+ /// Enumerate all the direct base classes of a class. Form of a typelist.
template<typename _Tp>
struct direct_bases
{