diff options
| author | mrg <mrg@NetBSD.org> | 2021-04-10 22:09:55 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 2021-04-10 22:09:55 +0000 |
| commit | 8d28633601d8a184a21892a7e166fecf6183ddbf (patch) | |
| tree | 23ad50e3ad3a92cf50af842a908a90c767f81305 /external/gpl3/gcc/dist/libstdc++-v3/include/debug/array | |
| parent | 0e3e430efea53dd5f41045ab28e13e5be2871153 (diff) | |
initial import of GCC 10.3.0. main changes include:
caveats:
- ABI issue between c++14 and c++17 fixed
- profile mode is removed from libstdc++
- -fno-common is now the default
new features:
- new flags -fallocation-dce, -fprofile-partial-training,
-fprofile-reproducible, -fprofile-prefix-path, and -fanalyzer
- many new compile and link time optimisations
- enhanced drive optimisations
- openacc 2.6 support
- openmp 5.0 features
- new warnings: -Wstring-compare and -Wzero-length-bounds
- extended warnings: -Warray-bounds, -Wformat-overflow,
-Wrestrict, -Wreturn-local-addr, -Wstringop-overflow,
-Warith-conversion, -Wmismatched-tags, and -Wredundant-tags
- some likely C2X features implemented
- more C++20 implemented
- many new arm & intel CPUs known
hundreds of reported bugs are fixed. full list of changes
can be found at:
https://gcc.gnu.org/gcc-10/changes.html
Diffstat (limited to 'external/gpl3/gcc/dist/libstdc++-v3/include/debug/array')
| -rw-r--r-- | external/gpl3/gcc/dist/libstdc++-v3/include/debug/array | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/external/gpl3/gcc/dist/libstdc++-v3/include/debug/array b/external/gpl3/gcc/dist/libstdc++-v3/include/debug/array index 9e94e656c04..dd4044c9c7b 100644 --- a/external/gpl3/gcc/dist/libstdc++-v3/include/debug/array +++ b/external/gpl3/gcc/dist/libstdc++-v3/include/debug/array @@ -1,6 +1,6 @@ // Debugging array implementation -*- C++ -*- -// Copyright (C) 2012-2019 Free Software Foundation, Inc. +// Copyright (C) 2012-2020 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 @@ -80,11 +80,11 @@ namespace __debug // No explicit construct/copy/destroy for aggregate type. // DR 776. - void + _GLIBCXX20_CONSTEXPR void fill(const value_type& __u) { std::fill_n(begin(), size(), __u); } - void + _GLIBCXX20_CONSTEXPR void swap(array& __other) noexcept(_AT_Type::_Is_nothrow_swappable::value) { std::swap_ranges(begin(), end(), __other.begin()); } @@ -234,16 +234,38 @@ namespace __debug // Array comparisons. template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline bool operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return std::equal(__one.begin(), __one.end(), __two.begin()); } +#if __cpp_lib_three_way_comparison && __cpp_lib_concepts + template<typename _Tp, size_t _Nm> + constexpr __detail::__synth3way_t<_Tp> + operator<=>(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) + { + if constexpr (_Nm && __is_byte<_Tp>::__value) + return __builtin_memcmp(__a.data(), __b.data(), _Nm) <=> 0; + else + { + for (size_t __i = 0; __i < _Nm; ++__i) + { + auto __c = __detail::__synth3way(__a[__i], __b[__i]); + if (__c != 0) + return __c; + } + } + return strong_ordering::equal; + } +#else template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline bool operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one == __two); } template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline bool operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) { @@ -252,19 +274,23 @@ namespace __debug } template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline bool operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return __two < __one; } template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline bool operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one > __two); } template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline bool operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { return !(__one < __two); } +#endif // three_way_comparison && concepts // Specialized algorithms. @@ -276,6 +302,7 @@ namespace __debug #endif template<typename _Tp, std::size_t _Nm> + _GLIBCXX20_CONSTEXPR inline void swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) noexcept(noexcept(__one.swap(__two))) @@ -314,6 +341,45 @@ namespace __debug static_assert(_Int < _Nm, "index is out of bounds"); return std::move(__debug::get<_Int>(__arr)); } + +#if __cplusplus > 201703L +#define __cpp_lib_to_array 201907L + + template<bool _Move = false, typename _Tp, size_t... _Idx> + constexpr array<remove_cv_t<_Tp>, sizeof...(_Idx)> + __to_array(_Tp (&__a)[sizeof...(_Idx)], index_sequence<_Idx...>) + { + if constexpr (_Move) + return {{std::move(__a[_Idx])...}}; + else + return {{__a[_Idx]...}}; + } + + template<typename _Tp, size_t _Nm> + constexpr array<remove_cv_t<_Tp>, _Nm> + to_array(_Tp (&__a)[_Nm]) + noexcept(is_nothrow_constructible_v<_Tp, _Tp&>) + { + static_assert(!is_array_v<_Tp>); + static_assert(is_constructible_v<_Tp, _Tp&>); + if constexpr (is_constructible_v<_Tp, _Tp&>) + return __debug::__to_array(__a, make_index_sequence<_Nm>{}); + __builtin_unreachable(); // FIXME: see PR c++/91388 + } + + template<typename _Tp, size_t _Nm> + constexpr array<remove_cv_t<_Tp>, _Nm> + to_array(_Tp (&&__a)[_Nm]) + noexcept(is_nothrow_move_constructible_v<_Tp>) + { + static_assert(!is_array_v<_Tp>); + static_assert(is_move_constructible_v<_Tp>); + if constexpr (is_move_constructible_v<_Tp>) + return __debug::__to_array<1>(__a, make_index_sequence<_Nm>{}); + __builtin_unreachable(); // FIXME: see PR c++/91388 + } +#endif // C++20 + } // namespace __debug _GLIBCXX_BEGIN_NAMESPACE_VERSION |
