aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libstdc++-v3/include
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2014-09-02 15:29:57 -0700
committerRong Xu <xur@google.com>2014-09-02 15:29:57 -0700
commite97c99f15937e5762a973b25192aab824126a6d3 (patch)
tree7f0be3ff7c7d976af06887dc50accd68f7630a7f /gcc-4.9/libstdc++-v3/include
parentf1c18afafc2b321465ae6b07ede127095942d7dc (diff)
downloadtoolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.zip
toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.gz
toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.bz2
[gcc-4.9] Merge svn r214745 from google/gcc-4_9 branch.
Merge gcc-4_9 source r214745 from google/gcc-4_9 branch. Change-Id: Ie6fa0fd72f4b4eec3adc4db4bb922e652d1c2605
Diffstat (limited to 'gcc-4.9/libstdc++-v3/include')
-rw-r--r--gcc-4.9/libstdc++-v3/include/bits/atomic_base.h4
-rw-r--r--gcc-4.9/libstdc++-v3/include/bits/basic_string.h18
-rw-r--r--gcc-4.9/libstdc++-v3/include/bits/hashtable.h8
-rw-r--r--gcc-4.9/libstdc++-v3/include/experimental/string_view112
-rw-r--r--gcc-4.9/libstdc++-v3/include/experimental/string_view.tcc4
-rw-r--r--gcc-4.9/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp4
-rw-r--r--gcc-4.9/libstdc++-v3/include/ext/rope7
-rw-r--r--gcc-4.9/libstdc++-v3/include/std/condition_variable9
-rw-r--r--gcc-4.9/libstdc++-v3/include/std/future20
-rw-r--r--gcc-4.9/libstdc++-v3/include/std/mutex3
10 files changed, 108 insertions, 81 deletions
diff --git a/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h b/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h
index 242459a..1fc0ebb 100644
--- a/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h
+++ b/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h
@@ -675,10 +675,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Factored out to facilitate explicit specialization.
constexpr ptrdiff_t
- _M_type_size(ptrdiff_t __d) { return __d * sizeof(_PTp); }
+ _M_type_size(ptrdiff_t __d) const { return __d * sizeof(_PTp); }
constexpr ptrdiff_t
- _M_type_size(ptrdiff_t __d) volatile { return __d * sizeof(_PTp); }
+ _M_type_size(ptrdiff_t __d) const volatile { return __d * sizeof(_PTp); }
public:
__atomic_base() noexcept = default;
diff --git a/gcc-4.9/libstdc++-v3/include/bits/basic_string.h b/gcc-4.9/libstdc++-v3/include/bits/basic_string.h
index cd60376..93ceb6d 100644
--- a/gcc-4.9/libstdc++-v3/include/bits/basic_string.h
+++ b/gcc-4.9/libstdc++-v3/include/bits/basic_string.h
@@ -2811,7 +2811,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Alloc>& __str)
- { return getline(__is, __str, __is.widen('\n')); }
+ { return std::getline(__is, __str, __is.widen('\n')); }
+
+#if __cplusplus >= 201103L
+ /// Read a line from an rvalue stream into a string.
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>&& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim)
+ { return std::getline(__is, __str, __delim); }
+
+ /// Read a line from an rvalue stream into a string.
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>&& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str)
+ { return std::getline(__is, __str); }
+#endif
template<>
basic_istream<char>&
diff --git a/gcc-4.9/libstdc++-v3/include/bits/hashtable.h b/gcc-4.9/libstdc++-v3/include/bits/hashtable.h
index 9b6394c..588e69c 100644
--- a/gcc-4.9/libstdc++-v3/include/bits/hashtable.h
+++ b/gcc-4.9/libstdc++-v3/include/bits/hashtable.h
@@ -1281,10 +1281,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_H1, _H2, _Hash, _RehashPolicy, _Traits>::
__rehash_policy(const _RehashPolicy& __pol)
{
- size_type __n_bkt = __pol._M_bkt_for_elements(_M_element_count);
- __n_bkt = __pol._M_next_bkt(__n_bkt);
- if (__n_bkt != _M_bucket_count)
- _M_rehash(__n_bkt, _M_rehash_policy._M_state());
+ auto __do_rehash =
+ __pol._M_need_rehash(_M_bucket_count, _M_element_count, 0);
+ if (__do_rehash.first)
+ _M_rehash(__do_rehash.second, _M_rehash_policy._M_state());
_M_rehash_policy = __pol;
}
diff --git a/gcc-4.9/libstdc++-v3/include/experimental/string_view b/gcc-4.9/libstdc++-v3/include/experimental/string_view
index bebeb6b..49f46af 100644
--- a/gcc-4.9/libstdc++-v3/include/experimental/string_view
+++ b/gcc-4.9/libstdc++-v3/include/experimental/string_view
@@ -39,7 +39,6 @@
# include <bits/c++14_warning.h>
#else
-#include <debug/debug.h>
#include <string>
#include <limits>
@@ -66,18 +65,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* _CharT* _M_str
* size_t _M_len
* @endcode
- *
- * A basic_string_view represents an empty string with a static constexpr
- * length one string:
- *
- * @code
- * static constexpr value_type _S_empty_str[1]{0};
- * @endcode
*/
- template<typename _CharT, typename _Traits = char_traits<_CharT>>
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
class basic_string_view
{
-
public:
// types
@@ -99,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr
basic_string_view() noexcept
- : _M_len{0}, _M_str{_S_empty_str}
+ : _M_len{0}, _M_str{nullptr}
{ }
constexpr basic_string_view(const basic_string_view&) noexcept = default;
@@ -112,12 +103,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr basic_string_view(const _CharT* __str)
: _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
- _M_str{__str == nullptr ? _S_empty_str : __str}
+ _M_str{__str}
{ }
constexpr basic_string_view(const _CharT* __str, size_type __len)
- : _M_len{__str == nullptr ? 0 :__len},
- _M_str{__str == nullptr ? _S_empty_str : __str}
+ : _M_len{__len},
+ _M_str{__str}
{ }
basic_string_view&
@@ -143,19 +134,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const_reverse_iterator
rbegin() const noexcept
- { return std::reverse_iterator<const_iterator>(this->end()); }
+ { return const_reverse_iterator(this->end()); }
const_reverse_iterator
rend() const noexcept
- { return std::reverse_iterator<const_iterator>(this->begin()); }
+ { return const_reverse_iterator(this->begin()); }
const_reverse_iterator
crbegin() const noexcept
- { return std::reverse_iterator<const_iterator>(this->end()); }
+ { return const_reverse_iterator(this->end()); }
const_reverse_iterator
crend() const noexcept
- { return std::reverse_iterator<const_iterator>(this->begin()); }
+ { return const_reverse_iterator(this->begin()); }
// [string.view.capacity], capacity
@@ -169,8 +160,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr size_type
max_size() const noexcept
- { return ((npos - sizeof(size_type) - sizeof(void*))
- / sizeof(value_type) / 4); }
+ {
+ return (npos - sizeof(size_type) - sizeof(void*))
+ / sizeof(value_type) / 4;
+ }
constexpr bool
empty() const noexcept
@@ -195,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
"(which is %zu) >= this->size() "
"(which is %zu)"),
__pos, this->size()),
- _S_empty_str[0]);
+ *this->_M_str);
}
constexpr const _CharT&
@@ -219,11 +212,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return this->_M_str; }
// [string.view.modifiers], modifiers:
+
void
clear() noexcept
{
this->_M_len = 0;
- this->_M_str = _S_empty_str;
+ this->_M_str = nullptr;
}
void
@@ -251,8 +245,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Allocator>
explicit operator basic_string<_CharT, _Traits, _Allocator>() const
{
- return basic_string<_CharT, _Traits, _Allocator>
- (this->_M_len, this->_M_str);
+ return { this->_M_str, this->_M_len };
+ }
+
+ template<typename _Allocator = std::allocator<_CharT>>
+ basic_string<_CharT, _Traits, _Allocator>
+ to_string(const _Allocator& __alloc = _Allocator()) const
+ {
+ return { this->_M_str, this->_M_len, __alloc };
}
size_type
@@ -329,7 +329,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
find(_CharT __c, size_type __pos=0) const noexcept;
size_type
- find(const _CharT* __str, size_type __pos, size_type __n) const;
+ find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
size_type
find(const _CharT* __str, size_type __pos=0) const noexcept
@@ -343,7 +343,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
rfind(_CharT __c, size_type __pos = npos) const noexcept;
size_type
- rfind(const _CharT* __str, size_type __pos, size_type __n) const;
+ rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
size_type
rfind(const _CharT* __str, size_type __pos = npos) const noexcept
@@ -431,8 +431,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: static_cast<int>(difference_type{__n1 - __n2});
}
- static constexpr value_type _S_empty_str[1]{};
-
size_t _M_len;
const _CharT* _M_str;
};
@@ -456,131 +454,119 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator==(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator==(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator!=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator!=(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator< (basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator< (basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator> (basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator> (basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator<=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator<=(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator>=(basic_string_view<_CharT, _Traits> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator>=(basic_string_view<_CharT, _Traits> __x,
__detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
- bool
+ inline bool
operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
- // [string.view.comparison], sufficient additional overloads of comparison functions
-
- // [string.view.nonmem], other non-member basic_string_view functions
- template<typename _CharT, typename _Traits = char_traits<_CharT>,
- typename _Allocator = allocator<_CharT>>
- basic_string<_CharT, _Traits, _Allocator>
- to_string(basic_string_view<_CharT, _Traits> __str,
- const _Allocator& __alloc = _Allocator())
- {
- return basic_string<_CharT, _Traits, _Allocator>
- (__str.begin(), __str.end(), __alloc);
- }
-
+ // [string.view.io], Inserters and extractors
template<typename _CharT, typename _Traits>
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os,
- basic_string_view<_CharT,_Traits> __str)
- { return __ostream_insert(__os, __str.data(), __str.size()); }
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os,
+ basic_string_view<_CharT,_Traits> __str)
+ { return __ostream_insert(__os, __str.data(), __str.size()); }
// basic_string_view typedef names
diff --git a/gcc-4.9/libstdc++-v3/include/experimental/string_view.tcc b/gcc-4.9/libstdc++-v3/include/experimental/string_view.tcc
index 1af3a4d..4456266 100644
--- a/gcc-4.9/libstdc++-v3/include/experimental/string_view.tcc
+++ b/gcc-4.9/libstdc++-v3/include/experimental/string_view.tcc
@@ -47,10 +47,6 @@ namespace experimental
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits>
- constexpr _CharT
- basic_string_view<_CharT, _Traits>::_S_empty_str[1];
-
- template<typename _CharT, typename _Traits>
typename basic_string_view<_CharT, _Traits>::size_type
basic_string_view<_CharT, _Traits>::
find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
diff --git a/gcc-4.9/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp b/gcc-4.9/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
index d97b432..7ada365 100644
--- a/gcc-4.9/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
+++ b/gcc-4.9/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
@@ -55,7 +55,7 @@ namespace __gnu_pbds
class Cmp_Fn,
template<typename Node_CItr,
class Node_Itr,
- class Cmp_Fn,
+ class _Cmp_Fn,
typename _Alloc>
class Node_Update,
class Node,
@@ -161,7 +161,7 @@ namespace __gnu_pbds
class Cmp_Fn,
template<typename Node_CItr,
class Node_Itr,
- class Cmp_Fn,
+ class _Cmp_Fn,
typename _Alloc>
class Node_Update,
class Node,
diff --git a/gcc-4.9/libstdc++-v3/include/ext/rope b/gcc-4.9/libstdc++-v3/include/ext/rope
index df3d4bb..147b335 100644
--- a/gcc-4.9/libstdc++-v3/include/ext/rope
+++ b/gcc-4.9/libstdc++-v3/include/ext/rope
@@ -1544,7 +1544,7 @@ protected:
typedef typename _Base::allocator_type allocator_type;
using _Base::_M_tree_ptr;
using _Base::get_allocator;
- using _Base::_M_get_allocator;
+ using _Base::_M_get_allocator;
typedef __GC_CONST _CharT* _Cstrptr;
static _CharT _S_empty_c_str[1];
@@ -1876,8 +1876,9 @@ protected:
const allocator_type& __a = allocator_type())
: _Base(__a)
{
- this->_M_tree_ptr = (0 == __len) ?
- 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
+ this->_M_tree_ptr = (0 == __len)
+ ? 0
+ : _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator());
}
rope(const rope& __x, const allocator_type& __a = allocator_type())
diff --git a/gcc-4.9/libstdc++-v3/include/std/condition_variable b/gcc-4.9/libstdc++-v3/include/std/condition_variable
index fc111dd..921cb83 100644
--- a/gcc-4.9/libstdc++-v3/include/std/condition_variable
+++ b/gcc-4.9/libstdc++-v3/include/std/condition_variable
@@ -189,7 +189,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~_Unlock() noexcept(false)
{
if (uncaught_exception())
- __try { _M_lock.lock(); } __catch(...) { }
+ {
+ __try
+ { _M_lock.lock(); }
+ __catch(const __cxxabiv1::__forced_unwind&)
+ { __throw_exception_again; }
+ __catch(...)
+ { }
+ }
else
_M_lock.lock();
}
diff --git a/gcc-4.9/libstdc++-v3/include/std/future b/gcc-4.9/libstdc++-v3/include/std/future
index 998e90a..d446b9d 100644
--- a/gcc-4.9/libstdc++-v3/include/std/future
+++ b/gcc-4.9/libstdc++-v3/include/std/future
@@ -1240,6 +1240,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
_M_result->_M_set(_M_fn());
}
+ __catch(const __cxxabiv1::__forced_unwind&)
+ {
+ __throw_exception_again; // will cause broken_promise
+ }
__catch(...)
{
_M_result->_M_error = current_exception();
@@ -1259,6 +1263,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
_M_fn();
}
+ __catch(const __cxxabiv1::__forced_unwind&)
+ {
+ __throw_exception_again; // will cause broken_promise
+ }
__catch(...)
{
_M_result->_M_error = current_exception();
@@ -1519,7 +1527,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _M_result(new _Result<_Res>()), _M_fn(std::move(__fn))
{
_M_thread = std::thread{ [this] {
- _M_set_result(_S_task_setter(_M_result, _M_fn));
+ __try
+ {
+ _M_set_result(_S_task_setter(_M_result, _M_fn));
+ }
+ __catch (const __cxxabiv1::__forced_unwind&)
+ {
+ // make the shared state ready on thread cancellation
+ if (static_cast<bool>(_M_result))
+ this->_M_break_promise(std::move(_M_result));
+ __throw_exception_again;
+ }
} };
}
diff --git a/gcc-4.9/libstdc++-v3/include/std/mutex b/gcc-4.9/libstdc++-v3/include/std/mutex
index 0b481d6..8e9dd27 100644
--- a/gcc-4.9/libstdc++-v3/include/std/mutex
+++ b/gcc-4.9/libstdc++-v3/include/std/mutex
@@ -44,6 +44,7 @@
#include <bits/functexcept.h>
#include <bits/gthr.h>
#include <bits/move.h> // for std::swap
+#include <bits/cxxabi_forced.h>
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
@@ -649,6 +650,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
auto __locks = std::tie(__l1, __l2, __l3...);
__try
{ __try_lock_impl<0>::__do_try_lock(__locks, __idx); }
+ __catch(const __cxxabiv1::__forced_unwind&)
+ { __throw_exception_again; }
__catch(...)
{ }
return __idx;