aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libstdc++-v3
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
parentf1c18afafc2b321465ae6b07ede127095942d7dc (diff)
downloadtoolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.gz
toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.bz2
toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.zip
[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')
-rw-r--r--gcc-4.9/libstdc++-v3/ChangeLog111
-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
-rw-r--r--gcc-4.9/libstdc++-v3/libsupc++/atexit_thread.cc6
-rw-r--r--gcc-4.9/libstdc++-v3/python/libstdcxx/v6/printers.py120
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/12.cc38
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/12.cc38
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/61667.cc44
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc15
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/async/forced_unwind.cc45
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/packaged_task/forced_unwind.cc48
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc7
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc7
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc3
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc3
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc5
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc5
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc53
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc23
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/ext/rope/61946.cc31
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/lib/gdb-test.exp4
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/util/testsuite_iterators.h2
30 files changed, 650 insertions, 147 deletions
diff --git a/gcc-4.9/libstdc++-v3/ChangeLog b/gcc-4.9/libstdc++-v3/ChangeLog
index 09b7017cd..4e7f236d8 100644
--- a/gcc-4.9/libstdc++-v3/ChangeLog
+++ b/gcc-4.9/libstdc++-v3/ChangeLog
@@ -1,3 +1,114 @@
+2014-08-26 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from mainline
+ 2014-08-12 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/basic_string.h (getline): Qualify call to prevent ADL
+ and add overloads for rvalue streams.
+ * testsuite/21_strings/basic_string/inserters_extractors/char/12.cc:
+ New.
+ * testsuite/21_strings/basic_string/inserters_extractors/wchar_t/12.cc:
+ New.
+
+2014-08-26 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/62264
+ * include/experimental/string_view: Fix inconsistent exception specs.
+
+2014-08-09 François Dumont <fdumont@gcc.gnu.org>
+
+ PR libstdc++/61667
+ * include/bits/hashtable.h (_Hashtable<>::__rehash_policy): Use
+ _M_need_rehash to initialize the rehash policy and check if a rehash is
+ needed.
+ * testsuite/23_containers/unordered_map/modifiers/61667.cc: New.
+
+2014-08-04 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from mainline
+ 2014-07-29 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/61946
+ * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool,
+ const allocator_type&)): Pass non-const allocator to
+ _S_new_RopeFunction.
+ * testsuite/ext/rope/61946.cc: New.
+
+2014-08-04 Zifei Tong <zifeitong@gmail.com>
+
+ * libsupc++/atexit_thread.cc (HAVE___CXA_THREAD_ATEXIT_IMPL): Add
+ _GLIBCXX_ prefix to macro.
+
+2014-08-04 Samuel Bronson <naesten@gmail.com>
+
+ Backport r212453 from trunk
+ 2014-07-11 Samuel Bronson <naesten@gmail.com>
+ Matthias Klose <doko@ubuntu.com>
+
+ PR libstdc++/58962
+ * python/libstdcxx/v6/printers.py: Port to Python 2+3
+ (imap): New compat function.
+ (izip): Likewise.
+ (Iterator): New mixin to allow writing iterators in Python 3 style
+ regardless of which version we're running on.
+ [Python3] (long) New compat alias for "int".
+ * testsuite/lib/gdb-test.exp: Port to Python 2+3 (print syntax)
+
+ Backport r210625 from trunk
+ 2014-05-19 Jonathan Wakely <jwakely@redhat.com>
+
+ * python/libstdcxx/v6/printers.py: Use Python3 raise syntax.
+
+2014-08-04 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from mainline
+ 2014-06-10 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/61390
+ * include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
+ (bin_search_tree_traits): Do not redeclare template-parameters.
+ * testsuite/util/testsuite_iterators.h (test_container): Likewise.
+
+ Backported from mainline
+ 2014-06-02 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/std/condition_variable (condition_variable_any::_Unlock): Do
+ not swallow __forced_unwind.
+ * include/std/future (__future_base::_Task_setter): Likewise.
+ (__future_base::_Async_state_impl): Turn __forced_unwind into broken
+ promise and rethrow.
+ * include/std/mutex (try_lock): Likewise.
+ * testsuite/30_threads/async/forced_unwind.cc: New.
+ * testsuite/30_threads/packaged_task/forced_unwind.cc: New.
+
+ Backported from mainline
+ 2014-06-01 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/61374
+ * include/experimental/string_view (operator basic_string): Correct
+ order of arguments.
+ (to_string): Replace with member function.
+ Add inline specifiers. Remove unused header. Remove _S_empty_rep and
+ allow _M_str to be null.
+ * testsuite/experimental/string_view/cons/char/1.cc: Adjust to new
+ default constructor semantics.
+ * testsuite/experimental/string_view/cons/wchar_t/1.cc: Likewise.
+ * testsuite/experimental/string_view/operations/copy/char/1.cc: Fix
+ copyright dates. Remove unused header.
+ * testsuite/experimental/string_view/operations/copy/wchar_t/1.cc:
+ Likewise.
+ * testsuite/experimental/string_view/operations/data/char/1.cc:
+ Fix copyright dates. Adjust to new default constructor semantics.
+ * testsuite/experimental/string_view/operations/data/wchar_t/1.cc:
+ Likewise.
+ * testsuite/experimental/string_view/operations/to_string/1.cc: New.
+
+ Backported from mainline
+ 2014-04-15 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/atomic_base.h (__atomic_base<_PTp*>::_M_type_size): Add
+ const to constexpr member functions.
+
2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
PR libstdc++/60037 - SIGFPE in std::generate_canonical<unsigned int...>
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 242459ad0..1fc0ebb7e 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 cd6037677..93ceb6dae 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 9b6394c4e..588e69c9d 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 bebeb6b62..49f46af54 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 1af3a4d9b..44562665a 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 d97b4326a..7ada3656d 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 df3d4bb31..147b335a8 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 fc111dd3d..921cb837d 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 998e90a98..d446b9d55 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 0b481d609..8e9dd27e2 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;
diff --git a/gcc-4.9/libstdc++-v3/libsupc++/atexit_thread.cc b/gcc-4.9/libstdc++-v3/libsupc++/atexit_thread.cc
index db2020002..dff08e924 100644
--- a/gcc-4.9/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/gcc-4.9/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -26,7 +26,7 @@
#include <new>
#include "bits/gthr.h"
-#if HAVE___CXA_THREAD_ATEXIT_IMPL
+#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
extern "C" int __cxa_thread_atexit_impl (void (*func) (void *),
void *arg, void *d);
@@ -38,7 +38,7 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
return __cxa_thread_atexit_impl (dtor, obj, dso_handle);
}
-#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#else /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
namespace {
// One element in a singly-linked stack of cleanups.
@@ -142,4 +142,4 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
return 0;
}
-#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
diff --git a/gcc-4.9/libstdc++-v3/python/libstdcxx/v6/printers.py b/gcc-4.9/libstdc++-v3/python/libstdcxx/v6/printers.py
index 1f1f860a5..1fa08fbd5 100644
--- a/gcc-4.9/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/gcc-4.9/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1,4 +1,4 @@
-# Pretty-printers for libstc++.
+# Pretty-printers for libstdc++.
# Copyright (C) 2008-2014 Free Software Foundation, Inc.
@@ -18,6 +18,50 @@
import gdb
import itertools
import re
+import sys
+
+### Python 2 + Python 3 compatibility code
+
+# Resources about compatibility:
+#
+# * <http://pythonhosted.org/six/>: Documentation of the "six" module
+
+# FIXME: The handling of e.g. std::basic_string (at least on char)
+# probably needs updating to work with Python 3's new string rules.
+#
+# In particular, Python 3 has a separate type (called byte) for
+# bytestrings, and a special b"" syntax for the byte literals; the old
+# str() type has been redefined to always store Unicode text.
+#
+# We probably can't do much about this until this GDB PR is addressed:
+# <https://sourceware.org/bugzilla/show_bug.cgi?id=17138>
+
+if sys.version_info[0] > 2:
+ ### Python 3 stuff
+ Iterator = object
+ # Python 3 folds these into the normal functions.
+ imap = map
+ izip = zip
+ # Also, int subsumes long
+ long = int
+else:
+ ### Python 2 stuff
+ class Iterator:
+ """Compatibility mixin for iterators
+
+ Instead of writing next() methods for iterators, write
+ __next__() methods and use this mixin to make them work in
+ Python 2 as well as Python 3.
+
+ Idea stolen from the "six" documentation:
+ <http://pythonhosted.org/six/#six.Iterator>
+ """
+
+ def next(self):
+ return self.__next__()
+
+ # In Python 2, we still need these from itertools
+ from itertools import imap, izip
# Try to use the new-style pretty-printing if available.
_use_gdb_pp = True
@@ -51,7 +95,7 @@ def find_type(orig, name):
# anything fancier here.
field = typ.fields()[0]
if not field.is_base_class:
- raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
+ raise ValueError("Cannot find type %s::%s" % (str(orig), name))
typ = field.type
class SharedPointerPrinter:
@@ -87,7 +131,7 @@ class UniquePointerPrinter:
class StdListPrinter:
"Print a std::list"
- class _iterator:
+ class _iterator(Iterator):
def __init__(self, nodetype, head):
self.nodetype = nodetype
self.base = head['_M_next']
@@ -97,7 +141,7 @@ class StdListPrinter:
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.base == self.head:
raise StopIteration
elt = self.base.cast(self.nodetype).dereference()
@@ -135,7 +179,7 @@ class StdListIteratorPrinter:
class StdSlistPrinter:
"Print a __gnu_cxx::slist"
- class _iterator:
+ class _iterator(Iterator):
def __init__(self, nodetype, head):
self.nodetype = nodetype
self.base = head['_M_head']['_M_next']
@@ -144,7 +188,7 @@ class StdSlistPrinter:
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.base == 0:
raise StopIteration
elt = self.base.cast(self.nodetype).dereference()
@@ -180,7 +224,7 @@ class StdSlistIteratorPrinter:
class StdVectorPrinter:
"Print a std::vector"
- class _iterator:
+ class _iterator(Iterator):
def __init__ (self, start, finish, bitvec):
self.bitvec = bitvec
if bitvec:
@@ -198,7 +242,7 @@ class StdVectorPrinter:
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
count = self.count
self.count = self.count + 1
if self.bitvec:
@@ -265,7 +309,7 @@ class StdVectorIteratorPrinter:
class StdTuplePrinter:
"Print a std::tuple"
- class _iterator:
+ class _iterator(Iterator):
def __init__ (self, head):
self.head = head
@@ -276,20 +320,20 @@ class StdTuplePrinter:
# Set the actual head to the first pair.
self.head = self.head.cast (nodes[0].type)
elif len (nodes) != 0:
- raise ValueError, "Top of tuple tree does not consist of a single node."
+ raise ValueError("Top of tuple tree does not consist of a single node.")
self.count = 0
def __iter__ (self):
return self
- def next (self):
+ def __next__ (self):
nodes = self.head.type.fields ()
# Check for further recursions in the inheritance tree.
if len (nodes) == 0:
raise StopIteration
# Check that this iteration has an expected structure.
if len (nodes) != 2:
- raise ValueError, "Cannot parse more than 2 nodes in a tuple tree."
+ raise ValueError("Cannot parse more than 2 nodes in a tuple tree.")
# - Left node is the next recursion parent.
# - Right node is the actual class contained in the tuple.
@@ -341,7 +385,7 @@ class StdStackOrQueuePrinter:
return self.visualizer.display_hint ()
return None
-class RbtreeIterator:
+class RbtreeIterator(Iterator):
def __init__(self, rbtree):
self.size = rbtree['_M_t']['_M_impl']['_M_node_count']
self.node = rbtree['_M_t']['_M_impl']['_M_header']['_M_left']
@@ -353,7 +397,7 @@ class RbtreeIterator:
def __len__(self):
return int (self.size)
- def next(self):
+ def __next__(self):
if self.count == self.size:
raise StopIteration
result = self.node
@@ -389,7 +433,7 @@ def get_value_from_Rb_tree_node(node):
return p.dereference()
except:
pass
- raise ValueError, "Unsupported implementation for %s" % str(node.type)
+ raise ValueError("Unsupported implementation for %s" % str(node.type))
# This is a pretty printer for std::_Rb_tree_iterator (which is
# std::map::iterator), and has nothing to do with the RbtreeIterator
@@ -422,7 +466,7 @@ class StdMapPrinter:
"Print a std::map or std::multimap"
# Turn an RbtreeIterator into a pretty-print iterator.
- class _iter:
+ class _iter(Iterator):
def __init__(self, rbiter, type):
self.rbiter = rbiter
self.count = 0
@@ -431,9 +475,9 @@ class StdMapPrinter:
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.count % 2 == 0:
- n = self.rbiter.next()
+ n = next(self.rbiter)
n = n.cast(self.type).dereference()
n = get_value_from_Rb_tree_node(n)
self.pair = n
@@ -465,7 +509,7 @@ class StdSetPrinter:
"Print a std::set or std::multiset"
# Turn an RbtreeIterator into a pretty-print iterator.
- class _iter:
+ class _iter(Iterator):
def __init__(self, rbiter, type):
self.rbiter = rbiter
self.count = 0
@@ -474,8 +518,8 @@ class StdSetPrinter:
def __iter__(self):
return self
- def next(self):
- item = self.rbiter.next()
+ def __next__(self):
+ item = next(self.rbiter)
item = item.cast(self.type).dereference()
item = get_value_from_Rb_tree_node(item)
# FIXME: this is weird ... what to do?
@@ -541,7 +585,7 @@ class StdBitsetPrinter:
class StdDequePrinter:
"Print a std::deque"
- class _iter:
+ class _iter(Iterator):
def __init__(self, node, start, end, last, buffer_size):
self.node = node
self.p = start
@@ -553,7 +597,7 @@ class StdDequePrinter:
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.p == self.last:
raise StopIteration
@@ -638,7 +682,7 @@ class StdStringPrinter:
def display_hint (self):
return 'string'
-class Tr1HashtableIterator:
+class Tr1HashtableIterator(Iterator):
def __init__ (self, hash):
self.buckets = hash['_M_buckets']
self.bucket = 0
@@ -654,7 +698,7 @@ class Tr1HashtableIterator:
def __iter__ (self):
return self
- def next (self):
+ def __next__ (self):
if self.node == 0:
raise StopIteration
node = self.node.cast(self.node_type)
@@ -669,7 +713,7 @@ class Tr1HashtableIterator:
self.bucket = self.bucket + 1
return result
-class StdHashtableIterator:
+class StdHashtableIterator(Iterator):
def __init__(self, hash):
self.node = hash['_M_before_begin']['_M_nxt']
self.node_type = find_type(hash.type, '__node_type').pointer()
@@ -677,7 +721,7 @@ class StdHashtableIterator:
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.node == 0:
raise StopIteration
elt = self.node.cast(self.node_type).dereference()
@@ -706,10 +750,10 @@ class Tr1UnorderedSetPrinter:
return '[%d]' % i
def children (self):
- counter = itertools.imap (self.format_count, itertools.count())
+ counter = imap (self.format_count, itertools.count())
if self.typename.startswith('std::tr1'):
- return itertools.izip (counter, Tr1HashtableIterator (self.hashtable()))
- return itertools.izip (counter, StdHashtableIterator (self.hashtable()))
+ return izip (counter, Tr1HashtableIterator (self.hashtable()))
+ return izip (counter, StdHashtableIterator (self.hashtable()))
class Tr1UnorderedMapPrinter:
"Print a tr1::unordered_map"
@@ -741,15 +785,15 @@ class Tr1UnorderedMapPrinter:
return '[%d]' % i
def children (self):
- counter = itertools.imap (self.format_count, itertools.count())
+ counter = imap (self.format_count, itertools.count())
# Map over the hash table and flatten the result.
if self.typename.startswith('std::tr1'):
- data = self.flatten (itertools.imap (self.format_one, Tr1HashtableIterator (self.hashtable())))
+ data = self.flatten (imap (self.format_one, Tr1HashtableIterator (self.hashtable())))
# Zip the two iterators together.
- return itertools.izip (counter, data)
- data = self.flatten (itertools.imap (self.format_one, StdHashtableIterator (self.hashtable())))
+ return izip (counter, data)
+ data = self.flatten (imap (self.format_one, StdHashtableIterator (self.hashtable())))
# Zip the two iterators together.
- return itertools.izip (counter, data)
+ return izip (counter, data)
def display_hint (self):
@@ -758,7 +802,7 @@ class Tr1UnorderedMapPrinter:
class StdForwardListPrinter:
"Print a std::forward_list"
- class _iterator:
+ class _iterator(Iterator):
def __init__(self, nodetype, head):
self.nodetype = nodetype
self.base = head['_M_next']
@@ -767,7 +811,7 @@ class StdForwardListPrinter:
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.base == 0:
raise StopIteration
elt = self.base.cast(self.nodetype).dereference()
@@ -827,7 +871,7 @@ class Printer(object):
# A small sanity check.
# FIXME
if not self.compiled_rx.match(name + '<>'):
- raise ValueError, 'libstdc++ programming error: "%s" does not match' % name
+ raise ValueError('libstdc++ programming error: "%s" does not match' % name)
printer = RxPrinter(name, function)
self.subprinters.append(printer)
self.lookup[name] = printer
diff --git a/gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/12.cc b/gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/12.cc
new file mode 100644
index 000000000..a0dda5f63
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/12.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::string s;
+ getline(std::istringstream("First line\nSecond line\n"), s);
+ VERIFY( s == "First line" );
+ getline(std::istringstream("Third line\nFourth line\n"), s, 'r');
+ VERIFY( s == "Thi" );
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/12.cc b/gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/12.cc
new file mode 100644
index 000000000..db20c0293
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/12.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::wstring s;
+ getline(std::wistringstream(L"First line\nSecond line\n"), s);
+ VERIFY( s == L"First line" );
+ getline(std::wistringstream(L"Third line\nFourth line\n"), s, L'r');
+ VERIFY( s == L"Thi" );
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/61667.cc b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/61667.cc
new file mode 100644
index 000000000..cb4ad8ecb
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/61667.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2011-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+ std::unordered_map<int, int> um(20);
+
+ std::size_t bkt_count = um.bucket_count();
+
+ um.max_load_factor(um.max_load_factor());
+
+ VERIFY( um.bucket_count() >= bkt_count );
+
+ um.max_load_factor(um.max_load_factor() * 2.f);
+
+ VERIFY( um.bucket_count() >= bkt_count );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc b/gcc-4.9/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc
new file mode 100644
index 000000000..11d553910
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+#include <random>
+
+std::mt19937 urng;
+
+std::__detail::_Adaptor<std::mt19937, unsigned long> aurng(urng);
+
+auto x = std::generate_canonical<std::size_t,
+ std::numeric_limits<std::size_t>::digits>(urng);
+
+// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 167 }
+
+// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 3466 }
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/async/forced_unwind.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/async/forced_unwind.cc
new file mode 100644
index 000000000..7b0a49280
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/async/forced_unwind.cc
@@ -0,0 +1,45 @@
+// { dg-do run { target *-*-linux* *-*-gnu* } }
+// { dg-options " -std=gnu++11 -pthread" { target *-*-linux* *-*-gnu* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Test (non-standard) handling of __forced_unwind exception.
+
+#include <future>
+#include <stdexcept>
+#include <pthread.h>
+#include <testsuite_hooks.h>
+
+void f() { pthread_exit(nullptr); }
+
+int main()
+{
+ auto fut = std::async(std::launch::async, f);
+ try
+ {
+ fut.get();
+ throw std::logic_error("Unreachable");
+ }
+ catch (const std::future_error& e)
+ {
+ VERIFY( e.code() == std::future_errc::broken_promise );
+ }
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/packaged_task/forced_unwind.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/packaged_task/forced_unwind.cc
new file mode 100644
index 000000000..235ab178f
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/packaged_task/forced_unwind.cc
@@ -0,0 +1,48 @@
+// { dg-do run { target *-*-linux* *-*-gnu* } }
+// { dg-options " -std=gnu++11 -pthread" { target *-*-linux* *-*-gnu* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Test (non-standard) handling of __forced_unwind exception.
+
+#include <future>
+#include <stdexcept>
+#include <pthread.h>
+#include <testsuite_hooks.h>
+
+void f() { pthread_exit(nullptr); }
+
+int main()
+{
+ std::packaged_task<void()> p(f);
+ auto fut = p.get_future();
+ std::thread t(std::move(p));
+ try
+ {
+ fut.get();
+ throw std::logic_error("Unreachable");
+ }
+ catch (const std::future_error& e)
+ {
+ VERIFY( e.code() == std::future_errc::broken_promise );
+ }
+ t.join();
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
index c879cc7e0..a443b0ac7 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
+++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
@@ -33,7 +33,7 @@ test01()
// basic_string_view()
const std::experimental::string_view str00{};
VERIFY( str00.length() == 0 );
- VERIFY( str00.data() != nullptr );
+ VERIFY( str00.data() == nullptr );
// basic_string_view(const char*)
const char str_lit01[] = "rodeo beach, marin";
@@ -54,11 +54,6 @@ test01()
VERIFY( str05.length() == len_lit01 );
VERIFY( str05.data() == str_lit01 );
- // basic_string_view(const char* s, std::size_t l)
- std::experimental::string_view str06{nullptr, len_lit01};
- VERIFY( str06.length() == 0 );
- VERIFY( str06.data() != nullptr );
-
// basic_string_view(basic_string& s)
std::string istr07(10, 'z');
std::experimental::string_view str07{istr07};
diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
index 12db72f28..9ba9b84a1 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
+++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
@@ -33,7 +33,7 @@ test01()
// basic_string_view()
const std::experimental::wstring_view str00{};
VERIFY( str00.length() == 0 );
- VERIFY( str00.data() != nullptr );
+ VERIFY( str00.data() == nullptr );
// basic_string_view(const char*)
const wchar_t str_lit01[] = L"rodeo beach, marin";
@@ -54,11 +54,6 @@ test01()
VERIFY( str05.length() == len_lit01 );
VERIFY( str05.data() == str_lit01 );
- // basic_string_view(const wchar_t* s, std::size_t l)
- std::experimental::wstring_view str06{nullptr, len_lit01};
- VERIFY( str06.length() == 0 );
- VERIFY( str06.data() != nullptr );
-
// basic_string_view(basic_string& s)
std::wstring istr07(10, L'z');
std::experimental::wstring_view str07{istr07};
diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
index 25b2af133..d0f3e8d69 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
+++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++1y" }
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -20,7 +20,6 @@
// basic_string_view::copy
#include <experimental/string_view>
-#include <stdexcept>
#include <testsuite_hooks.h>
bool
diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc
index 0348e1f98..bf3f14b14 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc
+++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++1y" }
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -20,7 +20,6 @@
// basic_string_view::copy
#include <experimental/string_view>
-#include <stdexcept>
#include <testsuite_hooks.h>
bool
diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
index be75de917..a34492606 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
+++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++1y" }
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -29,10 +29,9 @@ test01()
std::experimental::string_view empty;
- // data() for size == 0 is non-NULL.
VERIFY( empty.size() == 0 );
const std::experimental::string_view::value_type* p = empty.data();
- VERIFY( p );
+ VERIFY( p == nullptr );
return 0;
}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc
index 5e00b00b6..41d2d1411 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc
+++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++1y" }
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -29,10 +29,9 @@ test01()
std::experimental::wstring_view empty;
- // data() for size == 0 is non-NULL.
VERIFY( empty.size() == 0 );
const std::experimental::wstring_view::value_type* p = empty.data();
- VERIFY( p );
+ VERIFY( p == nullptr );
return 0;
}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc
new file mode 100644
index 000000000..c0a5734c6
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++1y" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// basic_string_view::to_string
+
+#include <experimental/string_view>
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+bool
+test01()
+{
+ bool test [[gnu::unused]] = true;
+
+ const char str_lit[] = "123456789A";
+ const std::experimental::string_view sv(str_lit);
+ char buffer[4] = { 0 };
+
+ auto s1 = sv.to_string();
+ VERIFY( s1 == str_lit );
+ using test_alloc = __gnu_test::tracker_allocator<char>;
+ auto s2 = sv.to_string( test_alloc{} );
+ static_assert( std::is_same<decltype(s2)::allocator_type, test_alloc>::value,
+ "to_string() uses custom allocator" );
+ VERIFY( std::equal(s1.begin(), s1.end(), s2.begin(), s2.end()) );
+ auto s3 = static_cast<std::string>(sv);
+ VERIFY( s3 == s1 );
+
+ return test;
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc b/gcc-4.9/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc
new file mode 100644
index 000000000..d3088a6ec
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc
@@ -0,0 +1,23 @@
+// { dg-options "-std=gnu++11 -O0" }
+// { dg-require-cstdint "" }
+// { dg-require-cmath "" }
+
+#include <ext/random>
+#include <functional>
+
+void
+hyperplot(unsigned int N, unsigned int K, unsigned int n)
+{
+ std::mt19937 re; // the default engine
+ __gnu_cxx::hypergeometric_distribution<> hd(N, K, n);
+ auto gen = std::bind(hd, re);
+ gen();
+}
+
+int
+main()
+{
+ hyperplot(15, 3, 2);
+ hyperplot(500, 50, 30);
+ hyperplot(100, 20, 5);
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/ext/rope/61946.cc b/gcc-4.9/libstdc++-v3/testsuite/ext/rope/61946.cc
new file mode 100644
index 000000000..ba73b4856
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/ext/rope/61946.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+
+#include <ext/rope>
+
+struct empty_char_prod : __gnu_cxx::char_producer<char>
+{
+ virtual void operator()(size_t, size_t, char*) {}
+};
+
+int main ()
+{
+ empty_char_prod* ecp = new empty_char_prod;
+ __gnu_cxx::crope excrope( ecp, 10L, true );
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/lib/gdb-test.exp b/gcc-4.9/libstdc++-v3/testsuite/lib/gdb-test.exp
index 1a72a4430..2169f26d2 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/lib/gdb-test.exp
+++ b/gcc-4.9/libstdc++-v3/testsuite/lib/gdb-test.exp
@@ -91,7 +91,7 @@ proc gdb-test { marker {selector {}} } {
}
}
- set do_whatis_tests [gdb_batch_check "python print gdb.type_printers" \
+ set do_whatis_tests [gdb_batch_check "python print(gdb.type_printers)" \
"\\\[\\\]"]
if {!$do_whatis_tests} {
send_log "skipping 'whatis' tests - gdb too old"
@@ -252,6 +252,6 @@ proc gdb_batch_check {command pattern} {
# but not earlier versions.
# Return 1 if the version is ok, 0 otherwise.
proc gdb_version_check {} {
- return [gdb_batch_check "python print gdb.lookup_global_symbol" \
+ return [gdb_batch_check "python print(gdb.lookup_global_symbol)" \
"<built-in function lookup_global_symbol>"]
}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_iterators.h b/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_iterators.h
index c6905811c..6cf18b400 100644
--- a/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_iterators.h
+++ b/gcc-4.9/libstdc++-v3/testsuite/util/testsuite_iterators.h
@@ -518,7 +518,7 @@ namespace __gnu_test
* It takes two pointers representing a range and presents them as
* a container of iterators.
*/
- template <class T, template<class T> class ItType>
+ template <class T, template<class TT> class ItType>
struct test_container
{
typename ItType<T>::ContainerType bounds;