Skip to content
Snippets Groups Projects
  1. Mar 27, 2024
  2. Mar 26, 2024
    • Arsen Arsenović's avatar
      libstdc++: fix generator iterator operator* return type · fb1d50e1
      Arsen Arsenović authored
      Per the standard, the return type of a generators ranges iterator op*
      should be the reference type rather than the yielded type.
      
      The yielded type was used here by mistake.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/generator (generator::_Iterator::operator*): Fix
      	return type.
      	* testsuite/24_iterators/range_generators/iter_deref_return.cc:
      	New test.
      fb1d50e1
    • Arsen Arsenović's avatar
      libstdc++: fix _V badname in <generator> · ac5d63a4
      Arsen Arsenović authored
      libstdc++-v3/ChangeLog:
      
      	* include/std/generator: Fix _V badname.
      ac5d63a4
    • Jonathan Wakely's avatar
      libstdc++: Replace stacktrace effective target with feature test · 217e778a
      Jonathan Wakely authored
      Rmove the dejagnu code for checking whether std::stacktrace is supported
      and just use the new dg-require-cpp-feature-test directive to check for
      __cpp_lib_stacktrace instead.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/19_diagnostics/stacktrace/current.cc: Check for
      	__cpp_lib_stacktrace instead of check for stacktrace ET.
      	* testsuite/19_diagnostics/stacktrace/entry.cc: Likewise.
      	* testsuite/19_diagnostics/stacktrace/hash.cc: Likewise.
      	* testsuite/19_diagnostics/stacktrace/output.cc: Likewise.
      	* testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise.
      	* testsuite/19_diagnostics/stacktrace/synopsis.cc: Likewise.
      	* testsuite/19_diagnostics/stacktrace/version.cc: Likewise.
      	* testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc:
      	Likewise.
      	* testsuite/lib/libstdc++.exp (check_effective_target_stacktrace):
      	Remove.
      217e778a
    • Jonathan Wakely's avatar
      libstdc++: Add dg-require-cpp-feature-test to test feature test macros · 4a3a1b6b
      Jonathan Wakely authored
      This adds a new dejagnu directive which can be used to make a test
      depend on a feature test macro such as __cpp_lib_text_encoding. This is
      mroe flexible than writing a new dg-require-xxx for each feature.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/lib/dg-options.exp (dg-require-cpp-feature-test):
      	New proc.
      	* testsuite/lib/libstdc++.exp (check_v3_target_cpp_feature_test):
      	New proc.
      	* testsuite/std/text_encoding/cons.cc: Use new directive to skip
      	the test if the __cpp_lib_text_encoding feature test macro is
      	not defined.
      	* testsuite/std/text_encoding/requirements.cc: Likewise.
      4a3a1b6b
    • GCC Administrator's avatar
      Daily bump. · 7e6cdec4
      GCC Administrator authored
      7e6cdec4
  3. Mar 25, 2024
  4. Mar 24, 2024
  5. Mar 23, 2024
    • Jonathan Wakely's avatar
      libstdc++: Disable std::formatter specializations (LWG 3944) · 54358504
      Jonathan Wakely authored
      This was just approved in Tokyo as a DR for C++23. It doesn't affect us
      yet, because we don't implement the __cpp_lib_format_ranges features. We
      can add the disabled specializations and add a testcase now though.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/format (formatter): Disable specializations that
      	would allow sequences of narrow characters to be formatted as
      	wchar_t without conversion, as per LWG 3944.
      	* testsuite/std/format/formatter/lwg3944.cc: New test.
      54358504
    • Jonathan Wakely's avatar
      libstdc++: Add __is_in_place_index_v helper and use it in <variant> · 3763fb89
      Jonathan Wakely authored
      We already have __is_in_place_type_v for in_place_type_t so adding an
      equivalent for in_place_index_t allows us avoid a class template
      instantiation for the __not_in_place_tag constraint on the most
      commonly-used std::variant::variant(T&&) constructor.
      
      For in_place_type_t we also have a __is_in_place_type class template
      defined in terms of the variable template, but that isn't actually used
      anywhere. I'm not adding an equivalent for the new variable template,
      because that wouldn't be used either.
      
      For GCC 15 we should remove the unused __is_in_place_tag and
      __is_in_place_type class templates.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/utility.h (__is_in_place_index_v): New variable
      	template.
      	* include/std/variant (__not_in_place_tag): Define in terms of
      	variable templates not a class template.
      3763fb89
    • Jonathan Wakely's avatar
      libstdc++: Use std::type_identity_t in <string_view> as per LWG 3950 [PR114400] · f4605c53
      Jonathan Wakely authored
      The difference between __type_identity_t and std::type_identity_t is
      observable, as demonstrated in the PR. Nobody in LWG seems to think this
      an example we should really care about, but it seems easy and harmless
      to change this.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114400
      	* include/std/string_view (operator==): Use std::type_identity_t
      	in C++20 instead of our own __type_identity_t.
      f4605c53
    • GCC Administrator's avatar
      Daily bump. · e8985864
      GCC Administrator authored
      e8985864
  6. Mar 22, 2024
    • Jonathan Wakely's avatar
      libstdc++: Destroy allocators in re-inserted container nodes [PR114401] · c2e28df9
      Jonathan Wakely authored
      The allocator objects in container node handles were not being destroyed
      after the node was re-inserted into a container. They are stored in a
      union and so need to be explicitly destroyed when the node becomes
      empty. The containers were zeroing the node handle's pointer, which
      makes it empty, causing the handle's destructor to think there's nothign
      to clean up.
      
      Add a new member function to the node handle which destroys the
      allocator and zeros the pointer. Change the containers to call that
      instead of just changing the pointer manually.
      
      We can also remove the _M_empty member of the union which is not
      necessary.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114401
      	* include/bits/hashtable.h (_Hashtable::_M_reinsert_node): Call
      	release() on node handle instead of just zeroing its pointer.
      	(_Hashtable::_M_reinsert_node_multi): Likewise.
      	(_Hashtable::_M_merge_unique): Likewise.
      	(_Hashtable::_M_merge_multi): Likewise.
      	* include/bits/node_handle.h (_Node_handle_common::release()):
      	New member function.
      	(_Node_handle_common::_Optional_alloc::_M_empty): Remove
      	unnecessary union member.
      	(_Node_handle_common): Declare _Hashtable as a friend.
      	* include/bits/stl_tree.h (_Rb_tree::_M_reinsert_node_unique):
      	Call release() on node handle instead of just zeroing its
      	pointer.
      	(_Rb_tree::_M_reinsert_node_equal): Likewise.
      	(_Rb_tree::_M_reinsert_node_hint_unique): Likewise.
      	(_Rb_tree::_M_reinsert_node_hint_equal): Likewise.
      	* testsuite/23_containers/multiset/modifiers/114401.cc: New test.
      	* testsuite/23_containers/set/modifiers/114401.cc: New test.
      	* testsuite/23_containers/unordered_multiset/modifiers/114401.cc: New test.
      	* testsuite/23_containers/unordered_set/modifiers/114401.cc: New test.
      c2e28df9
    • Jonathan Wakely's avatar
      libstdc++: Constrain std::vector default constructor [PR113841] · 142cc4c2
      Jonathan Wakely authored
      This is needed to avoid errors outside the immediate context when
      evaluating is_default_constructible_v<vector<T, A>> when A is not
      default constructible.
      
      To avoid diagnostic regressions for 23_containers/vector/48101_neg.cc we
      need to make the std::allocator<cv T> partial specializations default
      constructible, which they probably should have been anyway.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/113841
      	* include/bits/allocator.h (allocator<cv T>): Add default
      	constructor to partial specializations for cv-qualified types.
      	* include/bits/stl_vector.h (_Vector_impl::_Vector_impl()):
      	Constrain so that it's only present if the allocator is default
      	constructible.
      	* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl()):
      	Likewise.
      	* testsuite/23_containers/vector/cons/113841.cc: New test.
      142cc4c2
    • Jonathan Wakely's avatar
      libstdc++: Use feature test macros in <bits/stl_construct.h> · 8539c561
      Jonathan Wakely authored
      The preprocessor checks for __cplusplus in <bits/stl_construct.h> should
      use the appropriate feature test macros instead of __cplusplus, namely
      __glibcxx_raw_memory_algorithms and __cpp_constexpr_dynamic_alloc.
      
      For the latter, we want to check the compiler macro not the library's
      __cpp_lib_constexpr_dynamic_alloc, because the latter is not defined for
      freestanding but std::construct_at needs to be.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stl_construct.h (destroy_at, construct_at): Guard
      	with feature test macros instead of just __cplusplus.
      8539c561
    • Jonathan Wakely's avatar
      libstdc++: Reorder feature test macro definitions · ff773ac3
      Jonathan Wakely authored
      Put the C++23 generator and tuple_like ones before the C++26 ones.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/version.def (generator, tuple_like): Move earlier
      	in the file.
      	* include/bits/version.h: Regenerate.
      ff773ac3
    • Jonathan Wakely's avatar
      libstdc++: Replace std::result_of with __invoke_result_t [PR114394] · 31ef58b1
      Jonathan Wakely authored
      Replace std::result_of with std::invoke_result, as specified in the
      standard since C++17, to avoid deprecated warnings for std::result_of.
      
      We don't have __invoke_result_t in C++11 mode, so add it as an alias
      template for __invoke_result<>::type (which is what std::result_of uses
      as its base class, so there's no change in functionality).
      
      This fixes warnings given by Clang 18.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114394
      	* include/std/functional (bind): Use __invoke_result_t instead
      	of result_of::type.
      	* include/std/type_traits (__invoke_result_t): New alias
      	template.
      	* testsuite/20_util/bind/ref_neg.cc: Adjust prune pattern.
      31ef58b1
  7. Mar 21, 2024
  8. Mar 20, 2024
  9. Mar 19, 2024
    • Jonathan Wakely's avatar
      libstdc++: Fix infinite loop in std::binomial_distribution [PR114359] · 07e03761
      Jonathan Wakely authored
      The multiplication (4 * _M_t * __1p) can wraparound to zero if _M_t is
      unsigned and 4 * _M_t wraps to zero. The third operand has type double,
      so do the second multiplication first, so that we aren't multiplying
      integers.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114359
      	* include/bits/random.tcc (binomial_distribution::param_type):
      	Ensure arithmetic is done as type double.
      	* testsuite/26_numerics/random/binomial_distribution/114359.cc: New test.
      07e03761
    • Jonathan Wakely's avatar
      libstdc++: Suppress deprecation messages from <tbb/task.h> [PR101228] · c608b57f
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/101228
      	* include/pstl/parallel_backend_tbb.h (TBB_SUPPRESS_DEPRECATED_MESSAGES):
      	Define before including <tbb/task.h> then undef afterwards.
      c608b57f
    • Jonathan Wakely's avatar
      libstdc++: Regenerate <bits/version.h> in maintainer mode · 90788dd7
      Jonathan Wakely authored
      This is a generated header but regenerating it requires the manual step
      of running 'make -C include update-version' in the libstdc++ build dir.
      Make it regenerate automatically when --enable-maintainer-mode is used.
      
      libstdc++-v3/ChangeLog:
      
      	* include/Makefile.am [MAINTAINER_MODE]: Add target to
      	automatically update <bits/version.h>.
      	* include/Makefile.in: Regenerate.
      
      gcc/ChangeLog:
      
      	* doc/install.texi (Prerequisites): Document use of autogen for
      	libstdc++.
      90788dd7
    • Jonathan Wakely's avatar
      libstdc++: Update docs on build process and generated files · d1b8c223
      Jonathan Wakely authored
      There are several more sub-directories below 'src' now, with lots more
      conveience libraries. Document them all as of GCC 14.
      
      Also document how to regenerate the generated headers under include/bits
      and how to update the tzdata.zi file.
      
      libstdc++-v3/ChangeLog:
      
      	* doc/xml/manual/build_hacking.xml: Document generated files.
      	Update list of convenience libraries and sub-directories under
      	the src directory.
      	* doc/html/*: Regenerate.
      d1b8c223
    • Jonathan Wakely's avatar
      libstdc++: Fix Python scripts to output the correct filename · ef2efc53
      Jonathan Wakely authored
      These scripts both print "generated by $file, do not edit" header but
      one of them prints the wrong filename. Use the built-in __file__
      attribute to ensure it's correct.
      
      contrib/ChangeLog:
      
      	* unicode/gen_libstdcxx_unicode_data.py: Fix header of generated
      	file to name the correct script.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/text_encoding-data.h: Regenerate.
      	* include/bits/unicode-data.h: Regenerate.
      	* scripts/gen_text_encoding_data.py: Fix header of generated
      	file to name the correct script.
      ef2efc53
    • Jonathan Wakely's avatar
      libstdc++: Fix typos in MemoryChecker assertion messages in PSTL tests · f5118546
      Jonathan Wakely authored
      This has been reported upstream.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/util/pstl/test_utils.h: Fix typos in comments.
      f5118546
    • Jonathan Wakely's avatar
      libstdc++: Begin lifetime of storage in std::vector<bool> [PR114367] · 16afbd9c
      Jonathan Wakely authored
      This doesn't cause a problem with GCC, but Clang correctly diagnoses a
      bug in the code. The objects in the allocated storage need to begin
      their lifetime before we start using them.
      
      This change uses the allocator's construct function instead of using
      std::construct_at directly, in order to support fancy pointers.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114367
      	* include/bits/stl_bvector.h (_M_allocate): Use allocator's
      	construct function to begin lifetime of words.
      16afbd9c
    • Iain Sandoe's avatar
      libstdc++: Sync the atomic_link_flags implementation with GCC. · 71a44faa
      Iain Sandoe authored
      
      For Darwin, in order to allow uninstalled testing, we need to provide
      a '-B' option pointing to each path containing an uninstalled library
      that we are using (these get appended to the embedded runpaths).
      
      This updates the version of the atomic_link_flags proc in the libstdc++
      testsuite to do the same as the one in the GCC testsuite.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/lib/dg-options.exp (atomic_link_flags): Emit a -B
      	option for the path to the uninstalled libatomic.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      71a44faa
    • Iain Sandoe's avatar
      libstdc++, Darwin: Do not use dev/null as the file for executables. · e47330d0
      Iain Sandoe authored
      
      Darwin has a separate debug linker, which is invoked when the command
      line contains source files and debug is enabled.
      
      Using /dev/null as the executable name does not, therefore, work when
      debug is enabled, since the debug linker does not accept /dev/null as
      a valid executable name.
      
      The leads to incorrectly UNSUPPORTED testcases because of the unintended
      error result from the test compilation.
      
      The solution here is to use a temporary file that is deleted at the
      end of the test (which is the mechanism used elsewhere)
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/lib/libstdc++.exp (v3_target_compile): Instead of
      	/dev/null, use a temporary file for test executables on Darwin.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      e47330d0
    • GCC Administrator's avatar
      Daily bump. · 23409731
      GCC Administrator authored
      23409731
  10. Mar 18, 2024
    • François Dumont's avatar
      libstdc++: Fix N3344 behavior on _Safe_iterator::_M_can_advance · dda96a9d
      François Dumont authored
      We shall be able to advance from a 0 offset a value-initialized iterator.
      
      libstdc++-v3/ChangeLog:
      
      	* include/debug/safe_iterator.tcc (_Safe_iterator<>::_M_can_advance):
      	Accept 0 offset advance on value-initialized iterator.
      	* testsuite/23_containers/vector/debug/n3644.cc: New test case.
      dda96a9d
    • François Dumont's avatar
      libstdc++: Fix _Safe_local_iterator<>::_M_valid_range · 5f6e0853
      François Dumont authored
      Unordered container local_iterator range shall not contain any singular
      iterator unless both iterators are both value-initialized.
      
      libstdc++-v3/ChangeLog:
      
      	* include/debug/safe_local_iterator.tcc
      	(_Safe_local_iterator::_M_valid_range): Add _M_value_initialized and
      	_M_singular checks.
      	* testsuite/23_containers/unordered_set/debug/114316.cc: New test case.
      5f6e0853
    • GCC Administrator's avatar
      Daily bump. · 27d2e933
      GCC Administrator authored
      27d2e933
  11. Mar 17, 2024
    • François Dumont's avatar
      libstdc++: Implement N3644 on _Safe_iterator<> [PR114316] · 07fad7a7
      François Dumont authored
      Consider range of value-initialized iterators as valid and empty.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114316
      	* include/debug/safe_iterator.tcc (_Safe_iterator<>::_M_valid_range):
      	First check if both iterators are value-initialized before checking if
      	singular.
      	* testsuite/23_containers/set/debug/114316.cc: New test case.
      	* testsuite/23_containers/vector/debug/114316.cc: New test case.
      07fad7a7
  12. Mar 15, 2024
  13. Mar 14, 2024
    • Jonathan Wakely's avatar
      libstdc++: Fix std::format("{}", negative_integer) [PR114325] · f89cfdb2
      Jonathan Wakely authored
      The fast path for "{}" format strings has a bug for negative integers
      where the length passed to std::to_chars is too long.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114325
      	* include/std/format (_Scanner::_M_scan): Pass correct length to
      	__to_chars_10_impl.
      	* testsuite/std/format/functions/format.cc: Check negative
      	integers with empty format-spec.
      f89cfdb2
    • Jonathan Wakely's avatar
      libstdc++: Add nodiscard in <algorithm> · df483ebd
      Jonathan Wakely authored
      Add the [[nodiscard]] attribute to several functions in <algorithm>.
      These all have no side effects and are only called for their return
      value (e.g. std::count) or produce a result that must not be discarded
      for correctness (e.g. std::remove).
      
      I was intending to add the attribute to a number of other functions like
      std::copy_if, std::unique_copy, std::set_union, and std::set_difference.
      I stopped when I noticed that MSVC doesn't use it on those functions,
      which I suspect is because they're often used with an insert iterator
      (e.g. std::back_insert_iterator). In that case it doesn't matter if
      you discard the result, because you have the container to tell you how
      many elements were copied to the output range.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stl_algo.h (find_end, all_of, none_of, any_of)
      	(find_if_not, is_partitioned, partition_point, remove)
      	(remove_if, unique, lower_bound, upper_bound, equal_range)
      	(binary_search, includes, is_sorted, is_sorted_until, minmax)
      	(minmax_element, is_permutation, clamp, find_if, find_first_of)
      	(adjacent_find, count, count_if, search, search_n, min_element)
      	(max_element): Add nodiscard attribute.
      	* include/bits/stl_algobase.h (min, max, lower_bound, equal)
      	(lexicographical_compare, lexicographical_compare_three_way)
      	(mismatch): Likewise.
      	* include/bits/stl_heap.h (is_heap, is_heap_until): Likewise.
      	* testsuite/25_algorithms/equal/debug/1_neg.cc: Add dg-warning.
      	* testsuite/25_algorithms/equal/debug/2_neg.cc: Likewise.
      	* testsuite/25_algorithms/equal/debug/3_neg.cc: Likewise.
      	* testsuite/25_algorithms/find_first_of/concept_check_1.cc:
      	Likewise.
      	* testsuite/25_algorithms/is_permutation/2.cc: Likewise.
      	* testsuite/25_algorithms/lexicographical_compare/71545.cc:
      	Likewise.
      	* testsuite/25_algorithms/lower_bound/33613.cc: Likewise.
      	* testsuite/25_algorithms/lower_bound/debug/irreflexive.cc:
      	Likewise.
      	* testsuite/25_algorithms/lower_bound/debug/partitioned_neg.cc:
      	Likewise.
      	* testsuite/25_algorithms/lower_bound/debug/partitioned_pred_neg.cc:
      	Likewise.
      	* testsuite/25_algorithms/minmax/3.cc: Likewise.
      	* testsuite/25_algorithms/search/78346.cc: Likewise.
      	* testsuite/25_algorithms/search_n/58358.cc: Likewise.
      	* testsuite/25_algorithms/unique/1.cc: Likewise.
      	* testsuite/25_algorithms/unique/11480.cc: Likewise.
      	* testsuite/25_algorithms/upper_bound/33613.cc: Likewise.
      	* testsuite/25_algorithms/upper_bound/debug/partitioned_neg.cc:
      	Likewise.
      	* testsuite/25_algorithms/upper_bound/debug/partitioned_pred_neg.cc:
      	Likewise.
      	* testsuite/ext/concept_checks.cc: Likewise.
      	* testsuite/ext/is_heap/47709.cc: Likewise.
      	* testsuite/ext/is_sorted/cxx0x.cc: Likewise.
      df483ebd
    • xndcn's avatar
      libstdc++: Add missing clear_padding in __atomic_float constructor · 0adc8c5f
      xndcn authored
      
      For 80-bit long double we need to clear the padding bits on
      construction.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/atomic_base.h (__atomic_float::__atomic_float(Fp)):
      	Clear padding.
      	* testsuite/29_atomics/atomic_float/compare_exchange_padding.cc:
      	New test.
      
      Signed-off-by: default avatarxndcn <xndchn@gmail.com>
      
      Reviewed-by: default avatarJonathan Wakely <jwakely@redhat.com>
      0adc8c5f
    • Jonathan Wakely's avatar
      libstdc++: Correct notes about std::call_once in manual [PR66146] · e6836bbb
      Jonathan Wakely authored
      The bug with exceptions thrown during a std::call_once call affects all
      targets, so fix the docs that say it only affects non-Linux targets.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/66146
      	* doc/xml/manual/status_cxx2011.xml: Remove mention of Linux in
      	note about std::call_once.
      	* doc/xml/manual/status_cxx2014.xml: Likewise.
      	* doc/xml/manual/status_cxx2017.xml: Likewise.
      	* doc/html/manual/status.html: Regenerate.
      e6836bbb
    • Jonathan Wakely's avatar
      libstdc++: Update C++23 status in the manual · 2a556dbe
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* doc/xml/manual/status_cxx2023.xml: Update C++23 status table.
      	* doc/html/manual/status.html: Regenerate.
      	* include/bits/version.def: Fix typo in comment.
      2a556dbe
Loading