diff options
Diffstat (limited to 'gcc-4.9/libstdc++-v3/include')
35 files changed, 350 insertions, 270 deletions
diff --git a/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h b/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h index aee1eec5b..c67ecfe48 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h +++ b/gcc-4.9/libstdc++-v3/include/bits/algorithmfwd.h @@ -482,11 +482,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _FIter, typename _Tp> _FIter - remove(_FIter, _FIter, const _Tp&); + remove(_FIter, _FIter, const _Tp&) + __attribute__ ((warn_unused_result)); template<typename _FIter, typename _Predicate> _FIter - remove_if(_FIter, _FIter, _Predicate); + remove_if(_FIter, _FIter, _Predicate) + __attribute__ ((warn_unused_result)); template<typename _IIter, typename _OIter, typename _Tp> _OIter @@ -574,11 +576,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _FIter> _FIter - unique(_FIter, _FIter); + unique(_FIter, _FIter) + __attribute__ ((warn_unused_result)); template<typename _FIter, typename _BinaryPredicate> _FIter - unique(_FIter, _FIter, _BinaryPredicate); + unique(_FIter, _FIter, _BinaryPredicate) + __attribute__ ((warn_unused_result)); // unique_copy 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 1fc0ebb7e..ceead010e 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h +++ b/gcc-4.9/libstdc++-v3/include/bits/atomic_base.h @@ -355,7 +355,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: typedef _ITp __int_type; - __int_type _M_i; + static constexpr int _S_alignment = + sizeof(_ITp) > alignof(_ITp) ? sizeof(_ITp) : alignof(_ITp); + + alignas(_S_alignment) __int_type _M_i; 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 93ceb6dae..89189656b 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/basic_string.h +++ b/gcc-4.9/libstdc++-v3/include/bits/basic_string.h @@ -3140,6 +3140,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 201103L +#define __cpp_lib_string_udls 201304 + inline namespace literals { inline namespace string_literals diff --git a/gcc-4.9/libstdc++-v3/include/bits/hashtable.h b/gcc-4.9/libstdc++-v3/include/bits/hashtable.h index 588e69c9d..894e52661 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/hashtable.h +++ b/gcc-4.9/libstdc++-v3/include/bits/hashtable.h @@ -326,7 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_uses_single_bucket(__bucket_type* __bkts) const - { return __builtin_expect(_M_buckets == &_M_single_bucket, false); } + { return __builtin_expect(__bkts == &_M_single_bucket, false); } bool _M_uses_single_bucket() const diff --git a/gcc-4.9/libstdc++-v3/include/bits/move.h b/gcc-4.9/libstdc++-v3/include/bits/move.h index dc4ac0fea..512bb7921 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/move.h +++ b/gcc-4.9/libstdc++-v3/include/bits/move.h @@ -39,10 +39,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Used, in C++03 mode too, by allocators, etc. /** - * @brief Same as C++11 std::addressof + * @brief Same as C++11 std::addressof, except it is constexpr in C++11. * @ingroup utilities */ template<typename _Tp> +#if __cplusplus >= 201103L + constexpr +#endif inline _Tp* __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT { diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex.h b/gcc-4.9/libstdc++-v3/include/bits/regex.h index e556350ad..b358c79ee 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex.h +++ b/gcc-4.9/libstdc++-v3/include/bits/regex.h @@ -474,17 +474,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * * @param __rhs A @p regex object. */ - basic_regex(const basic_regex& __rhs) = default; + basic_regex(const basic_regex& __rhs) + : _M_flags(__rhs._M_flags), _M_original_str(__rhs._M_original_str) + { + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); + } /** * @brief Move-constructs a basic regular expression. * * @param __rhs A @p regex object. + * + * The implementation is a workaround concerning ABI compatibility. See: + * https://gcc.gnu.org/ml/libstdc++/2014-09/msg00067.html */ - basic_regex(const basic_regex&& __rhs) noexcept - : _M_flags(__rhs._M_flags), _M_traits(__rhs._M_traits), - _M_automaton(std::move(__rhs._M_automaton)) - { } + basic_regex(basic_regex&& __rhs) + : _M_flags(__rhs._M_flags), + _M_original_str(std::move(__rhs._M_original_str)) + { + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); + __rhs._M_automaton.reset(); + } /** * @brief Constructs a basic regular expression from the string @@ -555,9 +567,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @brief Move-assigns one regular expression to another. + * + * The implementation is a workaround concerning ABI compatibility. See: + * https://gcc.gnu.org/ml/libstdc++/2014-09/msg00067.html */ basic_regex& - operator=(basic_regex&& __rhs) noexcept + operator=(basic_regex&& __rhs) { return this->assign(std::move(__rhs)); } /** @@ -591,8 +606,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_regex& assign(const basic_regex& __rhs) { - basic_regex __tmp(__rhs); - this->swap(__tmp); + _M_flags = __rhs._M_flags; + _M_original_str = __rhs._M_original_str; + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); return *this; } @@ -600,12 +617,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @brief The move-assignment operator. * * @param __rhs Another regular expression object. + * + * The implementation is a workaround concerning ABI compatibility. See: + * https://gcc.gnu.org/ml/libstdc++/2014-09/msg00067.html */ basic_regex& - assign(basic_regex&& __rhs) noexcept + assign(basic_regex&& __rhs) { - basic_regex __tmp(std::move(__rhs)); - this->swap(__tmp); + _M_flags = __rhs._M_flags; + _M_original_str = std::move(__rhs._M_original_str); + __rhs._M_automaton.reset(); + _M_traits.imbue(__rhs.getloc()); + this->assign(_M_original_str, _M_flags); return *this; } @@ -659,12 +682,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION assign(const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s, flag_type __flags = ECMAScript) { + _M_automaton = __detail::__compile_nfa( + __s.data(), __s.data() + __s.size(), _M_traits, __flags); + _M_original_str = __s; _M_flags = __flags; - _M_original_str.assign(__s.begin(), __s.end()); - auto __p = _M_original_str.c_str(); - _M_automaton = __detail::__compile_nfa(__p, - __p + _M_original_str.size(), - _M_traits, _M_flags); return *this; } @@ -709,7 +730,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ unsigned int mark_count() const - { return _M_automaton->_M_sub_count() - 1; } + { + if (_M_automaton) + return _M_automaton->_M_sub_count() - 1; + return 0; + } /** * @brief Gets the flags used to construct the regular expression @@ -728,9 +753,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION locale_type imbue(locale_type __loc) { - auto __ret = _M_traits.imbue(__loc); - this->assign(_M_original_str, _M_flags); - return __ret; + _M_automaton = nullptr; + return _M_traits.imbue(__loc); } /** @@ -752,7 +776,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { std::swap(_M_flags, __rhs._M_flags); std::swap(_M_traits, __rhs._M_traits); - std::swap(_M_automaton, __rhs._M_automaton); + auto __tmp = std::move(_M_original_str); + this->assign(__rhs._M_original_str, _M_flags); + __rhs.assign(__tmp, __rhs._M_flags); } #ifdef _GLIBCXX_DEBUG @@ -761,7 +787,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_automaton->_M_dot(__ostr); } #endif - protected: + private: typedef std::shared_ptr<__detail::_NFA<_Rx_traits>> _AutomatonPtr; template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, @@ -1552,42 +1578,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ explicit match_results(const _Alloc& __a = _Alloc()) - : _Base_type(__a), _M_in_iterator(false) + : _Base_type(__a) { } /** * @brief Copy constructs a %match_results. */ - match_results(const match_results& __rhs) - : _Base_type(__rhs), _M_in_iterator(false) - { } + match_results(const match_results& __rhs) = default; /** * @brief Move constructs a %match_results. */ - match_results(match_results&& __rhs) noexcept - : _Base_type(std::move(__rhs)), _M_in_iterator(false) - { } + match_results(match_results&& __rhs) noexcept = default; /** * @brief Assigns rhs to *this. */ match_results& - operator=(const match_results& __rhs) - { - match_results(__rhs).swap(*this); - return *this; - } + operator=(const match_results& __rhs) = default; /** * @brief Move-assigns rhs to *this. */ match_results& - operator=(match_results&& __rhs) - { - match_results(std::move(__rhs)).swap(*this); - return *this; - } + operator=(match_results&& __rhs) = default; /** * @brief Destroys a %match_results object. @@ -1674,13 +1688,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION difference_type position(size_type __sub = 0) const { - // [28.12.1.4.5] - if (_M_in_iterator) - return __sub < size() ? std::distance(_M_begin, - (*this)[__sub].first) : -1; - else - return __sub < size() ? std::distance(this->prefix().first, - (*this)[__sub].first) : -1; + return __sub < size() ? std::distance(_M_begin, + (*this)[__sub].first) : -1; } /** @@ -1762,7 +1771,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ const_iterator cbegin() const - { return _Base_type::cbegin() + 2; } + { return this->begin(); } /** * @brief Gets an iterator to one-past-the-end of the collection. @@ -1776,7 +1785,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ const_iterator cend() const - { return _Base_type::cend(); } + { return this->end(); } //@} @@ -1814,7 +1823,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @pre ready() == true */ - template<typename _Out_iter, typename _St, typename _Sa> + template<typename _St, typename _Sa> basic_string<char_type, _St, _Sa> format(const basic_string<char_type, _St, _Sa>& __fmt, match_flag_type __flags = regex_constants::format_default) const @@ -1865,7 +1874,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ void swap(match_results& __that) - { _Base_type::swap(__that); } + { + using std::swap; + _Base_type::swap(__that); + swap(_M_begin, __that._M_begin); + } //@} private: @@ -2604,7 +2617,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION regex_constants::match_flag_type __m = regex_constants::match_default) : _M_position(__a, __b, __re, __m), - _M_subs(__submatches, *(&__submatches+1)), _M_n(0) + _M_subs(__submatches, __submatches + _Nm), _M_n(0) { _M_init(__a, __b); } /** @@ -2613,12 +2626,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ regex_token_iterator(const regex_token_iterator& __rhs) : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs), - _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_result(__rhs._M_result), - _M_has_m1(__rhs._M_has_m1) - { - if (__rhs._M_result == &__rhs._M_suffix) - _M_result = &_M_suffix; - } + _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1) + { _M_normalize_result(); } /** * @brief Assigns a %regex_token_iterator to another. @@ -2687,9 +2696,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } constexpr bool - _M_end_of_seq() + _M_end_of_seq() const { return _M_result == nullptr; } + // [28.12.2.2.4] + void + _M_normalize_result() + { + if (_M_position != _Position()) + _M_result = &_M_current_match(); + else if (_M_has_m1) + _M_result = &_M_suffix; + else + _M_result = nullptr; + } + _Position _M_position; std::vector<int> _M_subs; value_type _M_suffix; diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex.tcc b/gcc-4.9/libstdc++-v3/include/bits/regex.tcc index 5fa1f018b..5eeb0e66f 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/regex.tcc @@ -62,6 +62,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return false; typename match_results<_BiIter, _Alloc>::_Base_type& __res = __m; + __m._M_begin = __s; __res.resize(__re._M_automaton->_M_sub_count() + 2); for (auto& __it : __res) __it.matched = false; @@ -274,53 +275,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION "right-curly-bracket", "tilde", "DEL", - "" }; - // same as boost - //static const char* __digraphs[] = - // { - // "ae", - // "Ae", - // "AE", - // "ch", - // "Ch", - // "CH", - // "ll", - // "Ll", - // "LL", - // "ss", - // "Ss", - // "SS", - // "nj", - // "Nj", - // "NJ", - // "dz", - // "Dz", - // "DZ", - // "lj", - // "Lj", - // "LJ", - // "" - // }; - - std::string __s(__last - __first, '?'); - __fctyp.narrow(__first, __last, '?', &*__s.begin()); - - for (unsigned int __i = 0; *__collatenames[__i]; __i++) - if (__s == __collatenames[__i]) - return string_type(1, __fctyp.widen(static_cast<char>(__i))); - - //for (unsigned int __i = 0; *__digraphs[__i]; __i++) - // { - // const char* __now = __digraphs[__i]; - // if (__s == __now) - // { - // string_type ret(__s.size(), __fctyp.widen('?')); - // __fctyp.widen(__now, __now + 2/* ouch */, &*ret.begin()); - // return ret; - // } - // } + string __s(__first, __last); + for (const auto& __it : __collatenames) + if (__s == __it) + return string_type(1, __fctyp.widen( + static_cast<char>(&__it - __collatenames))); + + // TODO Add digraph support: + // http://boost.sourceforge.net/libs/regex/doc/collating_names.html + return string_type(); } @@ -331,12 +296,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase) const { typedef std::ctype<char_type> __ctype_type; - typedef std::ctype<char> __cctype_type; - typedef const pair<const char*, char_class_type> _ClassnameEntry; const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - const __cctype_type& __cctyp(use_facet<__cctype_type>(_M_locale)); - static _ClassnameEntry __classnames[] = + // Mappings from class name to class mask. + static const pair<const char*, char_class_type> __classnames[] = { {"d", ctype_base::digit}, {"w", {ctype_base::alnum, _RegexMask::_S_under}}, @@ -355,22 +318,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION {"xdigit", ctype_base::xdigit}, }; - std::string __s(__last - __first, '?'); - __fctyp.narrow(__first, __last, '?', &__s[0]); - __cctyp.tolower(&*__s.begin(), &*__s.begin() + __s.size()); - for (_ClassnameEntry* __it = __classnames; - __it < *(&__classnames + 1); - ++__it) - { - if (__s == __it->first) - { - if (__icase - && ((__it->second - & (ctype_base::lower | ctype_base::upper)) != 0)) - return ctype_base::alpha; - return __it->second; - } - } + string __s; + for (auto __cur = __first; __cur != __last; ++__cur) + __s += __fctyp.narrow(__fctyp.tolower(*__cur), '?'); + + for (const auto& __it : __classnames) + if (__s == __it.first) + { + if (__icase + && ((__it.second + & (ctype_base::lower | ctype_base::upper)) != 0)) + return ctype_base::alpha; + return __it.second; + } return 0; } @@ -581,8 +541,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION | regex_constants::match_continuous)) { _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); - _M_match.at(_M_match.size()).first = __prefix_first; - _M_match._M_in_iterator = true; + auto& __prefix = _M_match.at(_M_match.size()); + __prefix.first = __prefix_first; + __prefix.matched = __prefix.first != __prefix.second; + // [28.12.1.4.5] _M_match._M_begin = _M_begin; return *this; } @@ -594,8 +556,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags)) { _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); - _M_match.at(_M_match.size()).first = __prefix_first; - _M_match._M_in_iterator = true; + auto& __prefix = _M_match.at(_M_match.size()); + __prefix.first = __prefix_first; + __prefix.matched = __prefix.first != __prefix.second; + // [28.12.1.4.5] _M_match._M_begin = _M_begin; } else @@ -614,11 +578,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_position = __rhs._M_position; _M_subs = __rhs._M_subs; _M_n = __rhs._M_n; - _M_result = __rhs._M_result; _M_suffix = __rhs._M_suffix; _M_has_m1 = __rhs._M_has_m1; - if (__rhs._M_result == &__rhs._M_suffix) - _M_result = &_M_suffix; + _M_normalize_result(); return *this; } diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc b/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc index 14e40c0cd..ffe01705f 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/regex_compiler.tcc @@ -271,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { auto& __tmp = _M_nfa[__stack.top()]; __stack.pop(); - swap(__tmp._M_next, __tmp._M_alt); + std::swap(__tmp._M_next, __tmp._M_alt); } } _M_stack.push(__e); diff --git a/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc b/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc index 052302b91..1dc65435f 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/regex_executor.tcc @@ -267,9 +267,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_dfs<__match_mode>(__state._M_next); break; case _S_opcode_match: + if (_M_current == _M_end) + break; if (__dfs_mode) { - if (_M_current != _M_end && __state._M_matches(*_M_current)) + if (__state._M_matches(*_M_current)) { ++_M_current; _M_dfs<__match_mode>(__state._M_next); @@ -350,23 +352,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: _M_word_boundary(_State<_TraitsT> __state) const { - // By definition. - bool __ans = false; - auto __pre = _M_current; - --__pre; - if (!(_M_at_begin() && _M_at_end())) + bool __left_is_word = false; + if (_M_current != _M_begin + || (_M_flags & regex_constants::match_prev_avail)) { - if (_M_at_begin()) - __ans = _M_is_word(*_M_current) - && !(_M_flags & regex_constants::match_not_bow); - else if (_M_at_end()) - __ans = _M_is_word(*__pre) - && !(_M_flags & regex_constants::match_not_eow); - else - __ans = _M_is_word(*_M_current) - != _M_is_word(*__pre); + auto __prev = _M_current; + if (_M_is_word(*std::prev(__prev))) + __left_is_word = true; } - return __ans; + bool __right_is_word = + _M_current != _M_end && _M_is_word(*_M_current); + + if (__left_is_word == __right_is_word) + return false; + if (__left_is_word && !(_M_flags & regex_constants::match_not_eow)) + return true; + if (__right_is_word && !(_M_flags & regex_constants::match_not_bow)) + return true; + return false; } _GLIBCXX_END_NAMESPACE_VERSION diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h b/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h index 104ab8685..40233c58f 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_algo.h @@ -3629,7 +3629,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Efficiently compare identical prefixes: O(N) if sequences // have the same elements in the same order. - for (; __first1 != __last1; ++__first1, ++__first2) + for (; __first1 != __last1 && __first2 != __last2; + ++__first1, ++__first2) if (!__pred(__first1, __first2)) break; @@ -4464,7 +4465,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO if (__first != __last) for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - std::iter_swap(__i, __first + (std::rand() % ((__i - __first) + 1))); + { + _RandomAccessIterator __j = __first + + std::rand() % ((__i - __first) + 1); + if (__i != __j) + std::iter_swap(__i, __j); + } } /** @@ -4498,7 +4504,11 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO if (__first == __last) return; for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) - std::iter_swap(__i, __first + __rand((__i - __first) + 1)); + { + _RandomAccessIterator __j = __first + __rand((__i - __first) + 1); + if (__i != __j) + std::iter_swap(__i, __j); + } } diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h b/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h index 5ff21be98..f7c11e931 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_algobase.h @@ -1091,6 +1091,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO } #if __cplusplus > 201103L + +#define __cpp_lib_robust_nonmodifying_seq_ops 201304 + /** * @brief Tests a range for element-wise equality. * @ingroup non_mutating_algorithms diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_function.h b/gcc-4.9/libstdc++-v3/include/bits/stl_function.h index 8703ce9ae..71215b879 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_function.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_function.h @@ -217,6 +217,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #if __cplusplus > 201103L + +#define __cpp_lib_transparent_operators 201210 +//#define __cpp_lib_generic_associative_lookup 201304 + template<> struct plus<void> { diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h b/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h index b516664b6..32124e34b 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_queue.h @@ -58,6 +58,9 @@ #include <bits/concept_check.h> #include <debug/debug.h> +#if __cplusplus >= 201103L +# include <bits/uses_allocator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h b/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h index ee187da8e..f4bb72c38 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_stack.h @@ -58,6 +58,9 @@ #include <bits/concept_check.h> #include <debug/debug.h> +#if __cplusplus >= 201103L +# include <bits/uses_allocator.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h b/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h index cd2a48283..42b40267a 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/gcc-4.9/libstdc++-v3/include/bits/stl_uninitialized.h @@ -115,8 +115,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const bool __assignable = true; #else // trivial types can have deleted assignment - typedef typename iterator_traits<_InputIterator>::reference _RefType; - const bool __assignable = is_assignable<_ValueType1, _RefType>::value; + typedef typename iterator_traits<_InputIterator>::reference _RefType1; + typedef typename iterator_traits<_ForwardIterator>::reference _RefType2; + const bool __assignable = is_assignable<_RefType2, _RefType1>::value; #endif return std::__uninitialized_copy<__is_trivial(_ValueType1) diff --git a/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h b/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h index c72fbc7dc..ce38c5a77 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h +++ b/gcc-4.9/libstdc++-v3/include/bits/unique_ptr.h @@ -743,6 +743,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #if __cplusplus > 201103L + +#define __cpp_lib_make_unique 201304 + template<typename _Tp> struct _MakeUniq { typedef unique_ptr<_Tp> __single_object; }; diff --git a/gcc-4.9/libstdc++-v3/include/bits/vector.tcc b/gcc-4.9/libstdc++-v3/include/bits/vector.tcc index 015ccd60a..9bdc659bd 100644 --- a/gcc-4.9/libstdc++-v3/include/bits/vector.tcc +++ b/gcc-4.9/libstdc++-v3/include/bits/vector.tcc @@ -252,7 +252,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { __sanitizer_vector_annotate_delete(); vector __tmp(__n, __val, _M_get_Tp_allocator()); - __tmp.swap(*this); + __tmp._M_impl._M_swap_data(this->_M_impl); } else if (__n > size()) { diff --git a/gcc-4.9/libstdc++-v3/include/c_compatibility/complex.h b/gcc-4.9/libstdc++-v3/include/c_compatibility/complex.h index d072b68a8..b15361ea0 100644 --- a/gcc-4.9/libstdc++-v3/include/c_compatibility/complex.h +++ b/gcc-4.9/libstdc++-v3/include/c_compatibility/complex.h @@ -26,21 +26,29 @@ * This is a Standard C++ Library header. */ -#include <bits/c++config.h> +#ifndef _GLIBCXX_COMPLEX_H +#define _GLIBCXX_COMPLEX_H 1 #if __cplusplus >= 201103L # include <ccomplex> +#else // C++98 and C++03 + +// The C++ <complex> header is incompatible with the C99 <complex.h> header, +// they cannot be included into a single translation unit portably. Notably, +// C++11's <ccomplex> does not include C99's <complex.h> and in C++11's +// <complex.h> is defined to provide only what C++11's <ccomplex> does in a +// different namespace. +#ifdef _GLIBCXX_COMPLEX +# error Cannot include both <complex> and C99's <complex.h> #endif -#if _GLIBCXX_HAVE_COMPLEX_H -# include_next <complex.h> -# ifdef _GLIBCXX_COMPLEX -// See PR56111, keep the macro in C++03 if possible. -# undef complex -# endif -#endif +// Delegate to a system complex.h if we don't provide it as part of the C++ +// implementation. +#include_next <complex.h> -#ifndef _GLIBCXX_COMPLEX_H -#define _GLIBCXX_COMPLEX_H 1 +// Provide a define indicating that a C99-style <complex.h> has been included. +#define _GLIBCXX_C99_COMPLEX_H + +#endif // C++98 and C++03 #endif diff --git a/gcc-4.9/libstdc++-v3/include/debug/array b/gcc-4.9/libstdc++-v3/include/debug/array index ef01c981b..cd3eb0a20 100644 --- a/gcc-4.9/libstdc++-v3/include/debug/array +++ b/gcc-4.9/libstdc++-v3/include/debug/array @@ -150,15 +150,15 @@ namespace __debug operator[](size_type __n) noexcept { __glibcxx_check_subscript(__n); - return _AT_Type::_S_ref(_M_elems, __n); + return *_AT_Type::_S_ptr(_M_elems, __n); } constexpr const_reference operator[](size_type __n) const noexcept { - return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) + return __n < _Nm ? *_AT_Type::_S_ptr(_M_elems, __n) : (_GLIBCXX_THROW_OR_ABORT(_Array_check_subscript<_Nm>(__n)), - _AT_Type::_S_ref(_M_elems, 0)); + *_AT_Type::_S_ptr(_M_elems, 0)); } reference @@ -169,7 +169,7 @@ namespace __debug "(which is %zu) >= _Nm " "(which is %zu)"), __n, _Nm); - return _AT_Type::_S_ref(_M_elems, __n); + return *_AT_Type::_S_ptr(_M_elems, __n); } constexpr const_reference @@ -177,11 +177,11 @@ namespace __debug { // Result of conditional expression must be an lvalue so use // boolean ? lvalue : (throw-expr, lvalue) - return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) + return __n < _Nm ? *_AT_Type::_S_ptr(_M_elems, __n) : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) " ">= _Nm (which is %zu)"), __n, _Nm), - _AT_Type::_S_ref(_M_elems, 0)); + *_AT_Type::_S_ptr(_M_elems, 0)); } reference @@ -194,9 +194,9 @@ namespace __debug constexpr const_reference front() const noexcept { - return _Nm ? _AT_Type::_S_ref(_M_elems, 0) + return _Nm ? *_AT_Type::_S_ptr(_M_elems, 0) : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()), - _AT_Type::_S_ref(_M_elems, 0)); + *_AT_Type::_S_ptr(_M_elems, 0)); } reference @@ -209,18 +209,18 @@ namespace __debug constexpr const_reference back() const noexcept { - return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1) + return _Nm ? *_AT_Type::_S_ptr(_M_elems, _Nm - 1) : (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()), - _AT_Type::_S_ref(_M_elems, 0)); + *_AT_Type::_S_ptr(_M_elems, 0)); } pointer data() noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems, 0); } const_pointer data() const noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptrr(_M_elems, 0); } }; // Array comparisons. @@ -269,8 +269,8 @@ namespace __debug get(array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); + return *_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: + _S_ptr(__arr._M_elems, _Int); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> @@ -286,8 +286,8 @@ namespace __debug get(const array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); + return *_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: + _S_ptr(__arr._M_elems, _Int); } } // namespace __debug diff --git a/gcc-4.9/libstdc++-v3/include/debug/functions.h b/gcc-4.9/libstdc++-v3/include/debug/functions.h index b48c36d4a..0e7f1b785 100644 --- a/gcc-4.9/libstdc++-v3/include/debug/functions.h +++ b/gcc-4.9/libstdc++-v3/include/debug/functions.h @@ -34,7 +34,7 @@ // _Iter_base #include <bits/cpp_type_traits.h> // for __is_integer #include <bits/move.h> // for __addressof and addressof -# include <bits/stl_function.h> // for less +#include <bits/stl_function.h> // for less #if __cplusplus >= 201103L # include <type_traits> // for is_lvalue_reference and __and_ #endif @@ -252,8 +252,16 @@ namespace __gnu_debug const _InputIterator& __other, const _InputIterator& __other_end) { - return __foreign_iterator_aux3(__it, __other, __other_end, - _Is_contiguous_sequence<_Sequence>()); +#if __cplusplus < 201103L + typedef _Is_contiguous_sequence<_Sequence> __tag; +#else + using __lvalref = std::is_lvalue_reference< + typename std::iterator_traits<_InputIterator>::reference>; + using __contiguous = _Is_contiguous_sequence<_Sequence>; + using __tag = typename std::conditional<__lvalref::value, __contiguous, + std::__false_type>::type; +#endif + return __foreign_iterator_aux3(__it, __other, __other_end, __tag()); } /* Handle the case where we aren't really inserting a range after all */ diff --git a/gcc-4.9/libstdc++-v3/include/parallel/algo.h b/gcc-4.9/libstdc++-v3/include/parallel/algo.h index 2c1f9eb4c..4608487dd 100644 --- a/gcc-4.9/libstdc++-v3/include/parallel/algo.h +++ b/gcc-4.9/libstdc++-v3/include/parallel/algo.h @@ -81,9 +81,8 @@ namespace __parallel template<typename _RAIter, typename _Function> _Function __for_each_switch(_RAIter __begin, _RAIter __end, - _Function __f, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + _Function __f, random_access_iterator_tag, + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) @@ -896,8 +895,7 @@ namespace __parallel typename iterator_traits<_RAIter>::difference_type __count_switch(_RAIter __begin, _RAIter __end, const _Tp& __value, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_unbalanced) + __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; @@ -966,8 +964,7 @@ namespace __parallel typename iterator_traits<_RAIter>::difference_type __count_if_switch(_RAIter __begin, _RAIter __end, _Predicate __pred, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_unbalanced) + __gnu_parallel::_Parallelism __parallelism_tag) { typedef iterator_traits<_RAIter> _TraitsType; typedef typename _TraitsType::value_type _ValueType; @@ -1225,8 +1222,7 @@ namespace __parallel __transform1_switch(_RAIter1 __begin, _RAIter1 __end, _RAIter2 __result, _UnaryOperation __unary_op, random_access_iterator_tag, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) @@ -1315,8 +1311,7 @@ namespace __parallel _RAIter3 __result, _BinaryOperation __binary_op, random_access_iterator_tag, random_access_iterator_tag, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( (__end1 - __begin1) >= @@ -1422,8 +1417,7 @@ namespace __parallel __replace_switch(_RAIter __begin, _RAIter __end, const _Tp& __old_value, const _Tp& __new_value, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { // XXX parallel version is where? replace(__begin, __end, __old_value, __new_value, @@ -1478,8 +1472,7 @@ namespace __parallel __replace_if_switch(_RAIter __begin, _RAIter __end, _Predicate __pred, const _Tp& __new_value, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) @@ -1544,8 +1537,7 @@ namespace __parallel void __generate_switch(_RAIter __begin, _RAIter __end, _Generator __gen, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) @@ -1608,8 +1600,7 @@ namespace __parallel inline _RAIter __generate_n_switch(_RAIter __begin, _Size __n, _Generator __gen, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { // XXX parallel version is where? return generate_n(__begin, __n, __gen, __gnu_parallel::sequential_tag()); @@ -2204,8 +2195,7 @@ namespace __parallel _RAIter __max_element_switch(_RAIter __begin, _RAIter __end, _Compare __comp, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) @@ -2296,8 +2286,7 @@ namespace __parallel _RAIter __min_element_switch(_RAIter __begin, _RAIter __end, _Compare __comp, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_balanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) diff --git a/gcc-4.9/libstdc++-v3/include/parallel/numeric b/gcc-4.9/libstdc++-v3/include/parallel/numeric index 825463502..e89f27efe 100644 --- a/gcc-4.9/libstdc++-v3/include/parallel/numeric +++ b/gcc-4.9/libstdc++-v3/include/parallel/numeric @@ -85,8 +85,7 @@ namespace __parallel __accumulate_switch(__RAIter __begin, __RAIter __end, _Tp __init, _BinaryOperation __binary_op, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_unbalanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) @@ -193,8 +192,7 @@ namespace __parallel _BinaryFunction2 __binary_op2, random_access_iterator_tag, random_access_iterator_tag, - __gnu_parallel::_Parallelism __parallelism_tag - = __gnu_parallel::parallel_unbalanced) + __gnu_parallel::_Parallelism __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION((__last1 - __first1) >= __gnu_parallel::_Settings::get(). @@ -419,8 +417,7 @@ namespace __parallel random_access_iterator_tag, random_access_iterator_tag, __gnu_parallel::_Parallelism - __parallelism_tag - = __gnu_parallel::parallel_balanced) + __parallelism_tag) { if (_GLIBCXX_PARALLEL_CONDITION( static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) diff --git a/gcc-4.9/libstdc++-v3/include/std/array b/gcc-4.9/libstdc++-v3/include/std/array index 67680d61e..b7abeb09b 100644 --- a/gcc-4.9/libstdc++-v3/include/std/array +++ b/gcc-4.9/libstdc++-v3/include/std/array @@ -48,9 +48,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { typedef _Tp _Type[_Nm]; - static constexpr _Tp& - _S_ref(const _Type& __t, std::size_t __n) noexcept - { return const_cast<_Tp&>(__t[__n]); } + static constexpr _Tp* + _S_ptr(const _Type& __t, std::size_t __n) noexcept + { return const_cast<_Tp*>(std::__addressof(__t[__n])); } }; template<typename _Tp> @@ -58,9 +58,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { struct _Type { }; - static constexpr _Tp& - _S_ref(const _Type&, std::size_t) noexcept - { return *static_cast<_Tp*>(nullptr); } + static constexpr _Tp* + _S_ptr(const _Type&, std::size_t) noexcept + { return static_cast<_Tp*>(nullptr); } }; /** @@ -170,11 +170,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // Element access. reference operator[](size_type __n) noexcept - { return _AT_Type::_S_ref(_M_elems, __n); } + { return *_AT_Type::_S_ptr(_M_elems, __n); } constexpr const_reference operator[](size_type __n) const noexcept - { return _AT_Type::_S_ref(_M_elems, __n); } + { return *_AT_Type::_S_ptr(_M_elems, __n); } reference at(size_type __n) @@ -183,7 +183,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) " ">= _Nm (which is %zu)"), __n, _Nm); - return _AT_Type::_S_ref(_M_elems, __n); + return *_AT_Type::_S_ptr(_M_elems, __n); } constexpr const_reference @@ -191,11 +191,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { // Result of conditional expression must be an lvalue so use // boolean ? lvalue : (throw-expr, lvalue) - return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) + return __n < _Nm ? *_AT_Type::_S_ptr(_M_elems, __n) : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) " ">= _Nm (which is %zu)"), __n, _Nm), - _AT_Type::_S_ref(_M_elems, 0)); + *_AT_Type::_S_ptr(_M_elems, 0)); } reference @@ -204,7 +204,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER constexpr const_reference front() const noexcept - { return _AT_Type::_S_ref(_M_elems, 0); } + { return *_AT_Type::_S_ptr(_M_elems, 0); } reference back() noexcept @@ -213,17 +213,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER constexpr const_reference back() const noexcept { - return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1) - : _AT_Type::_S_ref(_M_elems, 0); + return _Nm ? *_AT_Type::_S_ptr(_M_elems, _Nm - 1) + : *_AT_Type::_S_ptr(_M_elems, 0); } pointer data() noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems, 0); } const_pointer data() const noexcept - { return std::__addressof(_AT_Type::_S_ref(_M_elems, 0)); } + { return _AT_Type::_S_ptr(_M_elems, 0); } }; // Array comparisons. @@ -272,8 +272,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER get(array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); + return *_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: + _S_ptr(__arr._M_elems, _Int); } template<std::size_t _Int, typename _Tp, std::size_t _Nm> @@ -289,8 +289,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER get(const array<_Tp, _Nm>& __arr) noexcept { static_assert(_Int < _Nm, "index is out of bounds"); - return _GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: - _S_ref(__arr._M_elems, _Int); + return *_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>:: + _S_ptr(__arr._M_elems, _Int); } _GLIBCXX_END_NAMESPACE_CONTAINER diff --git a/gcc-4.9/libstdc++-v3/include/std/atomic b/gcc-4.9/libstdc++-v3/include/std/atomic index ece75a4e4..371144628 100644 --- a/gcc-4.9/libstdc++-v3/include/std/atomic +++ b/gcc-4.9/libstdc++-v3/include/std/atomic @@ -161,7 +161,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct atomic { private: - _Tp _M_i; + // Align 1/2/4/8/16-byte types to at least their size. + static constexpr int _S_min_alignment + = (sizeof(_Tp) & (sizeof(_Tp) - 1)) || sizeof(_Tp) > 16 + ? 0 : sizeof(_Tp); + + static constexpr int _S_alignment + = _S_min_alignment > alignof(_Tp) ? _S_min_alignment : alignof(_Tp); + + alignas(_S_alignment) _Tp _M_i; public: atomic() noexcept = default; diff --git a/gcc-4.9/libstdc++-v3/include/std/chrono b/gcc-4.9/libstdc++-v3/include/std/chrono index b114e02f0..6e9c7dc97 100644 --- a/gcc-4.9/libstdc++-v3/include/std/chrono +++ b/gcc-4.9/libstdc++-v3/include/std/chrono @@ -782,6 +782,8 @@ _GLIBCXX_END_NAMESPACE_VERSION #if __cplusplus > 201103L +#define __cpp_lib_chrono_udls 201304 + inline namespace literals { inline namespace chrono_literals diff --git a/gcc-4.9/libstdc++-v3/include/std/complex b/gcc-4.9/libstdc++-v3/include/std/complex index 34fa1ddbc..3104b584e 100644 --- a/gcc-4.9/libstdc++-v3/include/std/complex +++ b/gcc-4.9/libstdc++-v3/include/std/complex @@ -44,8 +44,14 @@ #include <cmath> #include <sstream> -// Get rid of a macro possibly defined in <complex.h> -#undef complex +// The C++ <complex> header is incompatible with the C99 <complex.h> header, +// they cannot be included into a single translation unit portably. Notably, +// C++11's <ccomplex> does not include C99's <complex.h> and in C++11's +// <complex.h> is defined to provide only what C++11's <ccomplex> does in a +// different namespace. +#ifdef _GLIBCXX_C99_COMPLEX_H +#error Cannot include both <complex> and C99's <complex.h> +#endif namespace std _GLIBCXX_VISIBILITY(default) { @@ -1929,6 +1935,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline namespace literals { inline namespace complex_literals { +#define __cpp_lib_complex_udls 201309 + constexpr std::complex<float> operator""if(long double __num) { return std::complex<float>{0.0F, static_cast<float>(__num)}; } diff --git a/gcc-4.9/libstdc++-v3/include/std/functional b/gcc-4.9/libstdc++-v3/include/std/functional index 0e80fa37c..fac1c6708 100644 --- a/gcc-4.9/libstdc++-v3/include/std/functional +++ b/gcc-4.9/libstdc++-v3/include/std/functional @@ -2407,9 +2407,9 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) { if (static_cast<bool>(__x)) { + __x._M_manager(_M_functor, __x._M_functor, __clone_functor); _M_invoker = __x._M_invoker; _M_manager = __x._M_manager; - __x._M_manager(_M_functor, __x._M_functor, __clone_functor); } } diff --git a/gcc-4.9/libstdc++-v3/include/std/future b/gcc-4.9/libstdc++-v3/include/std/future index d446b9d55..6523cea8e 100644 --- a/gcc-4.9/libstdc++-v3/include/std/future +++ b/gcc-4.9/libstdc++-v3/include/std/future @@ -1450,7 +1450,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator()(_ArgTypes... __args) { __future_base::_State_base::_S_check(_M_state); - _M_state->_M_run(std::forward<_ArgTypes>(__args)...); + auto __state = _M_state; + __state->_M_run(std::forward<_ArgTypes>(__args)...); } void diff --git a/gcc-4.9/libstdc++-v3/include/std/iomanip b/gcc-4.9/libstdc++-v3/include/std/iomanip index cc6f60cde..9b2cc7a6a 100644 --- a/gcc-4.9/libstdc++-v3/include/std/iomanip +++ b/gcc-4.9/libstdc++-v3/include/std/iomanip @@ -339,6 +339,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 201103L +#define __cpp_lib_quoted_string_io 201304 + _GLIBCXX_END_NAMESPACE_VERSION namespace __detail { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/gcc-4.9/libstdc++-v3/include/std/mutex b/gcc-4.9/libstdc++-v3/include/std/mutex index 8e9dd27e2..c6b7f1373 100644 --- a/gcc-4.9/libstdc++-v3/include/std/mutex +++ b/gcc-4.9/libstdc++-v3/include/std/mutex @@ -648,12 +648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { int __idx; 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(...) - { } + __try_lock_impl<0>::__do_try_lock(__locks, __idx); return __idx; } diff --git a/gcc-4.9/libstdc++-v3/include/std/shared_mutex b/gcc-4.9/libstdc++-v3/include/std/shared_mutex index 53b39f825..c193eb2d9 100644 --- a/gcc-4.9/libstdc++-v3/include/std/shared_mutex +++ b/gcc-4.9/libstdc++-v3/include/std/shared_mutex @@ -36,10 +36,8 @@ #else #include <bits/c++config.h> -#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) -# include <mutex> -# include <condition_variable> -#endif +#include <mutex> +#include <condition_variable> #include <bits/functexcept.h> namespace std _GLIBCXX_VISIBILITY(default) @@ -51,7 +49,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ -#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_HAS_GTHREADS + +#define __cpp_lib_shared_timed_mutex 201402 + /// shared_timed_mutex class shared_timed_mutex { @@ -251,7 +253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } }; -#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 +#endif // _GLIBCXX_HAS_GTHREADS /// shared_lock template<typename _Mutex> @@ -390,6 +392,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept { __x.swap(__y); } +#endif // _GLIBCXX_USE_C99_STDINT_TR1 + // @} group mutexes _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/gcc-4.9/libstdc++-v3/include/std/tuple b/gcc-4.9/libstdc++-v3/include/std/tuple index 103c99e06..6e0577ddf 100644 --- a/gcc-4.9/libstdc++-v3/include/std/tuple +++ b/gcc-4.9/libstdc++-v3/include/std/tuple @@ -88,21 +88,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr _Head_base(const _Head& __h) : _Head(__h) { } - template<typename _UHead, typename = typename - enable_if<!is_convertible<_UHead, - __uses_alloc_base>::value>::type> + constexpr _Head_base(const _Head_base&) = default; + constexpr _Head_base(_Head_base&&) = default; + + template<typename _UHead> constexpr _Head_base(_UHead&& __h) : _Head(std::forward<_UHead>(__h)) { } - _Head_base(__uses_alloc0) + _Head_base(allocator_arg_t, __uses_alloc0) : _Head() { } template<typename _Alloc> - _Head_base(__uses_alloc1<_Alloc> __a) + _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a) : _Head(allocator_arg, *__a._M_a) { } template<typename _Alloc> - _Head_base(__uses_alloc2<_Alloc> __a) + _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a) : _Head(*__a._M_a) { } template<typename _UHead> @@ -133,21 +134,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr _Head_base(const _Head& __h) : _M_head_impl(__h) { } - template<typename _UHead, typename = typename - enable_if<!is_convertible<_UHead, - __uses_alloc_base>::value>::type> + constexpr _Head_base(const _Head_base&) = default; + constexpr _Head_base(_Head_base&&) = default; + + template<typename _UHead> constexpr _Head_base(_UHead&& __h) : _M_head_impl(std::forward<_UHead>(__h)) { } - _Head_base(__uses_alloc0) + _Head_base(allocator_arg_t, __uses_alloc0) : _M_head_impl() { } template<typename _Alloc> - _Head_base(__uses_alloc1<_Alloc> __a) + _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a) : _M_head_impl(allocator_arg, *__a._M_a) { } template<typename _Alloc> - _Head_base(__uses_alloc2<_Alloc> __a) + _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a) : _M_head_impl(*__a._M_a) { } template<typename _UHead> @@ -285,7 +287,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Alloc> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a) : _Inherited(__tag, __a), - _Base(__use_alloc<_Head>(__a)) { } + _Base(__tag, __use_alloc<_Head>(__a)) { } template<typename _Alloc> _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, @@ -774,6 +776,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION tuple<_Elements...>>::type&&>(get<__i>(__t)); } #if __cplusplus > 201103L + +#define __cpp_lib_tuples_by_type 201304 + template<typename _Head, size_t __i, typename... _Tail> constexpr typename __add_ref<_Head>::type __get_helper2(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept diff --git a/gcc-4.9/libstdc++-v3/include/std/type_traits b/gcc-4.9/libstdc++-v3/include/std/type_traits index 9a5c06e9c..6f439f561 100644 --- a/gcc-4.9/libstdc++-v3/include/std/type_traits +++ b/gcc-4.9/libstdc++-v3/include/std/type_traits @@ -73,6 +73,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef integral_constant<_Tp, __v> type; constexpr operator value_type() const { return value; } #if __cplusplus > 201103L + +#define __cpp_lib_integral_constant_callable 201304 + constexpr value_type operator()() const { return value; } #endif }; @@ -480,6 +483,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct is_function<_Res(_ArgTypes......) const volatile &&> : public true_type { }; +#define __cpp_lib_is_null_pointer 201309 + template<typename> struct __is_null_pointer_helper : public false_type { }; @@ -634,6 +639,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, __is_polymorphic(_Tp)> { }; +#if __cplusplus > 201103L + /// is_final + #define __cpp_lib_is_final 201402L + template<typename _Tp> + struct is_final + : public integral_constant<bool, __is_final(_Tp)> + { }; +#endif + /// is_abstract template<typename _Tp> struct is_abstract @@ -1451,6 +1465,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #if __cplusplus > 201103L + +#define __cpp_lib_transformation_trait_aliases 201304 + /// Alias template for remove_const template<typename _Tp> using remove_const_t = typename remove_const<_Tp>::type; @@ -2048,6 +2065,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Sfinae-friendly result_of implementation: +#define __cpp_lib_result_of_sfinae 201210 + // [func.require] paragraph 1 bullet 1: struct __result_of_memfun_ref_impl { diff --git a/gcc-4.9/libstdc++-v3/include/std/utility b/gcc-4.9/libstdc++-v3/include/std/utility index 4da92095f..694220d7b 100644 --- a/gcc-4.9/libstdc++-v3/include/std/utility +++ b/gcc-4.9/libstdc++-v3/include/std/utility @@ -70,6 +70,7 @@ #include <bits/stl_pair.h> #if __cplusplus >= 201103L + #include <bits/move.h> #include <initializer_list> @@ -153,6 +154,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __pair_get<_Int>::__const_get(__in); } #if __cplusplus > 201103L + +#define __cpp_lib_tuples_by_type 201304 + template <typename _Tp, typename _Up> constexpr _Tp& get(pair<_Tp, _Up>& __p) noexcept @@ -183,6 +187,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION get(pair<_Up, _Tp>&& __p) noexcept { return std::move(__p.second); } +#define __cpp_lib_exchange_function 201304 + /// Assign @p __new_val to @p __obj and return its previous value. template <typename _Tp, typename _Up = _Tp> inline _Tp @@ -216,6 +222,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #if __cplusplus > 201103L + +#define __cpp_lib_integer_sequence 201304 + /// Class template integer_sequence template<typename _Tp, _Tp... _Idx> struct integer_sequence diff --git a/gcc-4.9/libstdc++-v3/include/tr1/functional b/gcc-4.9/libstdc++-v3/include/tr1/functional index 20785ff04..58af91024 100644 --- a/gcc-4.9/libstdc++-v3/include/tr1/functional +++ b/gcc-4.9/libstdc++-v3/include/tr1/functional @@ -2112,9 +2112,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { if (static_cast<bool>(__x)) { + __x._M_manager(_M_functor, __x._M_functor, __clone_functor); _M_invoker = __x._M_invoker; _M_manager = __x._M_manager; - __x._M_manager(_M_functor, __x._M_functor, __clone_functor); } } @@ -2130,9 +2130,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (_My_handler::_M_not_empty_function(__f)) { + _My_handler::_M_init_functor(_M_functor, __f); _M_invoker = &_My_handler::_M_invoke; _M_manager = &_My_handler::_M_manager; - _My_handler::_M_init_functor(_M_functor, __f); } } |