diff options
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 39 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.tcc | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/cow_string.h | 30 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/formatfwd.h | 71 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/ranges_uninitialized.h | 46 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/version.def | 22 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/version.h | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/version.tpl | 6 |
8 files changed, 147 insertions, 80 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 86841cb..886e7e6 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -45,7 +45,9 @@ #include <initializer_list> #endif -#if __cplusplus >= 201703L +#include <bits/version.h> + +#ifdef __glibcxx_string_view // >= C++17 # include <string_view> #endif @@ -53,7 +55,6 @@ # include <charconv> #endif -#include <bits/version.h> #if ! _GLIBCXX_USE_CXX11_ABI # include "cow_string.h" @@ -146,7 +147,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 return __p; } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 // A helper type for avoiding boiler-plate. typedef basic_string_view<_CharT, _Traits> __sv_type; @@ -788,7 +789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #endif } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Construct string from a substring of a string_view. * @param __t Source object convertible to string view. @@ -944,7 +945,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Set value to string constructed from a string_view. * @param __svt An object convertible to string_view. @@ -1439,7 +1440,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { return this->append(__l.begin(), __l.size()); } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Append a string_view. * @param __svt An object convertible to string_view to be appended. @@ -1556,7 +1557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 append(_InputIterator __first, _InputIterator __last) { return this->replace(end(), end(), __first, __last); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view /** * @brief Append a string_view. * @param __svt An object convertible to string_view to be appended. @@ -1809,7 +1810,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Set value from a string_view. * @param __svt The source object convertible to string_view. @@ -2090,7 +2091,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 return iterator(_M_data() + __pos); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Insert a string_view. * @param __pos Position in string to insert at. @@ -2542,7 +2543,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { return this->replace(__i1, __i2, __l.begin(), __l.size()); } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Replace range of characters with string_view. * @param __pos The position to replace at. @@ -2741,7 +2742,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NOEXCEPT { return this->find(__str.data(), __pos, __str.size()); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find position of a string_view. * @param __svt The object convertible to string_view to locate. @@ -2807,7 +2808,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NOEXCEPT { return this->rfind(__str.data(), __pos, __str.size()); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find last position of a string_view. * @param __svt The object convertible to string_view to locate. @@ -2891,7 +2892,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NOEXCEPT { return this->find_first_of(__str.data(), __pos, __str.size()); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find position of a character of a string_view. * @param __svt An object convertible to string_view containing @@ -2980,7 +2981,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NOEXCEPT { return this->find_last_of(__str.data(), __pos, __str.size()); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find last position of a character of string. * @param __svt An object convertible to string_view containing @@ -3068,7 +3069,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NOEXCEPT { return this->find_first_not_of(__str.data(), __pos, __str.size()); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find position of a character not in a string_view. * @param __svt A object convertible to string_view containing @@ -3155,7 +3156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NOEXCEPT { return this->find_last_not_of(__str.data(), __pos, __str.size()); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find last position of a character not in a string_view. * @param __svt An object convertible to string_view containing @@ -3271,7 +3272,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 return __r; } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Compare to a string_view. * @param __svt An object convertible to string_view to compare against. @@ -4605,7 +4606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 constexpr #endif inline wstring -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 __to_wstring_numeric(string_view __s) #else __to_wstring_numeric(const string& __s) @@ -4808,7 +4809,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // inline namespace literals #endif // __glibcxx_string_udls -#if __cplusplus >= 201703L +#ifdef __glibcxx_variant // >= C++17 namespace __detail::__variant { template<typename> struct _Never_valueless_alt; // see <variant> diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index a5df7cb..02230ac 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -279,11 +279,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Length of string constructed is easier to propagate inter-procedurally // than difference between iterators. template<typename _CharT, typename _Traits, typename _Alloc> - template<bool _Terminated> + template<bool _Terminated> _GLIBCXX20_CONSTEXPR void basic_string<_CharT, _Traits, _Alloc>:: - _M_construct(const _CharT *__str, size_type __n) + _M_construct(const _CharT* __str, size_type __n) { if (__n > size_type(_S_local_capacity)) { diff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h index 740e046..d5b3979 100644 --- a/libstdc++-v3/include/bits/cow_string.h +++ b/libstdc++-v3/include/bits/cow_string.h @@ -467,7 +467,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _S_empty_rep() _GLIBCXX_NOEXCEPT { return _Rep::_S_empty_rep(); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 // A helper type for avoiding boiler-plate. typedef basic_string_view<_CharT, _Traits> __sv_type; @@ -685,7 +685,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_dataplus(_S_construct(__beg, __end, __a), __a) { } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Construct string from a substring of a string_view. * @param __t Source object convertible to string view. @@ -775,7 +775,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Set value to string constructed from a string_view. * @param __svt An object convertible to string_view. @@ -1246,7 +1246,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return this->append(__l.begin(), __l.size()); } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Append a string_view. * @param __svt The object convertible to string_view to be appended. @@ -1338,7 +1338,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION append(_InputIterator __first, _InputIterator __last) { return this->replace(_M_iend(), _M_iend(), __first, __last); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Append a string_view. * @param __svt The object convertible to string_view to be appended. @@ -1496,7 +1496,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return this->assign(__l.begin(), __l.size()); } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Set value from a string_view. * @param __svt The source object convertible to string_view. @@ -1703,7 +1703,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return iterator(_M_data() + __pos); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Insert a string_view. * @param __pos Position in string to insert at. @@ -2092,7 +2092,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return this->replace(__i1, __i2, __l.begin(), __l.end()); } #endif // C++11 -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Replace range of characters with string_view. * @param __pos The position to replace at. @@ -2354,7 +2354,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION size_type find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find position of a string_view. * @param __svt The object convertible to string_view to locate. @@ -2432,7 +2432,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION size_type rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find last position of a string_view. * @param __svt The object convertible to string_view to locate. @@ -2515,7 +2515,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT { return this->find(__c, __pos); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find position of a character of a string_view. * @param __svt An object convertible to string_view containing @@ -2599,7 +2599,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT { return this->rfind(__c, __pos); } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find last position of a character of string. * @param __svt An object convertible to string_view containing @@ -2680,7 +2680,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find position of a character not in a string_view. * @param __svt An object convertible to string_view containing @@ -2762,7 +2762,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION find_last_not_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Find last position of a character not in a string_view. * @param __svt An object convertible to string_view containing @@ -2824,7 +2824,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __r; } -#if __cplusplus >= 201703L +#ifdef __glibcxx_string_view // >= C++17 /** * @brief Compare to a string_view. * @param __svt An object convertible to string_view to compare against. diff --git a/libstdc++-v3/include/bits/formatfwd.h b/libstdc++-v3/include/bits/formatfwd.h new file mode 100644 index 0000000..44922cb --- /dev/null +++ b/libstdc++-v3/include/bits/formatfwd.h @@ -0,0 +1,71 @@ +// <format> Formatting -*- C++ -*- + +// Copyright The GNU Toolchain Authors. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file bits/formatfwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{format} + */ + +#ifndef _GLIBCXX_FORMAT_FWD_H +#define _GLIBCXX_FORMAT_FWD_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +// <bits/version.h> must have been included before this header: +#ifdef __glibcxx_format // C++ >= 20 && HOSTED + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // [format.context], class template basic_format_context + template<typename _Out, typename _CharT> class basic_format_context; + + // [format.parse.ctx], class template basic_format_parse_context + template<typename _CharT> class basic_format_parse_context; + + // [format.formatter], formatter + template<typename _Tp, typename _CharT = char> struct formatter; + +namespace __format +{ +#ifdef _GLIBCXX_USE_WCHAR_T + template<typename _CharT> + concept __char = same_as<_CharT, char> || same_as<_CharT, wchar_t>; +#else + template<typename _CharT> + concept __char = same_as<_CharT, char>; +#endif + + template<__char _CharT> + struct __formatter_int; +} + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // __glibcxx_format +#pragma GCC diagnostic pop +#endif // _GLIBCXX_FORMAT_FWD_H diff --git a/libstdc++-v3/include/bits/ranges_uninitialized.h b/libstdc++-v3/include/bits/ranges_uninitialized.h index b558007..12a714b 100644 --- a/libstdc++-v3/include/bits/ranges_uninitialized.h +++ b/libstdc++-v3/include/bits/ranges_uninitialized.h @@ -263,26 +263,6 @@ namespace ranges inline constexpr __uninitialized_value_construct_n_fn uninitialized_value_construct_n; - namespace __detail - { - // This is only intended for finding smaller iterator differences below, - // not as a general purpose replacement for std::min. - struct __mindist_fn - { - template<typename _Dp1, typename _Dp2> - constexpr common_type_t<_Dp1, _Dp2> - operator()(_Dp1 __d1, _Dp2 __d2) const noexcept - { - // Every C++20 iterator I satisfies weakly_incrementable<I> which - // requires signed-integer-like<iter_difference_t<I>>. - static_assert(std::__detail::__is_signed_integer_like<_Dp1>); - static_assert(std::__detail::__is_signed_integer_like<_Dp2>); - return std::min<common_type_t<_Dp1, _Dp2>>(__d1, __d2); - } - }; - inline constexpr __mindist_fn __mindist{}; - } - template<typename _Iter, typename _Out> using uninitialized_copy_result = in_out_result<_Iter, _Out>; @@ -305,10 +285,10 @@ namespace ranges && is_trivially_assignable_v<_OutType&, iter_reference_t<_Iter>>) { - auto __d1 = __ilast - __ifirst; - auto __d2 = __olast - __ofirst; - return ranges::copy_n(std::move(__ifirst), - __detail::__mindist(__d1, __d2), __ofirst); + auto __d = __ilast - __ifirst; + if (auto __d2 = __olast - __ofirst; __d2 < __d) + __d = static_cast<iter_difference_t<_Iter>>(__d2); + return ranges::copy_n(std::move(__ifirst), __d, __ofirst); } else { @@ -356,9 +336,9 @@ namespace ranges && is_trivially_assignable_v<_OutType&, iter_reference_t<_Iter>>) { - auto __d = __olast - __ofirst; - return ranges::copy_n(std::move(__ifirst), - __detail::__mindist(__n, __d), __ofirst); + if (auto __d = __olast - __ofirst; __d < __n) + __n = static_cast<iter_difference_t<_Iter>>(__d); + return ranges::copy_n(std::move(__ifirst), __n, __ofirst); } else { @@ -397,11 +377,12 @@ namespace ranges && is_trivially_assignable_v<_OutType&, iter_rvalue_reference_t<_Iter>>) { - auto __d1 = __ilast - __ifirst; - auto __d2 = __olast - __ofirst; + auto __d = __ilast - __ifirst; + if (auto __d2 = __olast - __ofirst; __d2 < __d) + __d = static_cast<iter_difference_t<_Iter>>(__d2); auto [__in, __out] = ranges::copy_n(std::make_move_iterator(std::move(__ifirst)), - __detail::__mindist(__d1, __d2), __ofirst); + __d, __ofirst); return {std::move(__in).base(), __out}; } else @@ -452,10 +433,11 @@ namespace ranges && is_trivially_assignable_v<_OutType&, iter_rvalue_reference_t<_Iter>>) { - auto __d = __olast - __ofirst; + if (auto __d = __olast - __ofirst; __d < __n) + __n = static_cast<iter_difference_t<_Iter>>(__d); auto [__in, __out] = ranges::copy_n(std::make_move_iterator(std::move(__ifirst)), - __detail::__mindist(__n, __d), __ofirst); + __n, __ofirst); return {std::move(__in).base(), __out}; } else diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 1468c04..8f609b4 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -30,6 +30,7 @@ AutoGen Definitions version.tpl; // ftms = { // name = FTM NAME; // [stdname = FTM STANDARD MACRO NAME;] +// [no_stdname = true;] // values = { // v = VALUE FOR FTM IF MATCHING; // [extra_cond = STRING;] @@ -56,7 +57,8 @@ AutoGen Definitions version.tpl; // stdname configures the name of the *standard* macro emitted, i.e. it // replaces only the __cpp_lib_ macro in the emitted definition. Defaults to -// __cpp_lib_${name} +// __cpp_lib_${name}. If no_stdname exists (with any value), the stdname +// define is not emitted. // N.B This list needs to be in topological sort order, as later entries in // this list can and do use the earlier entries. @@ -1404,18 +1406,18 @@ ftms = { }; }; -// ftms = { - // name = format_ranges; +ftms = { + name = format_ranges; // 202207 P2286R8 Formatting Ranges // 202207 P2585R1 Improving default container formatting // LWG3750 Too many papers bump __cpp_lib_format - // TODO: #define __cpp_lib_format_ranges 202207L - // values = { - // v = 202207; - // cxxmin = 23; - // hosted = yes; - // }; -// }; + no_stdname = true; // TODO remove + values = { + v = 1; // TODO 202207 + cxxmin = 23; + hosted = yes; + }; +}; ftms = { name = freestanding_algorithm; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index f7c9849..f05c3fd 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -1555,6 +1555,15 @@ #endif /* !defined(__cpp_lib_expected) && defined(__glibcxx_want_expected) */ #undef __glibcxx_want_expected +#if !defined(__cpp_lib_format_ranges) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_format_ranges 1L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format_ranges) +# endif +# endif +#endif /* !defined(__cpp_lib_format_ranges) && defined(__glibcxx_want_format_ranges) */ +#undef __glibcxx_want_format_ranges + #if !defined(__cpp_lib_freestanding_algorithm) # if (__cplusplus >= 202100L) # define __glibcxx_freestanding_algorithm 202311L diff --git a/libstdc++-v3/include/bits/version.tpl b/libstdc++-v3/include/bits/version.tpl index dd5f851..ccda71d 100644 --- a/libstdc++-v3/include/bits/version.tpl +++ b/libstdc++-v3/include/bits/version.tpl @@ -143,13 +143,15 @@ h }*/# /*{(unless (first-for?) "el")}*/if /*{(generate-cond)}*/ # define __glibcxx_/*{name}*/ /*{v}*/L -# if defined(__glibcxx_want_all) || defined(__glibcxx_want_/*{name}*/) +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_/*{name}*/)/*{ + IF (not (exist? "no_stdname")) }*/ # define /*{ ;; Compute the name for this FTM based on stdname/name. (if (exist? "stdname") (get "stdname") (format #f "__cpp_lib_~a" (get "name"))) -}*/ /*{v}*/L +}*/ /*{v}*/L/*{ + ENDIF no_std_name }*/ # endif /*{ ENDFOR values }*/# endif |