e1a74058b7
351 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Jonathan Wakely
|
fe3ed885cd |
libstdc++: Limit new basic_string(nullptr_t) constructor to C++23 [PR104099]
The new deleted constructors added by P2166R1 are a breaking change, making previously valid code ill-formed in C++23. As a result, they should only be defined for C++23 and not for C++11 and up. libstdc++-v3/ChangeLog: PR libstdc++/104099 * include/bits/basic_string.h (basic_string(nullptr_t)): Only define for C++23. (operator=(nullptr_t)): Likewise. * include/bits/cow_string.h: Likewise. * include/std/string_view (basic_string_view(nullptr_t)): Likewise. * testsuite/21_strings/basic_string/cons/char/nullptr.cc: Adjust expected error. Add examples that become ill-formed in C++23. * testsuite/21_strings/basic_string_view/cons/char/nonnull.cc: Adjust expected errors. * testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc: Likewise. |
||
Tom Honermann
|
0e4e4b37d9 |
libstdc++: Declare std::c8rtomb and std::mbrtoc8 if provided by the C library
This patch completes implementation of the C++20 proposal P0482R6 [1] by adding declarations of std::c8rtomb() and std::mbrtoc8() in <cuchar> if provided by the C library in <uchar.h>. This patch addresses feedback provided in response to a previous patch submission [2]. Autoconf changes determine if the C library declares c8rtomb and mbrtoc8 at global scope when uchar.h is included and compiled with either -fchar8_t or -std=c++20. New _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T and _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20 configuration macros reflect the probe results. The <cuchar> header declares these functions in the std namespace only if available and the _GLIBCXX_USE_CHAR8_T configuration macro is defined (by default it is defined if the C++20 __cpp_char8_t feature test macro is defined) Patches to glibc to implement c8rtomb and mbrtoc8 have been submitted [3]. New tests validate the presence of these declarations. The tests pass trivially if the C library does not provide these functions. Otherwise they ensure that the functions are declared when <cuchar> is included and either -fchar8_t or -std=c++20 is enabled. 1]: WG21 P0482R6 "char8_t: A type for UTF-8 characters and strings (Revision 6)" https://wg21.link/p0482r6 [2]: [PATCH] C++ P0482R6 char8_t: declare std::c8rtomb and std::mbrtoc8 if provided by the C library https://gcc.gnu.org/pipermail/libstdc++/2021-June/052685.html [3]: "C++20 P0482R6 and C2X N2653" [Patch 0/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135061.html [Patch 1/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135062.html [Patch 2/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135063.html [Patch 3/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135064.html libstdc++-v3/ChangeLog: * acinclude.m4: Define config macros if uchar.h provides c8rtomb() and mbrtoc8(). * config.h.in: Regenerate. * configure: Regenerate. * include/c_compatibility/uchar.h (c8rtomb, mbrtoc8): Define. * include/c_global/cuchar (c8rtomb, mbrtoc8): Likewise. * include/c_std/cuchar (c8rtomb, mbrtoc8): Likewise. * testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc: New test. * testsuite/21_strings/headers/cuchar/functions_std_fchar8_t.cc: New test. |
||
Jonathan Wakely
|
de196e5dd8 |
libstdc++: Add attribute to features deprecated in C++17 [PR91260]
There are a lot of things in the C++ standard library which were deprecated in C++11, and more in C++17. Some of them were removed after deprecation and are no longer present in the standard at all. We have not removed these from libstdc++ because keeping them as non-standard extensions is conforming, and avoids gratuitously breaking user code, and in some cases we need to keep using them to avoid ABI changes. But we should at least give a warning for using them. That has not been done previously because of the library's own uses of them (e.g. the std::iterator class template used as a base class). This adds deprecated attributes to the relevant components, and then goes through the whole library to add diagnostic pragmas where needed to suppress warnings about our internal uses of them. The tests are updated to either expect the additional warnings, or to suppress them where we aren't interested in them. libstdc++-v3/ChangeLog: PR libstdc++/91260 PR libstdc++/91383 PR libstdc++/95065 * include/backward/binders.h (bind1st, bind2nd): Add deprecated attribute. * include/bits/refwrap.h (_Maybe_unary_or_binary_function): Disable deprecated warnings for base classes. (_Reference_wrapper_base): Likewise. * include/bits/shared_ptr_base.h (_Sp_owner_less): Likewise. * include/bits/stl_bvector.h (_Bit_iterator_base): Likewise. * include/bits/stl_function.h (unary_function, binary_function): Add deprecated attribute. (unary_negate, not1, binary_negate, not2, ptr_fun) (pointer_to_unary_function, pointer_to_binary_function) (mem_fun_t, const_mem_fun_t, mem_fun_ref_t, const_mem_fun_ref_t) (mem_fun1_t, const_mem_fun1_t, mem_fun_ref1_t) (const_mem_fun1_ref_t, mem_fun, mem_fun_ref): Add deprecated attributes. * include/bits/stl_iterator.h: Disable deprecated warnings for std::iterator base classes. * include/bits/stl_iterator_base_types.h (iterator): Add deprecated attribute. * include/bits/stl_map.h (map::value_compare): Disable deprecated warnings for base class. * include/bits/stl_multimap.h (multimap::value_compare): Likewise. * include/bits/stl_raw_storage_iter.h (raw_storage_iterator): Add deprecated attribute. * include/bits/stl_tempbuf.h (get_temporary_buffer): Likewise. * include/bits/stream_iterator.h: Disable deprecated warnings. * include/bits/streambuf_iterator.h: Likewise. * include/ext/bitmap_allocator.h: Remove unary_function base classes. * include/ext/functional: Disable deprecated warnings. * include/ext/rope: Likewise. * include/ext/throw_allocator.h: Likewise. * include/std/type_traits (result_of): Add deprecated attribute. * include/tr1/functional: Disable deprecated warnings. * include/tr1/functional_hash.h: Likewise. * testsuite/20_util/function_objects/binders/1.cc: Add -Wno-disable-deprecations. * testsuite/20_util/function_objects/binders/3113.cc: Likewise. * testsuite/20_util/function_objects/constexpr.cc: Add dg-warning. * testsuite/20_util/raw_storage_iterator/base.cc: Likewise. * testsuite/20_util/raw_storage_iterator/dr2127.cc: Likewise. * testsuite/20_util/raw_storage_iterator/requirements/base_classes.cc: Likewise. * testsuite/20_util/raw_storage_iterator/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/20_util/raw_storage_iterator/requirements/typedefs.cc: Likewise. * testsuite/20_util/reference_wrapper/24803.cc: Likewise. * testsuite/20_util/reference_wrapper/typedefs.cc: Enable for C++20 and check for absence of nested types. * testsuite/20_util/shared_ptr/comparison/less.cc: Remove std::binary_function base class. * testsuite/20_util/temporary_buffer.cc: Add dg-warning. * testsuite/21_strings/basic_string/cons/char/69092.cc: Remove std::iterator base class. * testsuite/24_iterators/back_insert_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/front_insert_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/insert_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/istream_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/92285.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/ostream_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/ostreambuf_iterator/requirements/base_classes.cc: Likewise. * testsuite/24_iterators/reverse_iterator/requirements/base_classes.cc: Likewise. * testsuite/25_algorithms/copy/34595.cc: Likewise. * testsuite/25_algorithms/minmax/3.cc: Remove std::binary_function base class. * testsuite/25_algorithms/all_of/requirements/explicit_instantiation/2.cc: Disable deprecated warnings. * testsuite/25_algorithms/all_of/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/any_of/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/any_of/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/copy_if/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/count_if/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/count_if/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/find_end/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/find_end/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/find_if/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/find_if/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/find_if_not/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/find_if_not/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/for_each/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/for_each/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/is_partitioned/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/is_partitioned/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/is_permutation/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/is_permutation/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/none_of/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/none_of/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/partition/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/partition/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/partition_copy/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/partition_copy/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/partition_point/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/partition_point/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/search/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/search/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/search_n/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/search_n/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/25_algorithms/transform/requirements/explicit_instantiation/2.cc: Likewise. * testsuite/25_algorithms/transform/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/27_io/basic_filebuf/underflow/wchar_t/9178.cc: Add dg-warning. * testsuite/ext/pb_ds/example/priority_queue_erase_if.cc: Likewise. * testsuite/ext/pb_ds/example/priority_queue_split_join.cc: Likewise. * testsuite/tr1/3_function_objects/reference_wrapper/typedefs.cc: Disable deprecated warnings. * testsuite/tr1/6_containers/hash/requirements/base_classes.cc: Likewise. * testsuite/util/regression/trait/erase_if_fn.hpp: Remove std::unary_function base classes. * testsuite/util/testsuite_iterators.h (output_iterator_wrapper): Remove std::iterator base classes. |
||
Jonathan Wakely
|
6aa0859afa |
libstdc++: Fix overconstrained std::string constructor [PR103919]
The C++17 basic_string(const T&, size_t, size_t) constructor is overconstrained, so it can't be used for a NTBS and a temporary string gets constructed (potentially allocating memory). There is no corresponding constructor taking an NTBS, so no need to disambiguate from it. Accepting an NTBS avoids the temporary (and potential allocation) and is what the standard requires. libstdc++-v3/ChangeLog: PR libstdc++/103919 * include/bits/basic_string.h (basic_string(const T&, size_t, size_t)): Relax constraints on string_view parameter. * include/bits/cow_string.h (basic_string(const T&, size_t, size_t)): Likewise. * testsuite/21_strings/basic_string/cons/char/103919.cc: New test. |
||
Jakub Jelinek
|
7adcbafe45 | Update copyright years. | ||
Jonathan Wakely
|
be30fc4ce0 |
libstdc++: Fix tests that fail with fully-dynamic-string
Fix some tests that assume that a moved-from string is empty, or that default constructing a string doesn't allocate. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/cons/char/moveable.cc: Allow moved-from string to be non-empty. * testsuite/21_strings/basic_string/cons/char/moveable2.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/moveable.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/moveable2.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc: Construct empty string before setting oom flag. * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc: Likewise. |
||
Jonathan Wakely
|
675afa2124 |
libstdc++: Fix fully-dynamic-string build
My last change to the fully-dynamic-string actually broke it. This fixes the move constructor so it builds, and simplifies it slightly so that more code is common between the fully-dynamic enabled/disabled cases. libstdc++-v3/ChangeLog: * include/bits/cow_string.h (basic_string(basic_string&&)): Fix mem-initializer for _GLIBCXX_FULLY_DYNAMIC_STRING==0 case. * testsuite/21_strings/basic_string/cons/char/noexcept_move_construct.cc: Remove outdated comment. * testsuite/21_strings/basic_string/cons/wchar_t/noexcept_move_construct.cc: Likewise. |
||
Jonathan Wakely
|
1ecc9ba578 |
libstdc++: Remove redundant xfail selectors in dg-do compile tests
An 'xfail' selector means the test is expected to fail at runtime, so is ignored for a compile-only test. The way to mark a compile-only test as failing is with dg-error (which these already do). libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc: Remove xfail selector. * testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: Likewise. Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc: Likewise. * testsuite/23_containers/span/101411.cc: Likewise. * testsuite/25_algorithms/copy/debug/constexpr_neg.cc: Likewise. * testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc: Likewise. * testsuite/25_algorithms/equal/constexpr_neg.cc: Likewise. * testsuite/25_algorithms/equal/debug/constexpr_neg.cc: Likewise. * testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc: Likewise. * testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc: Likewise. * testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc: Likewise. * testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc: Likewise. * testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc: Likewise. * testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc: Likewise. |
||
Jonathan Wakely
|
a04b73e15b |
libstdc++: Replace hyphens in effective target keywords
An effective target like foo-bar-baz will match a target selector of *-*-* and cause problems in the testsuite. Several libstdc++ et keywords are of the form foo-bar, which could still be a problem for *-* selectors. Replace hyphens with underscores in the et keywords "debug-mode", "cxx11-abi", etc. libstdc++-v3/ChangeLog: * testsuite/lib/libstdc++.exp: Rename effective target keywords to avoid dashes in the name. * testsuite/*: Update effective targe keywords. |
||
Jonathan Wakely
|
b8f2efaed0 |
libstdc++: Suppress -Wstringop warnings [PR103332]
libstdc++-v3/ChangeLog: PR libstdc++/103332 PR libstdc++/102958 * testsuite/21_strings/basic_string/capacity/char/1.cc: Add -Wno-stringop-overflow. * testsuite/21_strings/basic_string/operators/char/1.cc: Likewise. * testsuite/experimental/filesystem/path/factory/u8path-char8_t.cc: Add -Wno-stringop-overread. |
||
Jonathan Wakely
|
2d76292bd6 |
libstdc++: Begin lifetime of chars in constexpr std::string [PR103295]
Clang gives errors for constexpr std::string because the memory returned by std::allocator<T>::allocate does not contain any objects yet, and attempting to set them using char_traits::assign or char_traits::copy fails with: assignment to object outside its lifetime is not allowed in a constant expression *__result = *__first; ^ This adds code to std::char_traits to use std::construct_at to begin lifetimes when called during constant evaluation. To support specializations of std::basic_string that don't use std::char_traits there is now another layer of wrapper around the allocator_traits, so that the lifetime of characters is begun as soon as the memory is allocated. By doing it in the char traits and allocator traits, the rest of basic_string can ignore the problem. While modifying char_traits::copy and char_traits::assign to begin lifetimes for the constexpr cases, I also replaced their uses of std::copy and std::fill_n respectively. That means we don't need <bits/stl_algobase.h> for char_traits. libstdc++-v3/ChangeLog: PR libstdc++/103295 * include/bits/basic_string.h (_Alloc_traits): Replace typedef with struct for C++20 mode. * include/bits/basic_string.tcc (_M_replace): Use _Alloc_traits for allocation. * include/bits/char_traits.h (__gnu_cxx::char_traits::assign): Use std::_Construct during constant evaluation. (__gnu_cxx::char_traits::assign(CharT*, const CharT*, size_t)): Likewise. Replace std::fill_n with memset or manual loop. (__gnu_cxx::char_traits::copy): Likewise, replacing std::copy with memcpy. * include/ext/vstring.h: Include <bits/stl_algobase.h> for std::min. * include/std/string_view: Likewise. * testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc: Add constexpr test. |
||
Jonathan Wakely
|
ca243ada71 |
libstdc++: Fix std::char_traits<C>::move for constexpr
The constexpr branch in __gnu_cxx::char_traits::move compares the string arguments to see if they overlap, but relational comparisons between unrelated pointers are not core constant expressions. I want to replace the comparisons with a loop using pointer equality to determine whether the end of the source string is in the destination string. However, that doesn't work with GCC, due to PR c++/89074 so allocate a temporary buffer instead and copy out into that first, so that overlapping source and destination don't matter. The allocation isn't supported by the current Intel icc so use the loop as a fallback. libstdc++-v3/ChangeLog: * include/bits/char_traits.h (__gnu_cxx::char_traits::move): Do not compare unrelated pointers during constant evaluation. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: Improve tests for char_traits::move. |
||
Jonathan Wakely
|
73e4d9f175 |
libstdc++: Fix tests for constexpr std::string
Some tests fail when run with -D_GLIBCXX_USE_CXX11_ABI or -stdgnu++20. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (operator<=>): Use constexpr unconditionally. * testsuite/21_strings/basic_string/modifiers/constexpr.cc: Require cxx11-abit effective target. * testsuite/21_strings/headers/string/synopsis.cc: Add conditional constexpr to declarations, and adjust relational operators for C++20. |
||
Michael de Lang
|
b96e2ff9d8 |
libstdc++: Implement constexpr std::basic_string for C++20
This is only supported for the cxx11 ABI, not for COW strings. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (basic_string, operator""s): Add constexpr for C++20. (basic_string::basic_string(basic_string&&)): Only copy initialized portion of the buffer. (basic_string::basic_string(basic_string&&, const Alloc&)): Likewise. * include/bits/basic_string.tcc (basic_string): Add constexpr for C++20. (basic_string::swap(basic_string&)): Only copy initialized portions of the buffers. (basic_string::_M_replace): Add constexpr implementation that doesn't depend on pointer comparisons. * include/bits/cow_string.h: Adjust comment. * include/ext/type_traits.h (__is_null_pointer): Add constexpr. * include/std/string (erase, erase_if): Add constexpr. * include/std/version (__cpp_lib_constexpr_string): Update value. * testsuite/21_strings/basic_string/cons/char/constexpr.cc: New test. * testsuite/21_strings/basic_string/cons/wchar_t/constexpr.cc: New test. * testsuite/21_strings/basic_string/literals/constexpr.cc: New test. * testsuite/21_strings/basic_string/modifiers/constexpr.cc: New test. * testsuite/21_strings/basic_string/modifiers/swap/char/constexpr.cc: New test. * testsuite/21_strings/basic_string/modifiers/swap/wchar_t/constexpr.cc: New test. * testsuite/21_strings/basic_string/version.cc: New test. |
||
Jonathan Wakely
|
8d8e8f3ad5 |
libstdc++: Fix out-of-bound array accesses in testsuite
I fixed some undefined behaviour in string tests in r238609, but I only fixed the narrow char versions. This applies the same fixes to the wchar_t ones. These problems were found when testing a patch to make std::basic_string usable in constexpr. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/modifiers/append/wchar_t/1.cc: Fix reads past the end of strings. * testsuite/21_strings/basic_string/operations/compare/wchar_t/1.cc: Likewise. * testsuite/experimental/string_view/operations/compare/wchar_t/1.cc: Likewise. |
||
Jonathan Wakely
|
9719769471 |
libstdc++: Fix typos in tests
libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/allocator/71964.cc: Fix typo. * testsuite/23_containers/set/allocator/71964.cc: Likewise. |
||
Martin Sebor
|
9a27acc30a |
Make full use of context-sensitive ranges in access warnings.
gcc/ChangeLog: * builtins.c (check_strncat_sizes): Pass access_data ctor additional arguments. (expand_builtin_memcmp): Move code to gimple-ssa-warn-access.cc. (expand_builtin_fork_or_exec): Same. * gimple-array-bounds.cc (array_bounds_checker::check_mem_ref): Pass compute_objsize additional arguments. (inbounds_memaccess_p): Same. (array_bounds_checker::check_array_bounds): Add an assert. Stash statement in a member. (check_array_bounds_dom_walker::before_dom_children): Same. * gimple-array-bounds.h (array_bounds_checker::m_stmt): New member. * gimple-ssa-sprintf.c (get_destination_size): Add an argument. (handle_printf_call): Pass a new argument. * gimple-ssa-warn-access.cc (get_size_range): Add an argument. (check_access): Add an argument and pass it along to callees. (check_read_access): Make a member function. (pass_waccess::check_strcat): Pass access_data ctor additional arguments. (pass_waccess::check_strncat): Same. (pass_waccess::check_stxcpy): Same. (pass_waccess::check_stxncpy): Same. (pass_waccess::check_strncmp): Same. (pass_waccess::check_read_access): Same. (pass_waccess::check_builtin): Same. (pass_waccess::maybe_check_access_sizes): Same. (pass_waccess::maybe_check_dealloc_call): Same. * gimple-ssa-warn-access.h (check_read_access): Declare a new member function. * pointer-query.cc (compute_objsize_r): Add an argument. (gimple_call_return_array): Same. (gimple_call_alloc_size): Same. (access_ref::access_ref): Same. (access_ref::get_ref): Same. (pointer_query::get_ref): Same. (handle_min_max_size): Pass an arguments to callees. (handle_array_ref): Add an argument. (handle_mem_ref): Same. (compute_objsize): Same. * pointer-query.h (struct access_ref): Adjust signatures. (struct access_data): Same. (gimple_call_alloc_size): Add an argument. (gimple_parm_array_size): Same. (compute_objsize): Same. * tree-ssa-strlen.c (strlen_pass::adjust_last_stmt): Pass an additional argument to compute_objsize. (strlen_pass::maybe_warn_overflow): Same. (maybe_diag_stxncpy_trunc): Same. gcc/testsuite/ChangeLog: * gcc.dg/Wstringop-overflow-22.c: Correct typos. * gcc.dg/Wstringop-overflow-81.c: New test. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/capacity/1.cc: Also suppress -Wstringop-overread. * testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc: Same. |
||
Jonathan Wakely
|
929abc7fe3 |
libstdc++: Define std::basic_string::resize_and_overwrite for C++23 (P1072R10)
A recently approved change for the C++23 working draft. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (__cpp_lib_string_resize_and_overwrite): Define for C++23. (basic_string::resize_and_overwrite): Declare. * include/bits/basic_string.tcc (basic_string::resize_and_overwrite): Define. * include/std/version (__cpp_lib_resize_and_overwrite): Define for C++23. * testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc: New test. |
||
Jonathan Wakely
|
fec283b63d |
libstdc++: Remove unnecessary uses of _GLIBCXX_USE_WCHAR_T in testsuite [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. |
||
Jonathan Wakely
|
1f51e9af7b |
libstdc++: Ensure std::span and std::string_view are trivially copyable (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. |
||
Jonathan Wakely
|
cf876562c5 |
libstdc++: Disable std::string{,_view} construction from nullptr (P2166R1)
Implement this C++23 feature. Because construction from a null pointer is undefined, we can implement it for C++11 and up, turning undefined behaviour into a compilation error. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (basic_string(nullptr_t)): Define as deleted. (operator=(nullptr_t)): Likewise. * include/bits/cow_string.h (basic_string(nullptr_t)): Likewise. (operator=(nullptr_t)): Likewise. * include/std/string_view (basic_string_view(nullptr_t)): Likewise. * testsuite/21_strings/basic_string/cons/char/nullptr.cc: New test. * testsuite/21_strings/basic_string_view/cons/char/nonnull.cc: Change dg-warning to dg-error. * testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc: Likewise. |
||
Jonathan Wakely
|
240b01b021 |
libstdc++: Add [[nodiscard]] to iterators and related utilities
This adds [[nodiscard]] throughout <iterator>, as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [[__nodiscard__]] or _GLIBCXX_NODISCARD where C++17 [[nodiscard]] can't be used directly. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h (iter_move): Add [[nodiscard]]. * include/bits/range_access.h (begin, end, cbegin, cend) (rbegin, rend, crbegin, crend, size, data, ssize): Likewise. * include/bits/ranges_base.h (ranges::begin, ranges::end) (ranges::cbegin, ranges::cend, ranges::rbegin, ranges::rend) (ranges::crbegin, ranges::crend, ranges::size, ranges::ssize) (ranges::empty, ranges::data, ranges::cdata): Likewise. * include/bits/stl_iterator.h (reverse_iterator, __normal_iterator) (back_insert_iterator, front_insert_iterator, insert_iterator) (move_iterator, move_sentinel, common_iterator) (counted_iterator): Likewise. * include/bits/stl_iterator_base_funcs.h (distance, next, prev): Likewise. * include/bits/stream_iterator.h (istream_iterator) (ostream_iterartor): Likewise. * include/bits/streambuf_iterator.h (istreambuf_iterator) (ostreambuf_iterator): Likewise. * include/std/ranges (views::single, views::iota, views::all) (views::filter, views::transform, views::take, views::take_while) (views::drop, views::drop_while, views::join, views::lazy_split) (views::split, views::counted, views::common, views::reverse) (views::elements): Likewise. * testsuite/20_util/rel_ops.cc: Use -Wno-unused-result. * testsuite/24_iterators/move_iterator/greedy_ops.cc: Likewise. * testsuite/24_iterators/normal_iterator/greedy_ops.cc: Likewise. * testsuite/24_iterators/reverse_iterator/2.cc: Likewise. * testsuite/24_iterators/reverse_iterator/greedy_ops.cc: Likewise. * testsuite/21_strings/basic_string/range_access/char/1.cc: Cast result to void. * testsuite/21_strings/basic_string/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/23_containers/array/range_access.cc: Likewise. * testsuite/23_containers/deque/range_access.cc: Likewise. * testsuite/23_containers/forward_list/range_access.cc: Likewise. * testsuite/23_containers/list/range_access.cc: Likewise. * testsuite/23_containers/map/range_access.cc: Likewise. * testsuite/23_containers/multimap/range_access.cc: Likewise. * testsuite/23_containers/multiset/range_access.cc: Likewise. * testsuite/23_containers/set/range_access.cc: Likewise. * testsuite/23_containers/unordered_map/range_access.cc: Likewise. * testsuite/23_containers/unordered_multimap/range_access.cc: Likewise. * testsuite/23_containers/unordered_multiset/range_access.cc: Likewise. * testsuite/23_containers/unordered_set/range_access.cc: Likewise. * testsuite/23_containers/vector/range_access.cc: Likewise. * testsuite/24_iterators/customization_points/iter_move.cc: Likewise. * testsuite/24_iterators/istream_iterator/sentinel.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/sentinel.cc: Likewise. * testsuite/24_iterators/move_iterator/dr2061.cc: Likewise. * testsuite/24_iterators/operations/prev_neg.cc: Likewise. * testsuite/24_iterators/ostreambuf_iterator/2.cc: Likewise. * testsuite/24_iterators/range_access/range_access.cc: Likewise. * testsuite/24_iterators/range_operations/100768.cc: Likewise. * testsuite/26_numerics/valarray/range_access2.cc: Likewise. * testsuite/28_regex/range_access.cc: Likewise. * testsuite/experimental/string_view/range_access/char/1.cc: Likewise. * testsuite/experimental/string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/ext/vstring/range_access.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/p2259.cc: Likewise. |
||
Jonathan Wakely
|
f9c2ce1dae |
libstdc++: Add noexcept-specifier to basic_string_view(It, End)
This adds a conditional noexcept to the C++20 constructor. The std::to_address call cannot throw, so only taking the difference of the two iterators can throw. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/std/string_view (basic_string_view(It, End)): Add noexcept-specifier. * testsuite/21_strings/basic_string_view/cons/char/range.cc: Check noexcept-specifier. Also check construction without CTAD. |
||
Jonathan Wakely
|
92edc4a768 |
libstdc++: Suppress -Wstringop-overread warning in test
When compiled with -m32 -O2 -D_GLIBCXX_USE_CXX11_ABI=0 we get a warning for 21_strings/basic_string/cons/char/1.cc: bits/char_traits.h:409:56: warning: ‘void* __builtin_memcpy(void*, const void*, unsigned int)’ reading 1073741821 bytes from a region of size 19 [-Wstringop-overread] The warning is legitimate, even if that line cannot be reached because we throw std::length_error before getting there. Since the invalid length is deliberate (and mentioned in a comment) just suppress the warning, so that the test can verify we get the exception. Also remove an unused typedef that produces another warning. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/cons/char/1.cc: Use diagnostic pragma to suppress -Wstringop-overread error. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> |
||
Jonathan Wakely
|
6b42b5a8a2 |
libstdc++: Use __builtin_unreachable for constexpr assertions [PR 100676]
The current implementation of compile-time precondition checks causes compilation to fail by calling a non-constexpr function declared at block scope. This breaks the CUDA compiler, which wraps some libstdc++ headers in a pragma that declares everything as a __host__ __device__ function, but others are not wrapped and so everything is a __host__ function. The local declaration thus gets redeclared as two different types of function, which doesn't work. Just use __builtin_unreachable to make constant evaluation fail, instead of the local function declaration. Also simplify the assertion macros, which has the side effect of giving simpler compilation errors when using Clang. libstdc++-v3/ChangeLog: PR libstdc++/100676 * include/bits/c++config (__glibcxx_assert_1): Rename to ... (__glibcxx_constexpr_assert): ... this. (__glibcxx_assert_impl): Use __glibcxx_constexpr_assert. (__glibcxx_assert): Define as either __glibcxx_constexpr_assert or __glibcxx_assert_impl. (__glibcxx_assert_2): Remove * include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_AT_F): Use __glibcxx_constexpr_assert instead of __glibcxx_assert_1. * testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc: Adjust expected error. * testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc: Likewise. Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc: Likewise. * testsuite/23_containers/span/back_neg.cc: Likewise. * testsuite/23_containers/span/front_neg.cc: Likewise. * testsuite/23_containers/span/index_op_neg.cc: Likewise. |
||
Jonathan Wakely
|
8087e70267 |
libstdc++: Remove redundant -std=gnu++17 option from strings tests
GCC defaults to -std=gnu++17 now anyway, and using it explicitly in the dg-options directive prevents running these tests with different modes such as -std=c++17 or -std=gnu++20. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/79162.cc: Remove -std=gnu++17 from dg-options directive. * testsuite/21_strings/basic_string/cons/char/7.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/79162.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/86138.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/9.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/deduction.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/7.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/79162.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/86138.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/9.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc: Likewise. * testsuite/21_strings/basic_string/hash/hash.cc: Likewise. * testsuite/21_strings/basic_string/lwg2758.cc: Likewise. * testsuite/21_strings/basic_string/lwg2946.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/append/char/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/append/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/char/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/insert/char/3.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/insert/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/replace/char/7.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/replace/wchar_t/7.cc: Likewise. * testsuite/21_strings/basic_string/operations/compare/char/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/compare/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/data/char/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/data/char/86169.cc: Likewise. * testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/find/char/5.cc: Likewise. * testsuite/21_strings/basic_string/operations/find/wchar_t/5.cc: Likewise. * testsuite/21_strings/basic_string/operators/char/5.cc: Likewise. * testsuite/21_strings/basic_string/operators/wchar_t/5.cc: Likewise. * testsuite/21_strings/basic_string_view/capacity/1.cc: Likewise. * testsuite/21_strings/basic_string_view/capacity/empty_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/constexpr.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/empty.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_back.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_back_constexpr.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/empty.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_back.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/include.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/94051.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/pod/10081-out.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/3.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/modifiers/remove_prefix/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/13650.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/13650.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/data/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/data/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/4.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/string_conversion/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/char/83511.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/wchar_t/83511.cc: Likewise. * testsuite/21_strings/basic_string_view/operators/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operators/char/89446.cc: Likewise. * testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operators/wchar_t/89446.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char8_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/traits_neg.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/types/1.cc: Likewise. * testsuite/21_strings/char_traits/requirements/char/99181.cc: Likewise. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc: |
||
Jonathan Wakely
|
7a4e52e44a |
libstdc++: Remove redundant -std=gnu++17 option from PMR tests
GCC defaults to -std=gnu++17 now anyway, and using it explicitly in the dg-options directive prevents running these tests with different modes such as -std=c++17 or -std=gnu++20. libstdc++-v3/ChangeLog: * testsuite/20_util/memory_resource/1.cc: Remove -std=gnu++17 from dg-options directive. * testsuite/20_util/memory_resource/2.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/1.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/93208.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/allocate.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/deallocate.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/release.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/upstream_resource.cc: Likewise. * testsuite/20_util/polymorphic_allocator/1.cc: Likewise. * testsuite/20_util/polymorphic_allocator/construct_pair.cc: Likewise. * testsuite/20_util/polymorphic_allocator/resource.cc: Likewise. * testsuite/20_util/polymorphic_allocator/select.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/allocate.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/allocate_single.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/cons.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/cons_single.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/is_equal.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/multithreaded.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/options.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/release.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/release_single.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/allocate-max-chunks.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/cons.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/is_equal.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/options.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/release.cc: Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Likewise. * testsuite/23_containers/deque/types/pmr_typedefs.cc: Likewise. * testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/forward_list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/list/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/map/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multimap/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multiset/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/set/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/vector/pmr_typedefs.cc: Likewise. * testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: Likewise. * testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise. |
||
Jonathan Wakely
|
3da80ed7ef |
libstdc++: Define __cpp_lib_constexpr_string macro
As noted in r11-1339-gb6ab9ecd550227684643b41e9e33a4d3466724d8 we define a non-standard __cpp_lib_constexpr_char_traits feature test macro to indicate support for P0426R1 and P1032R1. At some point last year the __cpp_lib_constexpr_string macro was retconned to indicate support for those papers. This adds the new macro (which we didn't previously define, because it referred to P0980R1 "Making std::string constexpr" which we don't support). libstdc++-v3/ChangeLog: * include/bits/basic_string.h (__cpp_lib_constexpr_string): Define. * include/std/version (__cpp_lib_constexpr_string): Define. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc: Check for __cpp_lib_constexpr_string. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: Likewise. * testsuite/21_strings/char_traits/requirements/version.cc: New test. |
||
François Dumont
|
50bb46e4d2 |
libstdc++: Fix and complete __gnu_debug::basic_string implementation
Fix and complete __gnu_debug::basic_string so that it can be used as a transparent replacement of std::basic_string. libstdc++-v3/ChangeLog: * include/debug/string (basic_string(const basic_string&, const _Alloc&)): Define even if !_GLIBCXX_USE_CXX11_ABI. (basic_string(basic_string&&, const _Alloc&)): Likewise and add noexcept qualification. (basic_string<>::erase): Adapt to take __const_iterator. (basic_string(const _CharT*, const _Allocator&)): Remove assign call. (basic_string<>::insert(const_iterator, _InputIte, _InputIte)): Try to remove iterator debug layer even if !_GLIBCXX_USE_CXX11_ABI. [_GLIBCXX_USE_CHAR8_T] (__gnu_debug::u8string): New. (__gnu_debug::u16string, __gnu_debug::u32string): New. (std::hash<__gnu_debug::basic_string<>>): New partial specialization. (std::__is_fast_hash<__gnu_debug::basic_string<>>): Likewise. * testsuite/util/exception/safety.h (erase_base<__gnu_debug::basic_string<>>): New partial specialization. (insert_base<__gnu_debug::basic_string<>>): Likewise. * testsuite/util/testsuite_container_traits.h (traits<__gnu_debug::basic_string<>>): New partial specialization. * testsuite/21_strings/basic_string/hash/debug.cc: New test. * testsuite/21_strings/basic_string/requirements/citerators.cc: Add test on __gnu_debug::string. * testsuite/21_strings/basic_string/requirements/dr438/constructor.cc: Likewise. * testsuite/21_strings/basic_string/requirements/exception/basic.cc: Likewise. * testsuite/21_strings/basic_string/requirements/exception/generation_prohibited.cc: Likewise. * testsuite/21_strings/basic_string/requirements/exception/propagation_consistent.cc: Likewise. * testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc: Likewise. * testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc: Likewise. * testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc: Likewise. * testsuite/21_strings/basic_string/requirements/explicit_instantiation/char8_t/1.cc: Likewise. * testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string/requirements/typedefs.cc: Likewise. |
||
Jonathan Wakely
|
7c1006135d |
libstdc++: Implement string_view range constructor for C++20
This implements the new string_view constructor proposed by P1989R2. This hasn't been voted into the C++23 draft yet, but it's been reviewed by LWG and is expected to be approved at the next WG21 meeting. libstdc++-v3/ChangeLog: * include/std/string_view (basic_string_view(Range&&)): Define new constructor and deduction guide. * testsuite/21_strings/basic_string_view/cons/char/range_c++20.cc: New test. * testsuite/21_strings/basic_string_view/cons/wchar_t/range_c++20.cc: New test. |
||
Jakub Jelinek
|
efa64fcce1 |
libstdc++: Fix up constexpr std::char_traits<char>::compare [PR99181]
Because of LWG 467, std::char_traits<char>::lt compares the values cast to unsigned char rather than char, so even when char is signed we get unsigned comparision. std::char_traits<char>::compare uses __builtin_memcmp and that works the same, but during constexpr evaluation we were calling __gnu_cxx::char_traits<char_type>::compare. As char_traits::lt is not virtual, __gnu_cxx::char_traits<char_type>::compare used __gnu_cxx::char_traits<char_type>::lt rather than std::char_traits<char>::lt and thus compared chars as signed if char is signed. This change fixes it by inlining __gnu_cxx::char_traits<char_type>::compare into std::char_traits<char>::compare by hand, so that it calls the right lt method. 2021-02-23 Jakub Jelinek <jakub@redhat.com> PR libstdc++/99181 * include/bits/char_traits.h (char_traits<char>::compare): For constexpr evaluation don't call __gnu_cxx::char_traits<char_type>::compare but do the comparison loop directly. * testsuite/21_strings/char_traits/requirements/char/99181.cc: New test. |
||
Paul Fee
|
f004d6d9fa |
libstdc++: Add string contains member functions for C++2b
This implements WG21 P1679R3, adding contains member functions to basic_string_view and basic_string. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (basic_string::contains): New member functions. * include/std/string_view (basic_string_view::contains): Likewise. * include/std/version (__cpp_lib_string_contains): Define. * testsuite/21_strings/basic_string/operations/starts_with/char/1.cc: Remove trailing whitespace. * testsuite/21_strings/basic_string/operations/starts_with/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string/operations/contains/char/1.cc: New test. * testsuite/21_strings/basic_string/operations/contains/wchar_t/1.cc: New test. * testsuite/21_strings/basic_string_view/operations/contains/char/1.cc: New test. * testsuite/21_strings/basic_string_view/operations/contains/char/2.cc: New test. * testsuite/21_strings/basic_string_view/operations/contains/wchar_t/1.cc: New test. |
||
Jakub Jelinek
|
99dee82307 | Update copyright years. | ||
François Dumont
|
38b17c27ce |
libstdc++: Make _GLIBCXX_DEBUG checks constexpr compatible
libstdc++-v3/ChangeLog: * include/debug/assertions.h (__glibcxx_requires_non_empty_range): Remove __builtin_expect. (__glibcxx_requires_subscript): Likewise. (__glibcxx_requires_nonempty): Likewise. * include/debug/formatter.h (__check_singular): Add C++11 constexpr qualification. * include/debug/helper_functions.h (__check_singular): Likewise. Skip check if constant evaluated. (__valid_range): Do not skip check if constant evaluated. * include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_COND_AT): Add __builtin_expect. (_GLIBCXX_DEBUG_VERIFY_AT_F): Use __glibcxx_assert_1. * testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc: New test. * testsuite/21_strings/basic_string_view/element_access/char/constexpr.cc: New test. * testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: New test. * testsuite/21_strings/basic_string_view/element_access/char/front_back_constexpr.cc: New test. * testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc: New test. * testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc: New test. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr.cc: New test. * testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: New test. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc: New test. * testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc: New test. * testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc: New test. * testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc: New test. * testsuite/25_algorithms/lower_bound/debug/partitioned_neg.cc: New test. * testsuite/25_algorithms/lower_bound/debug/partitioned_pred_neg.cc: New test. * testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc: New test. * testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc: New test. * testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc: New test. * testsuite/25_algorithms/upper_bound/debug/partitioned_neg.cc: New test. * testsuite/25_algorithms/upper_bound/debug/partitioned_pred_neg.cc: New test. |
||
Jonathan Wakely
|
13feb0234b |
libstdc++: Avoid warnings in tests
This fixes some warnings emitted when testing with warning flags added. Some of these are only necessary when testing with -Wsystem-headers, but either way it cleans up the tests to be less noisy under non-default flags. libstdc++-v3/ChangeLog: * testsuite/18_support/96817.cc: Avoid -Wunused warnings. * testsuite/20_util/any/assign/2.cc: Likewise. * testsuite/20_util/any/cons/2.cc: Likewise. * testsuite/20_util/align/1.cc: Avoid -Wsign-compare warning. * testsuite/20_util/function/65760.cc: Avoid -Wunused warning. * testsuite/20_util/function/1.cc: Avoid -Wcatch-value warning. * testsuite/20_util/function/cons/move_target.cc: Avoid -Wunused warning. * testsuite/20_util/headers/memory/synopsis.cc: Add exception specification. * testsuite/20_util/monotonic_buffer_resource/allocate.cc: Avoid -Wsign-compare warning. * testsuite/20_util/tuple/cons/deduction.cc: Avoid -Wunused warning. * testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc: Avoid -Wdeprecated-copy warning. * testsuite/21_strings/basic_string/56166.cc: Avoid -Wcatch-value warning. * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc: Avoid -Wcatch-value warnings. * testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/nonnull.cc: Prune additional diagnostics. * testsuite/21_strings/basic_string_view/operations/find/char/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/nonnull.cc: Likewise. * testsuite/21_strings/headers/string/synopsis.cc: Add exception specifications. * testsuite/22_locale/locale/cons/12352.cc: Define sized delete operators to avoid warnings. * testsuite/23_containers/deque/modifiers/swap/1.cc: Add exception specification. * testsuite/23_containers/forward_list/cons/11.cc: Avoid -Wdeprecated-copy warning. * testsuite/23_containers/headers/bitset/synopsis.cc: Add exception specification. * testsuite/23_containers/headers/deque/synopsis.cc: Likewise. * testsuite/23_containers/headers/forward_list/synopsis.cc: Likewise. * testsuite/23_containers/headers/list/synopsis.cc: Likewise. * testsuite/23_containers/headers/map/synopsis.cc: Likewise. * testsuite/23_containers/headers/queue/synopsis.cc: Likewise. * testsuite/23_containers/headers/set/synopsis.cc: Likewise. * testsuite/23_containers/headers/vector/synopsis.cc: Likewise. * testsuite/23_containers/list/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/map/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/multimap/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/multiset/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/set/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/unordered_set/56267-2.cc: Avoid -Wdeprecated-copy warning. * testsuite/23_containers/vector/bool/23632.cc: Avoid -Wempty-body warning. * testsuite/23_containers/vector/modifiers/swap/1.cc: Add exception specification. * testsuite/25_algorithms/heap/moveable2.cc: Fix misplaced parentheses around arguments. * testsuite/25_algorithms/sample/1.cc: Use return value. * testsuite/25_algorithms/search/searcher.cc: Avoid -Wunused warnings. * testsuite/27_io/basic_ostream/exceptions/char/9561.cc: Likewise. * testsuite/27_io/basic_ostream/exceptions/wchar_t/9561.cc: Likewise. * testsuite/27_io/filesystem/operations/remove_all.cc: Avoid -Wsign-compare warning. * testsuite/experimental/any/assign/2.cc: Avoid -Wunused warnings. * testsuite/experimental/any/cons/2.cc: Likewise. * testsuite/experimental/filesystem/operations/remove_all.cc: Avoid -Wign-compare warning. * testsuite/experimental/memory/observer_ptr/cons/cons.cc: Likewise. * testsuite/experimental/memory_resource/null_memory_resource.cc: Likewise. * testsuite/experimental/source_location/1.cc: Avoid -Waddress warning. * testsuite/ext/pod_char_traits.cc: Avoid -Wunused warning. * testsuite/ext/vstring/modifiers/clear/56166.cc: Avoid -Wcatch-value. * testsuite/std/concepts/concepts.lang/concept.swappable/swap.cc: Avoid -Wunused warning. * testsuite/std/concepts/concepts.lang/concept.swappable/swappable.cc: Likewise. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Prune additional warnings. * testsuite/tr1/3_function_objects/function/1.cc: Avoid -Wcatch-value warning. * testsuite/util/replacement_memory_operators.h: Define sized delete to avoid warnings. * testsuite/util/testsuite_api.h (_NonDefaultConstructible): Add user-declared assignment operator to stop -Wdeprecated-copy warnings. * testsuite/util/testsuite_containers.h: Avoid -Wunused warning. * testsuite/util/testsuite_iterators.h: Avoid -Wsign-compare warnings. * testsuite/util/testsuite_new_operators.h: Define sized deleted. |
||
Aldy Hernandez
|
e864d395b4 |
Convert -Wrestrict pass to ranger.
There is one adjustment to a C++ test which now gives a false positive. After talking with Martin Sebor, we've concluded this is expected. There is no way to communicate that libstdc++ allocated objects are always less than PTRDIFF_MAX. gcc/ChangeLog: * calls.c (get_size_range): Adjust to work with ranger. * calls.h (get_size_range): Add ranger argument to prototype. * gimple-ssa-warn-restrict.c (class wrestrict_dom_walker): Remove. (check_call): Pull out of wrestrict_dom_walker into a static function. (wrestrict_dom_walker::before_dom_children): Rename to... (wrestrict_walk): ...this. (pass_wrestrict::execute): Instantiate ranger. (class builtin_memref): Add stmt and query fields. (builtin_access::builtin_access): Add range_query field. (builtin_memref::builtin_memref): Same. (builtin_memref::extend_offset_range): Same. (builtin_access::builtin_access): Make work with ranger. (wrestrict_dom_walker::check_call): Pull out into... (check_call): ...here. (check_bounds_or_overlap): Add range_query argument. * gimple-ssa-warn-restrict.h (check_bounds_or_overlap): Add range_query and gimple stmt arguments. gcc/testsuite/ChangeLog: * gcc.dg/Wrestrict-22.c: New test. * g++.dg/torture/pr92421.C: Adjust for ranger. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/capacity/1.cc: Pass -Wno-stringop-overflow to test. |
||
Jonathan Wakely
|
2b9c09a78b |
libstdc++: Fix tests that fail with old std::string ABI
These two tests have started to fail with the old std::string ABI. The scan-assembler-not checks fail because they match debug info, not code. Adding -g0 to the test flags fixes them. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc: Do not generate debug info. * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc: Likewise. |
||
Jonathan Wakely
|
5e961dba46 |
libstdc++: Improve comments in std::string tests
The COW std::string does support some features of C++11 allocators, just not propagation. Change some comments in the tests to be more precise about that. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/allocator/char/copy.cc: Make comment more precise about what isn't supported by COW strings. * testsuite/21_strings/basic_string/allocator/char/copy_assign.cc: Likewise. * testsuite/21_strings/basic_string/allocator/char/move.cc: Likewise. * testsuite/21_strings/basic_string/allocator/char/move_assign.cc: Likewise. * testsuite/21_strings/basic_string/allocator/char/noexcept.cc: Likewise. * testsuite/21_strings/basic_string/allocator/char/operator_plus.cc: Likewise. * testsuite/21_strings/basic_string/allocator/char/swap.cc: Likewise. * testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc: Likewise. * testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc: Likewise. * testsuite/21_strings/basic_string/allocator/wchar_t/move.cc: Likewise. * testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc: Likewise. * testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc: Likewise. * testsuite/21_strings/basic_string/allocator/wchar_t/operator_plus.cc: Likewise. * testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc: Likewise. |
||
Jonathan Wakely
|
5ae9ddd480 |
libstdc++: Enable tests that incorrectly require cxx11-abi
These tests were not being run when -D_GLIBCXX_USE_CXX11_ABI=0 was added to the test flags, but they actually work OK with the old string. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/allocator/char/minimal.cc: Do not require cxx11-abi effective target. * testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc: Likewise. * testsuite/27_io/basic_fstream/cons/base.cc: Likewise. |
||
Jonathan Wakely
|
dc38e25524 |
libstdc++: Implement LWG 3706 for COW strings
The basic_string deduction guides are defined for the old ABI, but the tests are currently disabled. This is because a single case fails when using the old ABI, which is just because LWG 3706 isn't implemented for the old ABI. That can be done easily, and the tests can be enabled. libstdc++-v3/ChangeLog: * include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI] (basic_string(const _CharT*, const _Alloc&)): Constrain to require an allocator-like type to fix CTAD ambiguity (LWG 3706). * testsuite/21_strings/basic_string/cons/char/deduction.cc: Remove dg-skip-if. * testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc: Likewise. |
||
Jonathan Wakely
|
24f2764521 |
libstdc++: Remove tests for self-move debug assertions
I recently removed the debug mode checks for self-move assignment, which means these tests now fail when _GLIBCXX_DEBUG is added to the options or when the check-debug target is used. Remove all the tests. libstdc++-v3/ChangeLog: * testsuite/21_strings/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/21_strings/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/deque/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/deque/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/forward_list/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/forward_list/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/list/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/list/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/map/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/map/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/multimap/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/multimap/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/multiset/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/multiset/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/set/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/set/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_map/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_map/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multimap/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multimap/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multiset/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multiset/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_set/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_set/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/vector/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/vector/debug/self_move_assign_neg.cc: Removed. |
||
Jonathan Wakely
|
c2fb0a1a2e |
libstdc++: Make self-move well-defined for containers [PR 85828]
The C++ LWG recently confirmed that self-move assignment should not have undefined behaviour for standard containers (see the proposed resolution of LWG 2839). The result should be a valid but unspecified value, just like other times when a container is moved from. Our std::list, std::__cxx11::basic_string and unordered containers all have bugs which result in undefined behaviour. For std::list the problem is that we clear the previous contents using _M_clear() instead of clear(). This means the _M_next, _M_prev and _M_size members are not zeroed, and so after we "update" them (with their existing values), we are left with dangling pointers and a non-zero size, but no elements. For the unordered containers the problem is similar. _Hashtable first deallocates the existing contents, then takes ownership of the pointers from the RHS object (which has just had its contents deallocated so the pointers are dangling). For std::basic_string it's a little more subtle. When the string is local (i.e. fits in the SSO buffer) we use char_traits::copy to copy the contents from this->data() to __rhs.data(). When &__rhs == this that copy violates the precondition that the ranges don't overlap. We only need to check for self-move for this case where it's local, because the only other case that can be true for self-move is that it's non-local but the allocators compare equal. In that case the data pointer is neither deallocated nor leaked, so the result is well-defined. This patch also makes a small optimization for std::deque move assignment, to use the efficient move when is_always_equal is false, but the allocators compare equal at runtime. Finally, we need to remove all the Debug Mode checks which abort the program when a self-move is detected, because it's not undefined to do that. Before PR 85828 can be closed we should also look into fixing std::shuffle so it doesn't do any redundant self-swaps. libstdc++-v3/ChangeLog: PR libstdc++/85828 * include/bits/basic_string.h (operator=(basic_string&&)): Check for self-move before copying with char_traits::copy. * include/bits/hashtable.h (operator=(_Hashtable&&)): Check for self-move. * include/bits/stl_deque.h (_M_move_assign1(deque&&, false_type)): Check for equal allocators. * include/bits/stl_list.h (_M_move_assign(list&&, true_type)): Call clear() instead of _M_clear(). * include/debug/formatter.h (__msg_self_move_assign): Change comment. * include/debug/macros.h (__glibcxx_check_self_move_assign): (_GLIBCXX_DEBUG_VERIFY): Remove. * include/debug/safe_container.h (operator=(_Safe_container&&)): Remove assertion check for safe move and make it well-defined. * include/debug/safe_iterator.h (operator=(_Safe_iterator&&)): Remove assertion check for self-move. * include/debug/safe_local_iterator.h (operator=(_Safe_local_iterator&&)): Likewise. * testsuite/21_strings/basic_string/cons/char/self_move.cc: New test. * testsuite/23_containers/deque/cons/self_move.cc: New test. * testsuite/23_containers/forward_list/cons/self_move.cc: New test. * testsuite/23_containers/list/cons/self_move.cc: New test. * testsuite/23_containers/set/cons/self_move.cc: New test. * testsuite/23_containers/unordered_set/cons/self_move.cc: New test. * testsuite/23_containers/vector/cons/self_move.cc: New test. |
||
Andrew Luo
|
140cf935cd |
libstdc++: Implement P0966 std::string::reserve should not shrink
Remove ability for reserve(n) to reduce a string's capacity. Add a new reserve() overload that makes a shrink-to-fit request, and make shrink_to_fit() use that. libstdc++-v3/ChangeLog: 2020-07-30 Andrew Luo <andrewluotechnologies@outlook.com> Jonathan Wakely <jwakely@redhat.com> * config/abi/pre/gnu.ver (GLIBCXX_3.4): Use less greedy patterns for basic_string members. (GLIBCXX_3.4.29): Export new basic_string::reserve symbols. * doc/xml/manual/status_cxx2020.xml: Update P0966 status. * include/bits/basic_string.h (shrink_to_fit()): Call reserve(). (reserve(size_type)): Remove default argument. (reserve()): Declare new overload. [!_GLIBCXX_USE_CXX11_ABI] (shrink_to_fit, reserve): Likewise. * include/bits/basic_string.tcc (reserve(size_type)): Remove support for shrinking capacity. (reserve()): Perform shrink-to-fit operation. [!_GLIBCXX_USE_CXX11_ABI] (reserve): Likewise. * testsuite/21_strings/basic_string/capacity/1.cc: Adjust to reflect new behavior. * testsuite/21_strings/basic_string/capacity/char/1.cc: Likewise. * testsuite/21_strings/basic_string/capacity/char/18654.cc: Likewise. * testsuite/21_strings/basic_string/capacity/char/2.cc: Likewise. * testsuite/21_strings/basic_string/capacity/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string/capacity/wchar_t/18654.cc: Likewise. * testsuite/21_strings/basic_string/capacity/wchar_t/2.cc: Likewise. |
||
Jonathan Wakely
|
4e39f563c0 |
libstdc++: Do not set eofbit eagerly in operator>>(istream&, char(&)[N])
Similar to the bugs I fixed recently in istream::ignore, we incorrectly set eofbit too often in operator>>(istream&, string&) and operator>>(istream&. char(&)[N]). We should only set eofbit if we reach EOF but would have kept going otherwise. If we've already extracted the maximum number of characters (whether that's because of the buffer size or the istream's width()) then we should not set eofbit. libstdc++-v3/ChangeLog: * include/bits/basic_string.tcc (operator>>(basic_istream&, basic_string&)): Do not set eofbit if extraction stopped after in.width() characters. * src/c++98/istream-string.cc (operator>>(istream&, string&)): Likewise. * include/bits/istream.tcc (__istream_extract): Do not set eofbit if extraction stopped after n-1 characters. * src/c++98/istream.cc (__istream_extract): Likewise. * testsuite/21_strings/basic_string/inserters_extractors/char/13.cc: New test. * testsuite/21_strings/basic_string/inserters_extractors/wchar_t/13.cc: New test. * testsuite/27_io/basic_istream/extractors_character/char/5.cc: New test. * testsuite/27_io/basic_istream/extractors_character/wchar_t/5.cc: New test. |
||
Jonathan Wakely
|
6458742a15 |
libstdc++: Ensure c++NN effective target present in all C++17 tests
Also reorder some directives so that the dg-options setting -std=gnu++17 comes before the dg-do that requires c++17. libstdc++-v3/ChangeLog: * testsuite/17_intro/headers/c++2017/all_attributes.cc: Add c++17 effective-target. * testsuite/17_intro/headers/c++2017/all_no_exceptions.cc: Likewise. * testsuite/17_intro/headers/c++2017/all_no_rtti.cc: Likewise. * testsuite/17_intro/headers/c++2017/all_pedantic_errors.cc: Likewise. * testsuite/17_intro/headers/c++2017/operator_names.cc: Likewise. * testsuite/17_intro/headers/c++2017/stdc++.cc: Likewise. * testsuite/17_intro/headers/c++2017/stdc++_multiple_inclusion.cc: Likewise. * testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc: Likewise. * testsuite/19_diagnostics/error_code/is_error_code_v.cc: Likewise. * testsuite/20_util/any/assign/1.cc: Likewise. * testsuite/20_util/any/assign/2.cc: Likewise. * testsuite/20_util/any/assign/emplace.cc: Likewise. * testsuite/20_util/any/assign/exception.cc: Likewise. * testsuite/20_util/any/assign/self.cc: Likewise. * testsuite/20_util/any/cons/1.cc: Likewise. * testsuite/20_util/any/cons/2.cc: Likewise. * testsuite/20_util/any/cons/aligned.cc: Likewise. * testsuite/20_util/any/cons/explicit.cc: Likewise. * testsuite/20_util/any/cons/in_place.cc: Likewise. * testsuite/20_util/any/cons/nontrivial.cc: Likewise. * testsuite/20_util/any/make_any.cc: Likewise. * testsuite/20_util/any/misc/any_cast.cc: Likewise. * testsuite/20_util/any/misc/any_cast_no_rtti.cc: Likewise. * testsuite/20_util/any/misc/swap.cc: Likewise. * testsuite/20_util/any/modifiers/1.cc: Likewise. * testsuite/20_util/any/observers/type.cc: Likewise. * testsuite/20_util/any/requirements.cc: Likewise. * testsuite/20_util/any/typedefs.cc: Likewise. * testsuite/20_util/as_const/1.cc: Likewise. * testsuite/20_util/as_const/rvalue_neg.cc: Likewise. * testsuite/20_util/bind/is_placeholder_v.cc: Likewise. * testsuite/20_util/bool_constant/requirements.cc: Likewise. * testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc: Likewise. * testsuite/20_util/duration_cast/rounding.cc: Likewise. * testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc: Likewise. * testsuite/20_util/function_objects/invoke/59768.cc: Likewise. * testsuite/20_util/function_objects/not_fn/1.cc: Likewise. * testsuite/20_util/function_objects/searchers.cc: Likewise. * testsuite/20_util/in_place/requirements.cc: Likewise. * testsuite/20_util/is_invocable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_invocable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_invocable/value.cc: Likewise. * testsuite/20_util/is_nothrow_invocable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_invocable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/value.cc: Likewise. * testsuite/20_util/is_nothrow_swappable_with/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_swappable_with/value.cc: Likewise. * testsuite/20_util/is_swappable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_swappable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_swappable/value.cc: Likewise. * testsuite/20_util/is_swappable_with/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_swappable_with/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_swappable_with/value.cc: Likewise. * testsuite/20_util/logical_traits/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/logical_traits/requirements/typedefs.cc: Likewise. * testsuite/20_util/logical_traits/value.cc: Likewise. * testsuite/20_util/optional/constexpr/make_optional.cc: Likewise. * testsuite/20_util/optional/constexpr/observers/2.cc: Likewise. * testsuite/20_util/optional/constexpr/observers/3.cc: Likewise. * testsuite/20_util/optional/hash.cc: Likewise. * testsuite/20_util/pair/swap_cxx17.cc: Likewise. * testsuite/20_util/ratio/requirements/ratio_equal_v.cc: Likewise. * testsuite/20_util/shared_ptr/requirements/weak_type.cc: Likewise. * testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc: Likewise. * testsuite/20_util/tuple/apply/1.cc: Likewise. * testsuite/20_util/tuple/make_from_tuple/1.cc: Likewise. * testsuite/20_util/tuple/swap_cxx17.cc: Likewise. * testsuite/20_util/tuple/tuple_size_v.cc: Likewise. * testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc: Likewise. * testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc: Likewise. * testsuite/20_util/variant/any.cc: Likewise. * testsuite/20_util/variant/compile.cc: Likewise. * testsuite/20_util/variant/hash.cc: Likewise. * testsuite/20_util/variant/index_type.cc: Likewise. * testsuite/20_util/variant/run.cc: Likewise. * testsuite/20_util/void_t/1.cc: Likewise. * testsuite/21_strings/basic_string/79162.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/7.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/7.cc: Likewise. * testsuite/21_strings/basic_string/lwg2758.cc: Likewise. * testsuite/21_strings/basic_string/lwg2946.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/append/char/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/append/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/char/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/insert/char/3.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/insert/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/replace/char/7.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/replace/wchar_t/7.cc: Likewise. * testsuite/21_strings/basic_string/operations/compare/char/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/compare/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/data/char/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/find/char/5.cc: Likewise. * testsuite/21_strings/basic_string/operations/find/wchar_t/5.cc: Likewise. * testsuite/21_strings/basic_string/operators/char/5.cc: Likewise. * testsuite/21_strings/basic_string/operators/wchar_t/5.cc: Likewise. * testsuite/21_strings/basic_string_view/capacity/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/empty.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_back.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/empty.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_back.cc: Likewise. * testsuite/21_strings/basic_string_view/include.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/pod/10081-out.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/3.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/modifiers/remove_prefix/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/13650.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/13650.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/data/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/data/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/4.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/string_conversion/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char8_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/types/1.cc: Likewise. * testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc: Likewise. * testsuite/23_containers/map/modifiers/extract.cc: Likewise. * testsuite/23_containers/map/modifiers/insert_or_assign/1.cc: Likewise. * testsuite/23_containers/map/modifiers/merge.cc: Likewise. * testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise. * testsuite/23_containers/multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/multimap/modifiers/merge.cc: Likewise. * testsuite/23_containers/multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/multiset/modifiers/merge.cc: Likewise. * testsuite/23_containers/set/modifiers/extract.cc: Likewise. * testsuite/23_containers/set/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/insert_or_assign.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/try_emplace.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/merge.cc: Likewise. * testsuite/24_iterators/headers/iterator/range_access_c++17.cc: Likewise. * testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Likewise. * testsuite/25_algorithms/clamp/1.cc: Likewise. * testsuite/25_algorithms/clamp/2.cc: Likewise. * testsuite/25_algorithms/clamp/constexpr.cc: Likewise. * testsuite/25_algorithms/clamp/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/25_algorithms/clamp/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/26_numerics/headers/cmath/functions_std_c++17.cc: Likewise. * testsuite/26_numerics/headers/cmath/special_functions_global.cc: Likewise. * testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc: Likewise. * testsuite/29_atomics/atomic/is_always_lock_free.cc: Likewise. * testsuite/29_atomics/atomic_integral/is_always_lock_free.cc: Likewise. * testsuite/30_threads/shared_lock/70766.cc: Likewise. * testsuite/30_threads/shared_mutex/cons/1.cc: Likewise. * testsuite/30_threads/shared_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/shared_mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/shared_mutex/requirements/standard_layout.cc: Likewise. * testsuite/30_threads/shared_mutex/try_lock/1.cc: Likewise. * testsuite/30_threads/shared_mutex/try_lock/2.cc: Likewise. * testsuite/30_threads/shared_mutex/unlock/1.cc: Likewise. |
||
Martin Sebor
|
8461191b82 |
Adjust text of expected warnings changed in PR c++/86568.
libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string_view/cons/char/nonnull.cc: Adjust text of expected warning. * testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc: Same. * testsuite/21_strings/basic_string_view/operations/compare/char/nonnull.cc: Same. * testsuite/21_strings/basic_string_view/operations/find/char/nonnull.cc: Same. * testsuite/21_strings/basic_string_view/operations/rfind/char/nonnull.cc: Same. |
||
Ville Voutilainen
|
2635f9e508 |
Revert "Add a __nonnnull__ attribute to std::string's _CharT* constructor"
This reverts commit
|
||
Ville Voutilainen
|
b26fd416fb |
Add a __nonnnull__ attribute to std::string's _CharT* constructor
Add a __nonnnull__ attribute to std::string's _CharT* constructor * include/bits/basic_string.h (string(_CharT*, const _Alloc&)): Add a __nonnull__ attribute. * testsuite/21_strings/basic_string/cons/char/nonnull.cc: New. * testsuite/21_strings/basic_string/cons/wchar_t/nonnull.cc: Likewise. |
||
Jonathan Wakely
|
b6ab9ecd55 |
libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20
Although not required by SD-6 or the C++20 draft, we define the macro __cpp_lib_constexpr_char_traits to indicate support for P0432R1. This updates the value in C++20 mode for the P1032R1 changes to char_traits. * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits): Update value for C++20. * include/std/version (__cpp_lib_constexpr_char_traits): Likewise. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc: Update expected value. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: Likewise. |
||
Paul Keir
|
eb11134d0c |
libstdc++: Fix char_traits move with overlap
Upon constexpr evaluation, char_traits move uses copy_backward, but its last argument should be to the range end rather than its beginning. 2020-06-12 Paul Keir <paul.keir@uws.ac.uk> * include/bits/char_traits.h (char_traits::move): constexpr move with overlap was using copy_backward incorrectly. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: New test. |