summaryrefslogtreecommitdiff
path: root/libstdc++-v3
Commit message (Collapse)AuthorAgeFilesLines
* libstdc++: Fix brainwrong in path::_S_convert(T) [PR102743]Jonathan Wakely2021-10-141-1/+1
| | | | | | | | | | | | | | | | | | | This function was supposed to check whether the parameter's value type is the same as path::value_type, and therefore needs no conversion. Instead it checks whether the parameter is the same as its own value type, which is never true. This means we incorrectly return a string view for the case where T is path::string_type, instead of just returning the string itself. The only place that happens is path::_S_convert_loc for Windows, where we call _S_convert with a std::wstring rvalue. This fixes the condition in _S_convert(T). libstdc++-v3/ChangeLog: PR libstdc++/102743 * include/bits/fs_path.h (path::_S_convert(T)): Fix condition for returning the same string unchanged.
* libstdc++: Use more descriptive feature test macroJonathan Wakely2021-10-141-1/+1
| | | | | | | | | | | The out-of-class definitions of the static constants are redundant if the __cpp_inline_variables feature is supported, so use that macro to decide whether to define them or not. libstdc++-v3/ChangeLog: * include/bits/regex.h: Check __cpp_inline_variables instead of __cplusplus.
* libstdc++: Fix test for feature test macroJonathan Wakely2021-10-141-1/+1
| | | | | | | libstdc++-v3/ChangeLog: * testsuite/20_util/is_layout_compatible/version.cc: Check correct macro.
* libstdc++: Add missing constexpr to std::optional (P2231R1)Jonathan Wakely2021-10-149-18/+225
| | | | | | | | | | | | | | | | | | | | | This implements the changes in P2231R1 which make std::optional fully constexpr in C++20. libstdc++-v3/ChangeLog: * include/bits/stl_construct.h (_Construct): Use std::construct_at when constant evaluated. * include/std/optional (_Storage, _Optional_payload, optional): Add constexpr as specified by P2231R1. * include/std/version (__cpp_lib_optional): Update value for C++20. * testsuite/20_util/optional/requirements.cc: Check feature test macro. * testsuite/20_util/optional/constexpr/assign.cc: New test. * testsuite/20_util/optional/constexpr/cons/conv.cc: New test. * testsuite/20_util/optional/constexpr/modifiers.cc: New test. * testsuite/20_util/optional/constexpr/swap.cc: New test. * testsuite/20_util/optional/version.cc: New test.
* Daily bump.GCC Administrator2021-10-141-0/+41
|
* libstdc++: Fix regression in memory use when constructing pathsJonathan Wakely2021-10-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | The changes in r12-4381 were intended to reduce memory usage, but replacing the __contiguous constant in __string_from_range with the new __is_contiguous variable template caused a regression. The old code checked is_pointer_v<decltype(std::__niter_base(__first))> but he new code just checks is_pointer_v<_InputIterator>. This means that we no longer recognise basic_string::iterator and vector::iterator as contiguous, and so return a temporary basic_string instead of a basic_string_view. This only affects C++17 mode, because the std::contiguous_iterator concept is used in C++20 which gives the right answer for __normal_iterator (and more types as well). The fix is to specialize the new __is_contiguous variable template so it is true for __normal_iterator<T*, C> specializations. The new partial specializations are defined for C++20 too, because it should be cheaper to match the partial specialization than to check whether the std::contiguous_iterator concept is satisfied. libstdc++-v3/ChangeLog: * include/bits/fs_path.h (__detail::__is_contiguous): Add partial specializations for pointers and __normal_iterator.
* libstdc++: Rename files with the wrong extensionsJonathan Wakely2021-10-132-0/+0
| | | | | | | | | libstdc++-v3/ChangeLog: * testsuite/27_io/filesystem/path/construct/102592.C: Moved to... * testsuite/27_io/filesystem/path/construct/102592.cc: ...here. * testsuite/28_regex/match_results/102667.C: Moved to... * testsuite/28_regex/match_results/102667.cc: ...here.
* libstdc++: Refactor filesystem::path encoding conversionsJonathan Wakely2021-10-131-45/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjust the __detail::__effective_range overloads so they always return a string or string view using std::char_traits, because we don't care about the traits of an incoming string. Use std::contiguous_iterator in the __effective_range(const Source&) overload, to allow returning a basic_string_view in more cases. For the non-contiguous casecl in both __effective_range and __string_from_range, return a std::string instead of std::u8string when the value type of the range is char8_t. These changes avoid unnecessary basic_string temporaries. Also simplify __string_from_range(Iter, Iter) to not need std::__to_address for the contiguous case. Combine the _S_convert(string_type) and _S_convert(const T&) overloads into a single _S_convert(T) function which also avoids the dangling view problem of PR 102592 (should that recur somehow). libstdc++-v3/ChangeLog: * include/bits/fs_path.h (__detail::__is_contiguous): New variable template to identify contiguous iterators. (__detail::__unified_char8_t): New alias template to decide when to treat char8_t as char without encoding conversion. (__detail::__effective_range(const basic_string<C,T>&)): Use std::char_traits<C> for returned string view. (__detail::__effective_range(const basic_string_view<C,T>&)): Likewise. (__detail::__effective_range(const Source&)): Use __is_contiguous to detect mode cases of contiguous iterators. Use __unified_char8_t to return a std::string instead of std::u8string.
* libstdc++: Fix dangling string_view in filesystem::path [PR102592]Jonathan Wakely2021-10-132-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a path from a pair of non-contiguous iterators we pass the iterators to _S_convert(Iter, Iter). That function passes the iterators to __string_from_range to get a contiguous sequence of characters, and then calls _S_convert(const C*, const C*) to perform the encoding conversions. If the value type, C, is char8_t, then no conversion is needed and the _S_convert<char8_t>(const char8_t*, const char8_t*) specialization casts the pointer to const char* and returns a std::string_view that refs to the char8_t sequence. However, that sequence is owned by the std::u8string rvalue returned by __string_from_range, which goes out of scope when _S_convert(Iter, Iter) returns. That means the std::string_view is dangling and we get undefined behaviour when parsing it as a path. The same problem does not exist for the path members taking a "Source" argument, because those functions all convert a non-contiguous range into a basic_string<C> immediately, using __effective_range(__source). That means that the rvalue string returned by that function is still in scope for the full expression, so the string_view does not dangle. The solution for the buggy functions is to do the same thing, and call __string_from_range immediately, so that the returned rvalue is still in scope for the lifetime of the string_view returned by _S_convert. To avoid reintroducing the same problem, remove the _S_convert(Iter, Iter) overload that calls __string_from_range and returns a dangling view. libstdc++-v3/ChangeLog: PR libstdc++/102592 * include/bits/fs_path.h (path::path(Iter, Iter, format)) (path::append(Iter, Iter), path::concat(Iter, Iter)): Call __string_from_range directly, instead of two-argument overload of _S_convert. (path::_S_convert(Iter, Iter)): Remove. * testsuite/27_io/filesystem/path/construct/102592.C: New test.
* libstdc++: Ensure language linkage of std::__terminate()Jonathan Wakely2021-10-131-1/+1
| | | | | | | | | | | | This is needed because people still find it necessary to do: extern "C" { #include <stdlib.h> } libstdc++-v3/ChangeLog: * include/bits/c++config (__terminate): Add extern "C++".
* Daily bump.GCC Administrator2021-10-131-0/+21
|
* libstdc++: Fix test that fails for C++20Jonathan Wakely2021-10-122-1/+9
| | | | | | | | | | | | | Also restore the test for 'a < a' that was removed by r12-2537 because it is ill-formed. We still want to test operator< for tuple, we just need to not use std::nullptr_t in that tuple type. libstdc++-v3/ChangeLog: * testsuite/20_util/tuple/comparison_operators/overloaded.cc: Restore test for operator<. * testsuite/20_util/tuple/comparison_operators/overloaded2.cc: Adjust expected errors for C++20.
* libstdc++: Fix move construction of std::tuple with array elements [PR101960]Jonathan Wakely2021-10-122-8/+11
| | | | | | | | | | | | | | | | | The r12-3022 commit only fixed the case where an array is the last element of the tuple. This fixes the other cases too. We can just define the move constructor as defaulted, which does the right thing. Changing the move constructor to be trivial would be an ABI break, but since the last base class still has a non-trivial move constructor, defining the derived ones as defaulted doesn't change anything. libstdc++-v3/ChangeLog: PR libstdc++/101960 * include/std/tuple (_Tuple_impl(_Tuple_impl&&)): Define as defauled. * testsuite/20_util/tuple/cons/101960.cc: Check tuples with array elements before the last element.
* libstdc++: Improve diagnostics for misuses of output iteratorsJonathan Wakely2021-10-121-0/+14
| | | | | | | | | | | | This adds deleted overloads so that the errors for invalid uses of std::advance and std::distance are easier to understand (see for example PR 102181). libstdc++-v3/ChangeLog: * include/bits/stl_iterator_base_funcs.h (__advance): Add deleted overload to improve diagnostics. (__distance): Likewise.
* Daily bump.GCC Administrator2021-10-121-0/+39
|
* libstdc++: Add wrapper for internal uses of std::terminateJonathan Wakely2021-10-115-10/+16
| | | | | | | | | | | | | | | | This adds an inline wrapper for std::terminate that doesn't add the declaration of std::terminate to namespace std. This allows the library to terminate without including all of <exception>. libstdc++-v3/ChangeLog: * include/bits/atomic_timed_wait.h: Remove unused header. * include/bits/c++config (std:__terminate): Define. * include/bits/semaphore_base.h: Remove <exception> and use __terminate instead of terminate. * include/bits/std_thread.h: Likewise. * libsupc++/eh_terminate.cc (std::terminate): Use qualified-id to call __cxxabiv1::__terminate.
* libstdc++: Simplify std::basic_regex::assignJonathan Wakely2021-10-111-4/+5
| | | | | | | | | | | | We know that if __is_contiguous_iterator is true then we have a pointer or a __normal_iterator that wraps a pointer, so we don't need to use std::__to_address. libstdc++-v3/ChangeLog: * include/bits/regex.h (basic_regex::assign(Iter, Iter)): Avoid std::__to_address by using poitner directly or using base() member of __normal_iterator.
* libstdc++: Fix std::numeric_limits::lowest() test for strict modesJonathan Wakely2021-10-111-15/+5
| | | | | | | | | | | | | | | | This test uses std::is_integral to decide whether we are testing an integral or floating-point type. But that fails for __int128 because is_integral<__int128> is false in strict modes. By using numeric_limits::is_integer instead we get the right answer for all types that have a numeric_limits specialization. We can also simplify the test by removing the unnecessary tag dispatching. libstdc++-v3/ChangeLog: * testsuite/18_support/numeric_limits/lowest.cc: Use numeric_limits<T>::is_integer instead of is_integral<T>::value.
* libstdc++: Add valid range assertions to std::basic_regex [PR89927]Jonathan Wakely2021-10-112-3/+7
| | | | | | | | | | | | | | | | | | | | | | This adds some debug assertions to basic_regex. They don't actually diagnose the error in the PR yet, but I have another patch to make them more effective. Also change the __glibcxx_assert(false) consistency checks to include a string literal that tells the user a bit more about why the process aborted. We could consider adding a __glibcxx_bug or __glibcxx_internal_error macro for this purpose, but ideally we'll never hit such bugs anyway so it shouldn't be needed. libstdc++-v3/ChangeLog: PR libstdc++/89927 * include/bits/regex.h (basic_regex(const _Ch_type*, size_t)): Add __glibcxx_requires_string_len assertion. (basic_regex::assign(InputIterator, InputIterator)): Add __glibcxx_requires_valid_range assertion. * include/bits/regex_scanner.tcc (_Scanner::_M_advance()) (_Scanner::_M_scan_normal()): Use string literal in assertions.
* libstdc++: Fix std::match_results::end() for failed matches [PR102667]Jonathan Wakely2021-10-112-2/+41
| | | | | | | | | | | | | | | | | The end() function needs to consider whether the underlying vector is empty, not whether the match_results object is empty. That's because the underlying vector will always contain at least three elements for a match_results object that is "ready". It contains three extra elements which are stored in the vector but are not considered part of sequence, and so should not be part of the [begin(),end()) range. libstdc++-v3/ChangeLog: PR libstdc++/102667 * include/bits/regex.h (match_result::empty()): Optimize by calling the base function directly. (match_results::end()): Check _Base_type::empty() not empty(). * testsuite/28_regex/match_results/102667.C: New test.
* ChangeLog: Remove incorrect PR referenceJonathan Wakely2021-10-111-1/+0
|
* Daily bump.GCC Administrator2021-10-091-0/+298
|
* libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite ↵Jonathan Wakely2021-10-0967-189/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [PR98725] Now that std::wstring and other specializations for wchar_t are defined unconditionally, many checks for _GLIBCXX_USE_WCHAR_T in the testsuite are unnecessary and can be removed. Tests for iostreams, locales, regex and filesystem::path still need to be guarded by _GLIBCXX_USE_WCHAR_T because those components depend on libc support in <wchar.h> and other headers. libstdc++-v3/ChangeLog: PR libstdc++/98725 * testsuite/18_support/numeric_limits/lowest.cc: Remove use of _GLIBCXX_USE_WCHAR_T. * testsuite/18_support/numeric_limits/min_max.cc: Replace use of _GLIBCXX_USE_WCHAR_T with checks for WCHAR_MIN and WCHAR_MAX. * testsuite/20_util/from_chars/1_neg.cc: Remove use of _GLIBCXX_USE_WCHAR_T. * testsuite/20_util/function_objects/searchers.cc: Likewise. Use char_traits<wchar_t>::length instead of wcslen. * testsuite/20_util/hash/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_arithmetic/value.cc: Likewise. * testsuite/20_util/is_compound/value.cc: Likewise. * testsuite/20_util/is_floating_point/value.cc: Likewise. * testsuite/20_util/is_fundamental/value.cc: Likewise. * testsuite/20_util/is_integral/value.cc: Likewise. * testsuite/20_util/is_signed/value.cc: Likewise. * testsuite/20_util/is_unsigned/value.cc: Likewise. * testsuite/20_util/is_void/value.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs-1.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs-2.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs-3.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs-4.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs-1.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs-2.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs-3.cc: Likewise. * testsuite/20_util/to_chars/3.cc: Likewise. * testsuite/20_util/type_identity/requirements/typedefs.cc: Likewise. * testsuite/21_strings/basic_string/hash/debug.cc: Likewise. * testsuite/21_strings/basic_string/hash/hash.cc: Likewise. * testsuite/21_strings/basic_string/literals/types-char8_t.cc: Likewise. * testsuite/21_strings/basic_string/literals/types.cc: Likewise. * testsuite/21_strings/basic_string/literals/values-char8_t.cc: Likewise. * testsuite/21_strings/basic_string/literals/values.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/64422.cc: Likewise. * testsuite/21_strings/basic_string/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string/requirements/citerators.cc: Likewise. * testsuite/21_strings/basic_string/requirements/typedefs.cc: Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/types-char8_t.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/types.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/values-char8_t.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/values.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/typedefs.cc: Likewise. * testsuite/21_strings/char_traits/requirements/constexpr_functions.cc: Likewise. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc: Likewise. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: Likewise. * testsuite/22_locale/ctype/is/string/89728_neg.cc: Likewise. * testsuite/25_algorithms/fill/4.cc: Likewise. * testsuite/25_algorithms/fill_n/1.cc: Likewise. * testsuite/experimental/functional/searchers.cc: Likewise. Use char_traits<wchar_t>::length instead of wcslen. * testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc: Likewise. * testsuite/experimental/string_view/literals/types-char8_t.cc: Likewise. * testsuite/experimental/string_view/literals/types.cc: Likewise. * testsuite/experimental/string_view/literals/values-char8_t.cc: Likewise. * testsuite/experimental/string_view/literals/values.cc: Likewise. * testsuite/experimental/string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/experimental/string_view/requirements/typedefs.cc: Likewise. * testsuite/experimental/string_view/typedefs.cc: Likewise. * testsuite/ext/vstring/range_access.cc: Likewise. * testsuite/std/concepts/concepts.lang/concept.arithmetic/integral.cc: Likewise. * testsuite/std/concepts/concepts.lang/concept.arithmetic/signed_integral.cc: Likewise. * testsuite/std/concepts/concepts.lang/concept.arithmetic/unsigned_integral.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_arithmetic/value.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_compound/value.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_floating_point/value.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_fundamental/value.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_integral/value.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_signed/value.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_unsigned/value.cc: Likewise. * testsuite/tr1/4_metaprogramming/is_void/value.cc: Likewise. * testsuite/tr1/6_containers/hash/24799.cc: Likewise.
* libstdc++: Define deleted wchar_t overloads unconditionally [PR 98725]Jonathan Wakely2021-10-091-4/+0
| | | | | | | | | | | | We don't need to have <wchar.h> support in order to delete overloads for inserting wide characters into narrow streams. libstdc++-v3/ChangeLog: PR libstdc++/98725 * include/std/ostream (operator<<(basic_ostream<char, Tr>&, wchar_t)) (operator<<(basic_ostream<char, Tr>&, const wchar_t*)): Always define as deleted. Do not check _GLIBCXX_USE_WCHAR_T.
* libstdc++: Define std::wstring_convert unconditionally [PR 98725]Jonathan Wakely2021-10-091-4/+0
| | | | | | | | | | | | | | The wchar_t type is defined unconditionally for C++, so there is no reason for std::wstring_convert and std::wbuffer_convert to be disabled when <wchar.h> is not usable. It should be possible to use those class templates with char16_t and char32_t even if wchar_t conversions don't work. libstdc++-v3/ChangeLog: PR libstdc++/98725 * include/bits/locale_conv.h (wstring_convert, wbuffer_convert): Define unconditionally. Do not check _GLIBCXX_USE_WCHAR_T.
* libstdc++: Enable type traits for wchar_t unconditionally [PR98725]Jonathan Wakely2021-10-093-11/+1
| | | | | | | | | | | | | | | | None of these traits depend on libc support for wchar_t, so they should be defined unconditionally. The wchar_t type is always defined in C++. libstdc++-v3/ChangeLog: PR libstdc++/98725 * include/c_global/cstddef [!_GLIBCXX_USE_WCHAR_T] (__byte_operand<wchar_t>): Define specialization. * include/std/type_traits (__make_signed<wchar_t>) (__make_unsigned<wchar_t>): Remove redundant check for __WCHAR_TYPE__ being defined. * include/tr1/type_traits [!_GLIBCXX_USE_WCHAR_T] (__is_integral_helper<wchar_t>): Likewise.
* libstdc++: Enable vstring for wchar_t unconditionally [PR98725]Jonathan Wakely2021-10-093-6/+0
| | | | | | | | | | | | | | | | None of these vstring specializations depend on libc support for wchar_t, so can be enabled unconditionally now that char_traits<wchar_t> is always available. libstdc++-v3/ChangeLog: PR libstdc++/98725 * include/ext/rc_string_base.h [!_GLIBCXX_USE_WCHAR_T] (__rc_string_base<wchar_t>): Define member function. * include/ext/vstring.h [!_GLIBCXX_USE_WCHAR_T] (hash<__gnu_cxx::__wvstring>): Define specialization. * include/ext/vstring_fwd.h [!_GLIBCXX_USE_WCHAR_T] (__wvstring) (__wsso_string, __wrc_string): Declare typedefs.
* libstdc++: Always define typedefs and hash functions for wide strings [PR 98725]Jonathan Wakely2021-10-097-27/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The wstring and wstring_view typedefs should be enabled even if <wchar.h> isn't supported, because char_traits<wchar_t> works unconditionally. Similarly, the std::hash specializations for wide strings do not depend on <wchar.h> support. Although the primary template works OK for std::char_traits<wchar_t> in the absence of <wchar.h> support, this patch still defines it as an explicit specialization for compatibility with declarations that expect it to be specialized. The explicit specialization just uses the same __gnu_cxx::char_traits base class as the primary template. libstdc++-v3/ChangeLog: PR libstdc++/98725 * include/bits/char_traits.h (char_traits<wchar_t>): Define explicit specialization unconditionally. * include/bits/basic_string.h (hash<wstring>): Define unconditionally. Do not check _GLIBCXX_USE_WCHAR_T. * include/bits/stringfwd.h (wstring): Likewise. * include/debug/string (wstring): Likewise. * include/experimental/string_view (experimental::wstring_view) (hash<experimental::wstring_view>): Likewise. * include/std/string (pmr::wstring, hash<pmr::wstring>): Likewise. * include/std/string_view (wstring_view, hash<wstring_view>): Likewise.
* libstdc++: Move test that depends on wchar_t I/O to wchar_t sub-directoryJonathan Wakely2021-10-091-0/+0
| | | | | | | | | This fixes a FAIL when --disable-wchar_t is used. libstdc++-v3/ChangeLog: * testsuite/27_io/basic_filebuf/close/81256.cc: Moved to... * testsuite/27_io/basic_filebuf/close/wchar_t/81256.cc: ...here.
* libstdc++: Add missing _GLIBCXX_USE_WCHAR_T checks in testsuiteJonathan Wakely2021-10-0913-5/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tests fail for a --disable-wchar_t build. libstdc++-v3/ChangeLog: * testsuite/22_locale/conversions/buffer/1.cc: Check _GLIBCXX_USE_WCHAR_T. * testsuite/22_locale/conversions/buffer/3.cc: Likewise. Add test using char16_t. * testsuite/22_locale/conversions/string/1.cc: Check _GLIBCXX_USE_WCHAR_T. * testsuite/27_io/filesystem/path/generic/generic_string.cc: Likewise. * testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: Likewise. * testsuite/27_io/filesystem/path/native/alloc.cc: Likewise. * testsuite/27_io/filesystem/path/native/string-char8_t.cc: Likewise. * testsuite/27_io/filesystem/path/native/string.cc: Likewise. * testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc: Likewise. * testsuite/experimental/filesystem/path/generic/generic_string.cc: Likewise. * testsuite/experimental/filesystem/path/native/alloc.cc: Likewise. * testsuite/experimental/filesystem/path/native/string-char8_t.cc: Likewise. * testsuite/experimental/filesystem/path/native/string.cc: Likewise.
* libstdc++: Replace uses of _GLIBCXX_USE_INT128 in testsuiteJonathan Wakely2021-10-0925-26/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since r12-435 the _GLIBCXX_USE_INT128 macro is never defined, so all uses of it in the testsuite are wrong. The tests should be checking __SIZEOF_INT128__ instead. Also add some tests for an INT_3 type, which were missing. libstdc++-v3/ChangeLog: * testsuite/18_support/numeric_limits/40856.cc: Replace use of _GLIBCXX_USE_INT128. * testsuite/18_support/numeric_limits/dr559.cc: Likewise. * testsuite/18_support/numeric_limits/lowest.cc: Likewise. * testsuite/18_support/numeric_limits/max_digits10.cc: Likewise. * testsuite/20_util/is_floating_point/value.cc: Likewise. * testsuite/20_util/is_integral/value.cc: Likewise. * testsuite/20_util/is_signed/value.cc: Likewise. * testsuite/20_util/is_unsigned/value.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs-1.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs-2.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs-1.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs-2.cc: Likewise. * testsuite/20_util/type_identity/requirements/typedefs.cc: Likewise. * testsuite/26_numerics/bit/bit.count/countl_one.cc: Likewise. * testsuite/26_numerics/bit/bit.count/countl_zero.cc: Likewise. * testsuite/26_numerics/bit/bit.count/countr_one.cc: Likewise. * testsuite/26_numerics/bit/bit.count/countr_zero.cc: Likewise. * testsuite/26_numerics/bit/bit.count/popcount.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/bit_width.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc: Likewise. * testsuite/26_numerics/bit/bit.rotate/rotl.cc: Likewise. libstdc++-v3/ChangeLog: * testsuite/26_numerics/bit/bit.rotate/rotr.cc: * testsuite/util/testsuite_common_types.h:
* libstdc++: Access std::pair members without tuple-like helpersJonathan Wakely2021-10-093-76/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids the tuple-like API for std::pair in the unordered containers, removing some overly generic code. The _Select1st projection can figure out the member types of a std::pair without using decltype(std::get<0>(...)). We don't need _Select2nd because it's only needed in _NodeBuilder::_S_build, and that can just access the .second member of the pair directly. The return type of that function doesn't need to be deduced by decltype, we can just expose the __node_type typedef of the node generator. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Select1st): Replace use of std::get. (_Select2nd): Remove. (_NodeBuilder::_S_build): Use _NodeGenerator::__node_type typedef instead of deducing it. Remove unnecessary piecewise construction. (_ReuseOrAllocNode): Make __node_type public. (_Map_base): Adjust partial specialization to be able to extract the mapped_type without using tuple_element. (_Map_base::at): Define inline * testsuite/23_containers/unordered_map/requirements/53339.cc: Remove XFAIL. * testsuite/23_containers/unordered_multimap/requirements/53339.cc: Likewise.
* libstdc++: Avoid instantiation of _Hash_node before it's neededJonathan Wakely2021-10-092-9/+17
| | | | | | | | | | | | | | | | | | | | | | This is a step towards restoring support for incomplete types in unordered containers (PR 53339). We do not need to instantiate the node type to get its value_type member, because we know that the value type is the first template parameter. We can deduce that template argument using a custom trait and a partial specialization for _Hash_node. If we wanted to support custom hash node types we could still use typename _Tp::value_type in the primary template of that trait, but that seems unnecessary. The other change needed is to defer a static assert at class scope, so that it is done when the types are complete. We must have a complete type in the destructor, so we can do it there instead. libstdc++-v3/ChangeLog: * include/bits/hashtable.h: Move static assertion to destructor. * include/bits/hashtable_policy.h: Deduce value type from node type without instantiating it.
* libstdc++: Detect miscompilation of src/c++11/limits.ccJonathan Wakely2021-10-081-0/+4
| | | | | | | | | | | Add a #error directive to ensure that the definitions are not compiled as C++17, which would prevent them being emitted. libstdc++-v3/ChangeLog: PR libstdc++/98725 * src/c++11/limits.cc: Fail if __cpp_inline_variables is defined.
* libstdc++: Reduce header dependencies of <algorithm> in C++20 [PR 92546]Jonathan Wakely2021-10-081-1/+3
| | | | | | | | | | | The <bits/ranges_algobase.h> header doesn't need the stream and streambuf iterators, so don't include the whole of <iterator>. libstdc++-v3/ChangeLog: PR libstdc++/92546 * include/bits/ranges_algobase.h: Replace <iterator> with a subset of the headers it includes.
* libstdc++: Restore debug checks in uniform container erasure functionsJonathan Wakely2021-10-0812-103/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit 561078480ffb5adb68577276c6b23e4ee7b39272. If we avoid all debug mode checks when erasing elements then we fail to invalidate safe iterators to the removed elements. This reverts the recent changes in r12-4083 and r12-4233, restoring the debug checking. libstdc++-v3/ChangeLog: * include/experimental/deque (erase, erase_if): Revert changes to avoid debug mode overhead. * include/experimental/map (erase, erase_if): Likewise. * include/experimental/set (erase, erase_if): Likewise. * include/experimental/unordered_map (erase, erase_if): Likewise. * include/experimental/unordered_set (erase, erase_if): Likewise. * include/experimental/vector (erase, erase_if): Likewise. * include/std/deque (erase, erase_if): Likewise. * include/std/map (erase, erase_if): Likewise. * include/std/set (erase, erase_if): Likewise. * include/std/unordered_map (erase, erase_if): Likewise. * include/std/unordered_set (erase, erase_if): Likewise. * include/std/vector (erase, erase_if): Likewise.
* libstdc++: Implement ostream insertion for chrono::durationJonathan Wakely2021-10-082-0/+153
| | | | | | | | | | | | | | | | This is a missing piece of the C++20 <chrono> header. It would be good to move the code into the compiled library, so that we don't need <sstream> in <chrono>. It could also use spanstream in C++20, to avoid memory allocations. That can be changed at a later date. libstdc++-v3/ChangeLog: * include/std/chrono (__detail::__units_suffix_misc): New helper function. (__detail::__units_suffix): Likewise. (chrono::operator<<(basic_ostream&, const duration&)): Define. * testsuite/20_util/duration/io.cc: New test.
* Daily bump.GCC Administrator2021-10-081-0/+51
|
* libstdc++: Move C++14 <chrono> components to new <bits/chrono.h> headerJonathan Wakely2021-10-0718-1375/+1434
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves the "classic" contents of <chrono> to a new header, so that <future>, <thread> etc. can get use durations and clocks without calendar types, time zones, and chrono I/O. libstdc++-v3/ChangeLog: * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/std/chrono (duration, time_point, system_clock) (steady_clock, high_resolution_clock, chrono_literals, sys_time) (file_clock, file_time): Move to ... * include/bits/chrono.h: New file. * include/bits/atomic_futex.h: Include new header instead of <chrono>. * include/bits/atomic_timed_wait.h: Likewise. * include/bits/fs_fwd.h: Likewise. * include/bits/semaphore_base.h: Likewise. * include/bits/this_thread_sleep.h: Likewise. * include/bits/unique_lock.h: Likewise. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/chrono: Likewise. * include/experimental/io_context: Likewise. * include/experimental/netfwd: Likewise. * include/experimental/timer: Likewise. * include/std/condition_variable: Likewise. * include/std/mutex: Likewise. * include/std/shared_mutex: Likewise.
* libstdc++: Avoid use of hardware interference non-constant [PR102377]Jonathan Wakely2021-10-071-5/+3
| | | | | | | | libstdc++-v3/ChangeLog: PR libstdc++/102377 * include/bits/atomic_wait.h (__waiter_pool_base:_S_align): Hardcode to 64 instead of using non-constant constant.
* libstdc++: Avoid debug checks in uniform container erasure functionsJonathan Wakely2021-10-0714-63/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit r12-4083 I tried to make the std::erase and std::erase_if function avoid the unnecessary overhead of safe iterators. It didn't work, for two reasons. Firstly, for the RB tree containers the __niter_base function is a no-op (because the iterators aren't random access) so the safe iterators were still used. Secondly, for the cases where __niter_base did remove the safe iterator layer, there was still unnecessary overhead to create a new safe iterator and link it to the container. This solves the problem by simply binding a reference to the non-debug version of the conainer. For normal mode this is a no-op, and for debug mode it binds a reference to the debug container's base class. That means the rest of the function operates directly on the non-debug container, and avoids all checking. For std::basic_string there's no need to unwrap anything, because we use std::basic_string directly in debug mode anyway. libstdc++-v3/ChangeLog: * include/bits/erase_if.h (__erase_nodes_if): Remove redundant __niter_base calls. * include/std/string (erase, erase_if): Likewise. * include/std/deque (erase, erase_if): Access non-debug container directly. * include/std/map (erase, erase_if): Likewise. * include/std/set (erase, erase_if): Likewise. * include/std/unordered_map (erase, erase_if): Likewise. * include/std/unordered_set (erase, erase_if): Likewise. * include/std/vector (erase, erase_if): Likewise. * include/experimental/deque (erase, erase_if): Likewise. * include/experimental/map (erase, erase_if): Likewise. * include/experimental/set (erase, erase_if): Likewise. * include/experimental/unordered_map (erase, erase_if): Likewise. * include/experimental/unordered_set (erase, erase_if): Likewise. * include/experimental/vector (erase, erase_if): Likewise.
* Daily bump.GCC Administrator2021-10-071-0/+13
|
* libstdc++: Implement std::move_only_function for C++23 (P0288R9)Jonathan Wakely2021-10-0610-0/+828
| | | | | | | | | | | | | | | libstdc++-v3/ChangeLog: * include/Makefile.am: Add new headers. * include/Makefile.in: Regenerate. * include/std/functional: Include <bits/move_only_function.h>. * include/std/version (__cpp_lib_move_only_function): Define. * include/bits/mofunc_impl.h: New file. * include/bits/move_only_function.h: New file. * testsuite/20_util/move_only_function/call.cc: New test. * testsuite/20_util/move_only_function/cons.cc: New test. * testsuite/20_util/move_only_function/move.cc: New test. * testsuite/20_util/move_only_function/version.cc: New test.
* Daily bump.GCC Administrator2021-10-061-0/+58
|
* libstdc++: Ensure std::span and std::string_view are trivially copyable ↵Jonathan Wakely2021-10-052-0/+24
| | | | | | | | | | | | | (P2251R1) The recently approved P2251R1 paper requires these types to be trivially copyable. They always have been in libstdc++, but add tests to check it. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string_view/requirements/trivially_copyable.cc: New test. * testsuite/23_containers/span/trivially_copyable.cc: New test.
* libstdc++: Simplify constraints for std::any constructionJonathan Wakely2021-10-052-9/+6
| | | | | | | | | | | libstdc++-v3/ChangeLog: * include/bits/utility.h (__is_in_place_type_v): Define variable template to detect in_place_type_t specializations. (__is_in_place_type): Replace class template with alias template using __is_in_place_type_v. * include/std/any (any(T&&)): Check __is_in_place_type first and avoid instantiating is_copy_constructible unnecessarily.
* libstdc++: Add test for std::cmp_greaterJonathan Wakely2021-10-051-0/+61
| | | | | | | | This was omitted from the commit that added these comparisons. libstdc++-v3/ChangeLog: * testsuite/20_util/integer_comparisons/greater.cc: New test.
* libstdc++: Improve test for printing volatile pointersJonathan Wakely2021-10-051-4/+8
| | | | | | | libstdc++-v3/ChangeLog: * testsuite/27_io/basic_ostream/inserters_other/char/volatile_ptr.cc: Check result matches non-volatile pointer.
* libstdc++: Fix testcase for newly-implemented C++20 semantics [PR102535]Jonathan Wakely2021-10-051-1/+1
| | | | | | | | libstdc++-v3/ChangeLog: PR c++/102535 * testsuite/20_util/is_trivially_constructible/value.cc: Adjust expected value for C++20.
* libstdc++: Add noexcept to some std::function internalsJonathan Wakely2021-10-051-9/+9
| | | | | | | | | | libstdc++-v3/ChangeLog: * include/bits/std_function.h (_Any_data::_M_access): Add noexcept. (_Function_base::_Base_manager::_M_get_pointer): Likewise. (_Function_base::_Base_manager::_M_not_empty_function): Likewise.