- Aug 18, 2021
-
-
Jonathan Wakely authored
Add more detailed documentation for unique_ptr and related components. The new alias templates for the _MakeUniq SFINAE helper make the generated docs look better too. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/unique_ptr.h (default_delete): Add @since tag. (unique_ptr, unique_ptr<T[]>): Likewise. Improve @brief. (make_unique, make_unique_for_overwrite): Likewise. Add @tparam, @param, and @returns. (_MakeUniq): Move to __detail namespace. Add alias template helpers.
-
Jonathan Wakely authored
Add notes about deprecation and modern replacements. Fix bogus "memory_adaptors" group name. Use markdown for formatting. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/stl_function.h: Improve doxygen comments.
-
Jonathan Wakely authored
Improve grouping, add @since and @deprecated information. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (PREDEFINED): Enable doxygen processing for C++20 components and components that depend on compiler features. * include/bits/stl_algo.h (random_shuffle): Use @deprecated. * include/std/type_traits: Improve doxygen comments for C++20 traits.
-
Jonathan Wakely authored
The std::complex partial specializations have been unnecessary since 774c3d86 Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/ext/type_traits.h (__promote_2, __promote_3) (__promote_4): Redfine as alias templates using __promoted_t. * include/std/complex (__promote_2): Remove partial specializations for std::complex.
-
Jonathan Wakely authored
The debug mode checks for a valid range are redundant when we have an initializer_list argument, because we know it's a valid range already. By making std::min(initialier_list<T>) call the internal __min_element function directly we avoid a function call and skip those checks. The same can be done for the overload taking a comparison function, and also for the std::max and std::minmax overloads for initializer_list arguments. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/stl_algo.h (min(initializer_list<T>)) (min(initializer_list<T>, Compare)): Call __min_element directly to avoid redundant debug checks for valid ranges. (max(initializer_list<T>), max(initializer_list<T>, Compare)): Likewise, for __max_element. (minmax(initializer_list<T>), minmax(initializer_list<T>, Compare)): Likewise, for __minmax_element.
-
Jonathan Wakely authored
This fixes some 23_containers/*/cons/deduction.cc failures seen with -std=c++17/-D_GLIBCXX_DEBUG, caused by non-immediate errors when substituting template arguments into an incorrect specialization of the std::__cxx1998 base class. This happens because the size_type member of the debug container is _Base_type::size_type, so is non-deducible, and the deduced types get substituted into _Base_type, triggering the static_assert that checks the allocator's value_type matches the container's. The solution is to make the C(size_type, const T&, const Alloc&) constructors of the debug sequence containers non-deducible. In order to make CTAD work again deduction guides that use std::size_t for the first argument are added. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/debug/deque (deque(size_type, const T&, const A&)): Prevent class template argument deduction and replace with a deduction guide. * include/debug/forward_list (forward_list(size_type, const T&, const A&)): Likewise. * include/debug/list (list(size_type, const T&, const A&)): Likewise. * include/debug/vector (vector(size_type, const T&, const A&)): Likewise.
-
Jonathan Wakely authored
This fixes a compilation error in debug mode, due to std::_Bit_reference not being defined, because it's in namespace std::__cxx1998 instead. We can refer to it as vector<bool>::reference instead, which always works. That fixes some compilation errors in debug mode, but the tests fail at run-time instead because the printers for vector<bool> helpers are only registered for the std namespace, not std::__cxx1998. That is fixed by using add_container to register the printers instead of add_version, as the former registers them in the std and std::__cxx1998 namespaces. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdBitReferencePrinter): Use 'std::vector<bool>::reference' as type name, not _Bit_reference. (build_libstdcxx_dictionary): Register printers for vector<bool> types in debug mode too. * testsuite/libstdc++-prettyprinters/simple.cc: Adjust expected output for invalid _Bit_reference. Use vector<bool>::reference instead of _Bit_reference. * testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
-
GCC Administrator authored
-
- Aug 17, 2021
-
-
Thomas Schwinge authored
This is a follow-up to commit 697b94cf "libstdc++: Avoid illegal argument to verbose in dg-test callback". I'm confirming the original problem, but on one system, it's not resolved by this change, because instead we get: extra_tool_flags are: ERROR: tcl error sourcing [...]/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp. ERROR: usage: send [args] string while executing "send_log "$message\n"" (procedure "verbose" line 48) invoked from within "verbose -log -- $extra_tool_flags" (procedure "libstdc++-dg-test" line 45) invoked from within "${tool}-dg-test $prog [lindex ${dg-do-what} 0] "$tool_flags ${dg-extra-tool-flags}"" (procedure "saved-dg-test" line 115) invoked from within [...] That's Ubuntu's dejagnu 1.5-3ubuntu1 being so old that it doesn't include DejaGnu commit 57c22601afe43d2c2b8819df4f2ecacb034516fd "Protect from leading dash in message". (I suppose that's what'd make this work, but have not verified.) libstdc++-v3/ * testsuite/lib/libstdc++.exp: Avoid illegal argument to verbose, continued.
-
Luc Michel authored
This fixes an incorrect invocation of gdb on remote targets where DejaGNU would try to run host's gdb in remote target simulator. gdb-test skips the testing when target is remote or non native but the gdb version check function does not. Suggested-by:
Jonathan Wakely <jwakely@redhat.com> Signed-off-by:
Luc Michel <lmichel@kalray.eu> Co-authored-by:
Marc Poulhies <mpoulhies@kalrayinc.com> libstdc++-v3/ChangeLog: * testsuite/lib/gdb-test.exp (gdb_version_check) (gdb_version_check_xmethods): Only check the GDB version for local native targets.
-
Antony Polukhin authored
When std::seed_seq is constructed from random access iterators we can detect the internal vector size in O(1). Reserving memory for elements in such cases may avoid multiple memory allocations. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/random.tcc (seed_seq::seed_seq): Reserve capacity if distance is O(1). * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error line number. Co-authored-by:
Jonathan Wakely <jwakely@redhat.com>
-
Jonathan Wakely authored
Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * testsuite/26_numerics/random/seed_seq/cons/range.cc: Check construction from input iterators.
-
Jonathan Wakely authored
The std::error_category printer wasn't meant to be part of the commit adding std::error_code and std::error_condition printers. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdErrorCatPrinter): Remove.
-
Jonathan Wakely authored
PR 101923 points out that the unconditional swap in the std::function move constructor makes it slower than copying an empty std::function. The copy constructor has to check for the empty case before doing anything, and that makes it very fast for the empty case. Adding the same check to the move constructor avoids copying the _Any_data POD when we don't need to. We can also inline the effects of swap, by copying each member and then zeroing the pointer members. This makes moving an empty object at least as fast as copying an empty object. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/101923 * include/bits/std_function.h (function(function&&)): Check for non-empty parameter before doing any work.
-
Jonathan Wakely authored
The new contains member of the COW string is defined for non-strict gnu++20 mode as well as for C++23 modes. I think that was left in the committed patch unintentionally. It is inconsistent with the SSO string, and doesn't actually compile because it uses the basic_string_view::contains member which only defined for C++23. This makes it only defined for C++23. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/cow_string.h (basic_string::contains): Do not define for -std=gnu++20.
-
Jonathan Wakely authored
This is done to match an editorial change in the working draft, to rename the exposition-only not-same-as helper to different-from. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/ranges_util.h (__not_same_as): Rename to __different_from. * include/std/ranges (__not_same_as): Likewise.
-
Jonathan Wakely authored
This is not required by the standard, but seems useful. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/std/utility (exchange): Add noexcept-specifier. * testsuite/20_util/exchange/noexcept.cc: New test.
-
Jonathan Wakely authored
Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Define. (build_libstdcxx_dictionary): Register printer for std::error_code and std::error_condition. * testsuite/libstdc++-prettyprinters/cxx11.cc: Test it.
-
GCC Administrator authored
-
- Aug 16, 2021
-
-
Jonathan Wakely authored
The expression ctx._M_indent is not a constant expression when ctx is a reference parameter, even though _M_indent is an enumerator. Rename it to _S_indent to be consistent with our conventions, and refer to it as PrintContext::_S_indent to be valid C++ code (at least until P2280 is accepted as a DR). Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/101937 * src/c++11/debug.cc (PrintContext::_M_indent): Replace with a static data member. (print_word): Use qualified-id to access it.
-
Jonathan Wakely authored
The additional libraries installed by --enable-libstdcxx-debug are built without optimization to aid debugging, but the Python pretty printers are not installed alongside them. This means that you can step through the unoptimized library code, but at the expense of pretty printing the library types. This remedies the situation by installing another copy of the GDB hooks alongside the debug version of libstdc++.so. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * python/Makefile.am [GLIBCXX_BUILD_DEBUG] (install-data-local): Install another copy of the GDB hook. * python/Makefile.in: Regenerate.
-
- Aug 13, 2021
-
-
GCC Administrator authored
-
- Aug 12, 2021
-
-
Jonathan Wakely authored
The [cmath.syn] p1 wording about additional overloads sufficient to handle any arithmetic types also applies to std::lerp. This adds a new overload of std::lerp that does the required promotions to support arguments of arbitrary arithmetic types. A new __promoted_t alias template is added, which the C++17 function templates std::hypot and std::lerp can use to avoid instantiating the __promote_3 class template. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/101870 * include/c_global/cmath (hypot): Use __promoted_t. (lerp): Add new overload accepting any arithmetic types. * include/ext/type_traits.h (__promoted_t): New alias template. * testsuite/26_numerics/lerp.cc: Moved to... * testsuite/26_numerics/lerp/1.cc: ...here. * testsuite/26_numerics/lerp/constexpr.cc: New test. * testsuite/26_numerics/lerp/version.cc: New test.
-
Jonathan Wakely authored
Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * testsuite/26_numerics/lerp.cc: Add header name to #error. * testsuite/26_numerics/midpoint/integral.cc: Likewise. * testsuite/26_numerics/midpoint/version.cc: New test.
-
Jonathan Wakely authored
Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/experimental/random (experimental::randint): Add nodiscard attribute.
-
Jonathan Wakely authored
Give more explicit errors if these files are not built with the correct -std options. libstdc++-v3/ChangeLog: * src/c++98/locale_init.cc: Require C++11. * src/c++98/localename.cc: Likewise. * src/c++98/misc-inst.cc: Require C++98.
-
GCC Administrator authored
-
- Aug 11, 2021
-
-
Jonathan Wakely authored
This test assumes that the same sequence of three values cannot occur, which is incorect. It's unlikely, but not impossible. Perform the check in a loop, so that in the unlikely event of an identical sequence, we retry. If the library code is buggy it will keep producing the same sequence and the test will time out. If the code is working correctly then we will usually break out of the loop after one iteration, or very rarely after two or three. libstdc++-v3/ChangeLog: PR libstdc++/101866 * testsuite/experimental/random/randint.cc: Loop and retry if reseed() produces the same sequence.
-
Jonathan Wakely authored
Implement these traits using the new built-ins that Jakub added recently. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/std/type_traits (__cpp_lib_is_pointer_interconvertible) (is_pointer_interconvertible_base_of_v) (is_pointer_interconvertible_base_of): Define for C++20. * include/std/version (__cpp_lib_is_pointer_interconvertible): Define. * testsuite/23_containers/span/layout_compat.cc: Use correct feature test macro for std::is_layout_compatible_v. * testsuite/20_util/is_pointer_interconvertible/value.cc: New test. * testsuite/20_util/is_pointer_interconvertible/version.cc: New test.
-
Jonathan Wakely authored
-
- Aug 10, 2021
-
-
GCC Administrator authored
-
- Aug 09, 2021
-
-
Jonathan Wakely authored
The std::regex code uses std::map and std::vector, which means that when _GLIBCXX_DEBUG is defined it uses the debug versions of those containers. That no longer compiles, because I changed <regex> to include <bits/stl_map.h> and <bits/stl_vector.h> instead of <map> and <vector>, so the debug versions aren't defined, and std::map doesn't compile. There is also a use of std::stack, which defaults to std::deque which is the debug deque when _GLIBCXX_DEBUG is defined. Using std::map, std::vector, and std::deque is probably a mistake, and we should qualify them with _GLIBCXX_STD_C instead so that the debug versions aren't used. We do not need the overhead of checking our own uses of those containers, which should be correct anyway. The exception is the vector base class of std::match_results, which exposes iterators to users, so can benefit from debug mode checks for its iterators. For other accesses to the vector elements, match_results already does its own checks, so can access the _GLIBCXX_STD_C::vector base class directly. Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/regex.h (basic_regex::transform_primary): Use _GLIBCXX_STD_C::vector for local variable. * include/bits/regex.tcc (__regex_algo_impl): Use reference to _GLIBCXX_STD_C::vector base class of match_results. * include/bits/regex_automaton.tcc (_StateSeq:_M_clone): Use _GLIBCXX_STD_C::map and _GLIBCXX_STD_C::deque for local variables. * include/bits/regex_compiler.h (_BracketMatcher): Use _GLIBCXX_STD_C::vector for data members. * include/bits/regex_executor.h (_Executor): Likewise. * include/std/regex [_GLIBCXX_DEBUG]: Include <debug/vector>.
-
François Dumont authored
Use std::allocator_traits::is_always_equal to find out if we need to compare allocator instances on safe container allocator aware move constructor. libstdc++-v3/ChangeLog: * include/debug/safe_container.h (_Safe_container(_Safe_container&&, const _Alloc&, std::true_type)): New. (_Safe_container(_Safe_container&&, const _Alloc&, std::false_type)): New. (_Safe_container(_Safe_container&&, const _Alloc&)): Use latters.
-
Jonathan Wakely authored
libstdc++-v3/ChangeLog: * testsuite/23_containers/unordered_map/cons/default.cc: Add equality comparison operators to allocator. * testsuite/23_containers/unordered_set/cons/default.cc: Likewise.
-
GCC Administrator authored
-
- Aug 08, 2021
-
-
François Dumont authored
Since __glibcxx_assert changes in r6b42b5a the generated assertion message has changed. libstdc++-v3/ChangeLog: * testsuite/25_algorithms/copy/debug/constexpr_neg.cc: Replace 'failed_assertion' dg-prune-output reason with 'builtin_unreachable'. * testsuite/25_algorithms/copy_backward/debug/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.
-
Hans-Peter Nilsson authored
A simulator can easily spend more than 10 minutes running this test-case, and the default timeout is at 5 minutes. Better allow even slower machines; use 4 as the factor. Regarding relative runtime numbers (very local; mmixware simulator for mmix-knuth-mmixware): test01 and test05 finish momentarily; test02 at about 2 minutes, and test03 about 2m30, but test04 itself runs for more than 6 minues and so times out. Not sure if it's better to split up this test, as the excessive runtime may be unintended, but this seemed simplest. libstdc++-v3: * testsuite/std/ranges/iota/max_size_type.cc: Set dg-timeout-factor to 4.
-
- Aug 07, 2021
-
-
GCC Administrator authored
-
- Aug 06, 2021
-
-
Jonathan Wakely authored
Signed-off-by:
Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * libsupc++/compare (compare_three_way, strong_order) (weak_order, partial_order, compare_strong_order_fallback) (compare_weak_order_fallback, compare_partial_order_fallback): Move nodiscard attributes to correct location.
-
GCC Administrator authored
-