Commit Graph

13407 Commits

Author SHA1 Message Date
GCC Administrator
d9176e643f Daily bump. 2022-05-28 00:16:40 +00:00
Jonathan Wakely
de57440858 libstdc++: Mark non-exported function always_inline [PR105671]
This new function was added for gcc 11.1 but is not exported from the
shared library. Depending on inlining decisions, its callers might get
inlined but an external definition be needed for this function. That
then fails to link.

Since we can't add the export to the gcc-11 release branch now, mark it
always_inline. We can consider exporting it for gcc-13 if/when we bump
the shared library version (and maybe also for gcc-12 which is currently
at the same version as trunk). For now, the attribute will solve the
problem on all affected branches. The function is small enough that
force-inlining it shouldn't cause problems.

libstdc++-v3/ChangeLog:

	PR libstdc++/105671
	* include/std/sstream (basic_stringbuf::_M_high_mark): Add
	always_inline attribute.
2022-05-27 15:21:07 +01:00
GCC Administrator
b2cb88fb45 Daily bump. 2022-05-27 00:16:19 +00:00
Jonathan Wakely
367740bf6d libstdc++: Fix narrowing conversions for 16-bit size_t [PR105681]
On a 16-bit target such as msp430 we get errors about narrowing long
values to size_t, which is only 16-bit. When --enable-libstdcxx-pch is
used the <bits/extc++.h> header breaks the build because of these
narrowing errors.

libstdc++-v3/ChangeLog:

	PR libstdc++/105681
	* include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp:
	Limit ga_sizes array to values that fit in size_t.
	* include/ext/random [__SIZE_WIDTH < 32] (sfmt86243)
	(sfmt86243_64, sfmt132049, sfmt132049_64, sfmt216091)
	(sfmt216091_64): Do not declare.
2022-05-26 22:29:05 +01:00
Jonathan Wakely
11e1ee1b38 libstdc++: Fix atomic and error_code printers for versioned namespace
This fixes the printers to work with std::__8::atomic and
std::__v8::ios_errc and std::__v8::future_errc.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Make
	lookup for ios_errc and future_errc check versioned namespace.
	(StdAtomicPrinter): Strip versioned namespace from typename.
2022-05-26 22:29:04 +01:00
Jonathan Wakely
ae3ea143ef libstdc++: Move std::iostream_category() definition to new file
This fixes a missing symbol when the dual ABI is disabled, e.g. for the
versioned namespace build.

libstdc++-v3/ChangeLog:

	* src/c++11/Makefile.am: Add new source file.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/cxx11-ios_failure.cc (iostream_category):
	Move to ...
	* src/c++11/ios_errcat.cc: New file.
	* testsuite/27_io/ios_base/failure/error_code.cc: Check that
	std::iostream_category() is defined and used for std::io_errc.
2022-05-26 22:28:57 +01:00
Jonathan Wakely
47b20d027a libstdc++: Add constexpr to std::counted_iterator post-increment (LWG 3643)
libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (counted_iterator::operator++(int)):
	Add 'constexpr' as per LWG 3643.
	* testsuite/24_iterators/counted_iterator/lwg3643.cc: New test.
2022-05-26 17:14:40 +01:00
Jonathan Wakely
692643c3ed libstdc++: Refactor includes for unordered containers
This moves some #include directives to the relevant place. For example,
<bits/hashtable_policy.h> needs <bits/stl_pair.h> so should include it
directly instead of relying on <unordered_map> and <unordered_set> to do
so first.

libstdc++-v3/ChangeLog:

	* include/bits/functional_hash.h (__is_fast_hash): Add doxygen
	comment.
	* include/bits/hashtable.h: Do not include <bits/stl_function.h>
	here.
	* include/bits/hashtable_policy.h: Include <bits/stl_pair.h> and
	<bits/functional_hash.h>.
	* include/bits/unordered_map.h: Include required headers.
	* include/bits/unordered_set.h: Likewise.
	* include/std/unordered_map: Do not include headers for indirect
	dependencies.
	* include/std/unordered_set: Likewise.
2022-05-26 10:44:45 +01:00
Jonathan Wakely
650eadd630 libstdc++: Remove some unnecessary includes
These headers do not use anything in <bits/stl_iterator_base_types.h>
directly, and it's included by <bits/stl_iterator_base_funcs.h> and
<bits/stl_iterator.h> anyway, because they do need it.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_algobase.h: Do not include
	<bits/stl_iterator_base_types.h>.
	* include/std/string: Likewise.
	* include/std/variant: Likewise.
2022-05-26 10:44:45 +01:00
Nathan Sidwell
a44380541f libstdc++: Make headers include their prerequisites
These headers were relying on their includers having already included
some prerequisites.  That makes them unsuitable to be header-units.

So directly include the needed headers.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/hashtable.h: Include required headers.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/stl_heap.h: Likewise.
	* include/bits/stl_iterator_base_funcs.h: Likewise.
2022-05-26 10:44:45 +01:00
François Dumont
ace4b7f295 libstdc++: Fix printing of std::span for versioned namespace
libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdSpanPrinter.__init__):
	Strip typename from version namespace.
2022-05-26 11:38:34 +02:00
Jonathan Wakely
634b0089f6 libstdc++: Fix printing of std::atomic<shared_ptr<T>> for versioned namespace
libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (SharedPointerPrinter): Strip
	versioned namespace from the template argument too.
2022-05-26 10:05:51 +01:00
Jonathan Wakely
6eb60ced21 libstdc++: Rename tests like .../wchar_t/1.cc to .../wchar_t.cc
There's no need to have directories containing a single test file, we
can rename the files to the directory names and remove the directories.

The dejagnu proc that filters out wchar_t tests just checks for
"wchar_t" anywhere in the path, so will work just as well on wchar_t.cc
or constexpr-wchar_t.cc paths.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string/modifiers/pop_back/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/modifiers/pop_back/char.cc:
	...here.
	* testsuite/21_strings/basic_string/modifiers/pop_back/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/modifiers/pop_back/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/modifiers/swap/wchar_t/constexpr.cc:
	Moved to...
	* testsuite/21_strings/basic_string/modifiers/swap/constexpr-wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/modifiers/swap/char/constexpr.cc:
	Moved to...
	* testsuite/21_strings/basic_string/modifiers/swap/constexpr.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/contains/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/contains/char.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/contains/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/contains/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/data/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/data/char.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/data/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/data/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/ends_with/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/ends_with/char.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/ends_with/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/ends_with/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/starts_with/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/starts_with/char.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/starts_with/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/starts_with/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/substr/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/substr/char.cc:
	...here.
	* testsuite/21_strings/basic_string/operations/substr/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/operations/substr/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/range_access/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/range_access/char.cc:
	...here.
	* testsuite/21_strings/basic_string/range_access/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/range_access/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/modifiers/swap/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/contains/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/contains/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/contains/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/contains/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/data/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/data/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/data/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/data/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/ends_with/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/ends_with/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/ends_with/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/ends_with/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/starts_with/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/starts_with/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/starts_with/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/starts_with/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/substr/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/substr/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/operations/substr/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/operations/substr/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/range_access/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/range_access/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/range_access/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char.cc:
	...here.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t.cc:
	...here.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t.cc:
	...here.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char8_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/char8_t.cc:
	...here.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/int.cc:
	...here.
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char.cc:
	...here.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char16_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char32_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char8_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char8_t.cc:
	...here.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/int.cc:
	...here.
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/wchar_t.cc:
	...here.
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc:
	Moved to...
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char.cc:
	...here.
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc:
	Moved to...
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t.cc:
	...here.
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc:
	Moved to...
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t.cc:
	...here.
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char8_t/1.cc:
	Moved to...
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/char8_t.cc:
	...here.
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc:
	Moved to...
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/short.cc:
	...here.
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc:
	Moved to...
	* testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t.cc:
	...here.
2022-05-26 10:05:51 +01:00
Jonathan Wakely
f638f2b4b2 libstdc++: Remove redundancy in test pathnames
Repeating "explicit_instantiation" in these long pathnames is not
necessary.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/duration/requirements/explicit_instantiation/explicit_instantiation.cc:
	Moved to...
	* testsuite/20_util/duration/requirements/explicit_instantiation.cc: ...here.
	* testsuite/20_util/time_point/requirements/explicit_instantiation/explicit_instantiation.cc:
	Moved to...
	* testsuite/20_util/time_point/requirements/explicit_instantiation.cc: ...here.
	* testsuite/20_util/unique_ptr/requirements/explicit_instantiation/explicit_instantiation.cc:
	Moved to...
	* testsuite/20_util/unique_ptr/requirements/explicit_instantiation.cc: ...here.
2022-05-26 10:05:16 +01:00
GCC Administrator
3dff965cae Daily bump. 2022-05-26 00:16:30 +00:00
Jason Merrill
6209009df6 c++: strict constexpr and local vars
A change I was working on made constexpr_searcher.cc start to fail, and when
I looked at it I wondered why it had been accepted before.  This turned out
to be because we try to be more flexible about constant-evaluation of static
initializers, as allowed, but we were wrongly doing the same for non-static
initializers as well.

gcc/cp/ChangeLog:

	* constexpr.cc (maybe_constant_init_1): Only pass false for
	strict when initializing a variable of static duration.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/function_objects/constexpr_searcher.cc: Add
	constexpr.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/constexpr-local4.C: New test.
2022-05-25 11:06:36 -04:00
GCC Administrator
57f2ce6a87 Daily bump. 2022-05-21 00:16:32 +00:00
Jonathan Wakely
e3b8b4f781 libstdc++: Reduce <random> test iterations for simulators
Some of these tests take several minutes on a simulator like cris-elf,
so we can conditionally run fewer iterations. The testDiscreteDist
helper already supports custom sizes so we just need to make use of that
when { target simulator } matches.

The relevant code is sufficiently tested on other targets, so we're not
losing anything by only running a small number of iterators for sims.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc:
	Run fewer iterations for simulator targets.
	* testsuite/26_numerics/random/binomial_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/discrete_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc:
	Likewise.
2022-05-20 15:47:49 +01:00
GCC Administrator
12750f80bf Daily bump. 2022-05-20 00:16:32 +00:00
Jonathan Wakely
6f038efd93 libstdc++: Avoid including <cstdint> for std::char_traits
We should prefer the __UINT_LEAST16_TYPE__ and __UINT_LEAST32_TYPE__
macros, if available, so that we don't need all of <cstdint> in every
header that uses std::char_traits.

libstdc++-v3/ChangeLog:

	* include/bits/char_traits.h: Only include <cstdint> when
	necessary.
	* include/std/stacktrace: Use __UINTPTR_TYPE__ instead of
	uintptr_t.
	* src/c++11/cow-stdexcept.cc: Include <stdint.h>.
	* src/c++17/floating_to_chars.cc: Likewise.
	* testsuite/20_util/assume_aligned/1.cc: Include <cstdint>.
	* testsuite/20_util/assume_aligned/3.cc: Likewise.
	* testsuite/20_util/shared_ptr/creation/array.cc: Likewise.
2022-05-19 23:39:21 +01:00
Jonathan Wakely
f3e22baec0 libstdc++: Only include <ext/atomicity.h> for COW string
Since the COW std::string was moved to its own header, we don't need the
atomic dispatch helpers in the definition of std::__cxx11::string. Move
the inclusion of the <ext/atomicity.h> header to <bits/cow_string.h>
where it's needed.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h: Do not include <ext/atomicity.h>
	here.
	* include/bits/cow_string.h: Include it here.
2022-05-19 23:39:20 +01:00
Jonathan Wakely
8ccdc7ce33 libstdc++: Ensure pmr aliases work without <memory_resource>
Currently the alias templates for std::pmr::vector, std::pmr::string
etc. are defined using a forward declaration for polymorphic_allocator.
This means you can't actually use the alias templates unless you also
include <memory_resource>. The rationale for that is that it's a fairly
large header, and most users don't need it. This isn't uncontroversial
though, and LWG 3681 questions whether it's even conforming.

This change adds a new <bits/memory_resource.h> header with the minimum
needed to use polymorphic_allocator and the std::pmr container aliases.
Including <memory_resource> is still necessary to use the program-wide
resource objects, or the pool resources or monotonic buffer resource.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/memory_resource.h: New file.
	* include/std/deque: Include <bits/memory_resource.h>.
	* include/std/forward_list: Likewise.
	* include/std/list: Likewise.
	* include/std/map: Likewise.
	* include/std/memory_resource (pmr::memory_resource): Move to
	new <bits/memory_resource.h> header.
	(pmr::polymorphic_allocator): Likewise.
	* include/std/regex: Likewise.
	* include/std/set: Likewise.
	* include/std/stacktrace: Likewise.
	* include/std/string: Likewise.
	* include/std/unordered_map: Likewise.
	* include/std/unordered_set: Likewise.
	* include/std/vector: Likewise.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc:
	Remove <memory_resource> header and check construction.
	* testsuite/23_containers/deque/types/pmr_typedefs.cc: Likewise.
	* testsuite/23_containers/forward_list/pmr_typedefs.cc:
	Likewise.
	* testsuite/23_containers/list/pmr_typedefs.cc: Likewise.
	* testsuite/23_containers/map/pmr_typedefs.cc: Likewise.
	* testsuite/23_containers/multimap/pmr_typedefs.cc: Likewise.
	* testsuite/23_containers/multiset/pmr_typedefs.cc: Likewise.
	* testsuite/23_containers/set/pmr_typedefs.cc: Likewise.
	* testsuite/23_containers/unordered_map/pmr_typedefs.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/pmr_typedefs.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/pmr_typedefs.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/pmr_typedefs.cc:
	Likewise.
	* testsuite/23_containers/vector/pmr_typedefs.cc: Likewise.
	* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/variadic-tuple.C: Qualify function to avoid ADL
	finding std::make_tuple.
2022-05-19 23:38:23 +01:00
Jonathan Wakely
f13f9c99db libstdc++: Implement LWG 3683 for pmr::polymorphic_allocator
This issue has recently been moved to Tentatively Ready, and seems
uncontroversial. This allows equality comparison with types that are
convertible to pmr::polymorphic_allocator, which fail deduction for the
existing equality operator.

libstdc++-v3/ChangeLog:

	* include/std/memory_resource (polymorphic_allocator): Add
	non-template equality operator, as proposed for LWG 3683.
	* testsuite/20_util/polymorphic_allocator/lwg3683.cc: New test.
2022-05-19 15:30:56 +01:00
GCC Administrator
3d9439b1bb Daily bump. 2022-05-18 00:16:36 +00:00
Jonathan Wakely
ddb1427def libstdc++: Relax memory ordering for default memory resource object
Currently pmr::set_default_resource and pmr::get_default_resource both
use sequentially consistent memory ordering. This is overkill. The
standard only requires that a call to set_default_resource synchronizes
with subsequent calls to set_default_resource and get_default_resource.

Using acquire-release for the setter and acquire for the getter is
sufficient to meet the requirement.

Reviewed-by: Thomas Rodgers  <trodgers@redhat.com>

libstdc++-v3/ChangeLog:

	* src/c++17/memory_resource.cc (set_default_resource): Use
	memory_order_acq_rel.
	(get_default_resource): Use memory_order_acquire.
2022-05-17 20:53:40 +01:00
Jonathan Wakely
5c2d703e6d libstdc++: Add attributes to functions in <memory_resource>
Add attributes to the accessors for the global memory resource objects,
to allow the compiler to eliminate redundant calls to them. For example,
multiple calls to std::pmr::new_delete_resource() will always return the
same object, and so the compiler can replace them with a single call.

Ideally we would like adjacent calls to std::pmr::get_default_resource()
to be combined into a single call by the CSE pass. The 'pure' attribute
would permit that. However, the standard requires that calls to
std::pmr::set_default_resource() synchronize with subsequent calls to
std::pmr::get_default_resource().  With 'pure' the DCE pass might
eliminate seemingly redundant calls to std::pmr::get_default_resource().
That might be unsafe, because the caller might be relying on the
associated synchronization. We could use a hypothetical attribute that
allows CSE but not DCE, but we don't have one. So it can't be 'pure'.

Also add [[nodiscard]] to equality operators.

libstdc++-v3/ChangeLog:

	* include/std/memory_resource (new_delete_resource): Add
	nodiscard, returns_nonnull and const attributes.
	(null_memory_resource): Likewise.
	(set_default_resource, get_default_resource): Add returns_nonnull
	attribute.
	(memory_resource::is_equal): Add nodiscard attribute.
	(operator==, operator!=): Likewise.
2022-05-17 20:51:04 +01:00
Jonathan Wakely
5f1ce85135 libstdc++: Add attributes to <system_error> and related
Add the const attribute to std::future_category() and
std::iostream_category(), to match the existing attributes on
std::generic_category() and std::system_category().

Also add [[nodiscard]] to those functions and to the comparison
operators for std::error_code and std::error_condition, and to
std::make_error_code and std::make_error_condition overloads.

libstdc++-v3/ChangeLog:

	* include/bits/ios_base.h (io_category): Add const and nodiscard
	attributes.
	(make_error_code, make_error_condition): Add nodiscard.
	* include/std/future (future_category): Add const and nodiscard.
	(make_error_code, make_error_condition): Add nodiscard.
	* include/std/system_error (generic_category system_category):
	Add nodiscard. Replace _GLIBCXX_CONST with C++11 attribute.
	(error_code::value, error_code::category, error_code::operator bool)
	(error_condition::value, error_condition::category)
	(error_condition::operator bool, make_error_code)
	(make_error_condition, operator==, operator!=, operator<=>): Add
	nodiscard.
2022-05-17 20:50:31 +01:00
Jonathan Wakely
1815462a6e libstdc++: Skip tests that fail for the versioned namespace
Most tests for the contents of header synopses need to be supressed for
the versioned namespace build, because redeclaring the entities in std
fails when they were originally declared in std::__8.

I added these tests recently without the suppression, so they fail.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/expected/synopsis.cc: Skip for versioned
	namespace.
	* testsuite/27_io/headers/iosfwd/synopsis.cc: Likewise.
2022-05-17 11:42:34 +01:00
Jonathan Wakely
357d6fcd41 libstdc++: Stop defining C++0x compat symbols for versioned namespace
The src/c++11/compatibility*-c++0x.cc files define symbols that need to
be exported for ancient versions of libstdc++.so.6 due to changes
between C++0x and the final C++11 standard. Those symbols are not needed
in the libstdc++.so.8 library, and we can skip building them entirely.

This also fixes the build failure I introduced last week when making the
versioned namespace config not use the _V2 namespace for compat symbols.

libstdc++-v3/ChangeLog:

	* src/Makefile.am [ENABLE_SYMVERS_GNU_NAMESPACE] (cxx11_sources):
	Do not build the compatibility*-c++0x.cc objects.
	* src/Makefile.in: Regenerate.
	* src/c++11/compatibility-c++0x.cc [_GLIBCXX_INLINE_VERSION]:
	Refuse to build for the versioned namespace.
	* src/c++11/compatibility-chrono.cc: Likewise.
	* src/c++11/compatibility-condvar.cc: Likewise.
	* src/c++11/compatibility-thread-c++0x.cc: Likewise.
	* src/c++11/chrono.cc (system_clock, steady_clock):
	Use macros to define in inline namespace _V2, matching the
	declarations in <system_error>.
	* src/c++11/system_error.cc (system_category, generic_category):
	Likewise.
2022-05-17 11:42:34 +01:00
GCC Administrator
702bd11fa7 Daily bump. 2022-05-17 00:16:28 +00:00
Jonathan Wakely
682e587f10 libstdc++: Fix hyperlink in docs
libstdc++-v3/ChangeLog:

	* doc/xml/manual/prerequisites.xml: Fix attributes for external
	hyperlink.
	* doc/html/manual/setup.html: Regenerate.
2022-05-16 14:54:07 +01:00
Jonathan Wakely
8414dad54a libstdc++: Update C++23 status docs
These are the C++23 proposals supported in the gcc-12 branch.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2023.xml: Update with gcc-12 support.
	* doc/html/*: Regenerate.
2022-05-16 14:53:16 +01:00
Jonathan Wakely
4361867344 libstdc++: Add C++23 status docs
These are the C++23 proposals already supported in the gcc-11 branch.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Include new chapter.
	* doc/xml/manual/status_cxx2020.xml: Tweak release numbers.
	* doc/xml/manual/status_cxx2023.xml: New file.
	* doc/html/*: Regenerate.
2022-05-16 14:47:34 +01:00
Jonathan Wakely
64648821f1 libstdc++: Fix status docs for <bit> support
libstdc++-v3/ChangeLog:

	* doc/html/manual/status.html: Regenerate.
	* doc/xml/manual/status_cxx2020.xml: Fix supported version for
	C++20 bit operations.
2022-05-16 14:47:34 +01:00
GCC Administrator
9df4ffe493 Daily bump. 2022-05-14 00:17:19 +00:00
Jonathan Wakely
7f40ac326a libstdc++: Make std:🧵:_State private
* include/bits/std_thread.h (thread::_State, thread::_State_ptr):
	Declare as private unless _GLIBCXX_THREAD_IMPL is defined.
	* src/c++11/thread.cc (_GLIBCXX_THREAD_IMPL): Define.
2022-05-13 20:40:05 +01:00
Jonathan Wakely
8659bcd6b7 libstdc++: Add noexcept to std::launch operators
libstdc++-v3/ChangeLog:

	* include/std/future (launch): Make operators noexcept.
2022-05-13 20:40:05 +01:00
Jonathan Wakely
c829b04bc3 libstdc++: Allow std::swap to find overload for std::exception_ptr
The non-member swap for std::exception_ptr is in a nested namespace and
so can only be found by ADL currently. Add a using-declaration so that
qualified std::swap calls will use the std::exception_ptr::swap member,
instead of the generic std::swap.

There's no new test for this, because the generic std::swap works, it
just does more work than is necessary.

Also tell Doxygen to replace the __exception_ptr namespace with
"__unspecified__" in the generate docs, so the real name is not
documented.

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Replace __exception_ptr
	with "__unspecified__".
	* libsupc++/exception_ptr.h: Improve doxygen docs.
	(__exception_ptr::swap): Also declare in namespace std.
2022-05-13 20:40:04 +01:00
Jonathan Wakely
c470f3ea86 libstdc++: Make std::rethrow_if_nested work without RTTI
This allows std::rethrow_if_nested to work with -fno-rtti by not
attempting the dynamic_cast if it requires RTTI, since that's ill-formed
with -fno-rtti. The cast will still work if a static upcast to
std::nested_exception is allowed.

Also use if-constexpr to avoid the compile-time overload resolution (and
SFINAE) and run-time dispatching for std::rethrow_if_nested and
std::throw_with_nested.

Also add better doxygen comments throughout the file.

libstdc++-v3/ChangeLog:

	* libsupc++/nested_exception.h (throw_with_nested) [C++17]: Use
	if-constexpr instead of tag dispatching.
	(rethrow_if_nested) [C++17]: Likewise.
	(rethrow_if_nested) [!__cpp_rtti]: Do not use dynamic_cast if it
	would require RTTI.
	* testsuite/18_support/nested_exception/rethrow_if_nested-term.cc:
	New test.
2022-05-13 20:39:59 +01:00
Jonathan Wakely
b584cbdb08 libstdc++: Improve doxygen docs for <mutex>
libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Define
	_GTHREAD_USE_MUTEX_TIMEDLOCK macro.
	* include/bits/std_mutex.h (mutex, lock_guard): Use @since and
	@headerfile.
	* include/bits/unique_lock.h (unique_lock): Likewise.
	* include/std/mutex (recursive_mutex, timed_mutex)
	(recursive_timed_mutex, scoped_lock): Likewise.
2022-05-13 13:32:23 +01:00
Jonathan Wakely
a278402216 libstdc++: Improve doxygen docs for some of <memory>
libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Define
	_GLIBCXX23_CONSTEXPR macro.
	* include/backward/auto_ptr.h (auto_ptr): Use @deprecated.
	* include/bits/unique_ptr.h (default_delete): Use @since and
	@headerfile.
	* include/std/scoped_allocator: Remove @ingroup from @file
	block.
2022-05-13 13:32:23 +01:00
Jonathan Wakely
c29c2a0604 libstdc++: Improve doxygen docs for <thread> and <future>
libstdc++-v3/ChangeLog:

	* include/bits/std_thread.h (thread, thread::id): Improve
	doxygen docs.
	* include/std/future: Likewise.
	* include/std/thread (jthread): Likewise.
2022-05-13 13:32:23 +01:00
Jonathan Wakely
e61492549b libstdc++: Improve doxygen docs for algorithms and more
libstdc++-v3/ChangeLog:

	* include/bits/ostream_insert.h: Mark helper functions as
	undocumented by Doxygen.
	* include/bits/stl_algo.h: Use markdown for formatting and mark
	helper functions as undocumented.
	* include/bits/stl_numeric.h:  Likewise.
	* include/bits/stl_pair.h (pair): Add @headerfile.
2022-05-13 13:32:22 +01:00
Jonathan Wakely
171f41f124 libstdc++: Improve doxygen docs for std::allocator
libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Define __allocator_base
	so that Doxygen shows the right base-class for std::allocator.
	* include/bits/alloc_traits.h: Improve doxygen docs.
	* include/bits/allocator.h: Likewise.
	* include/bits/new_allocator.h: Likewise.
	* include/ext/new_allocator.h: Likewise.
2022-05-13 13:32:22 +01:00
Jonathan Wakely
1b01963a4e libstdc++: Improve doxygen docs for <regex>
Add @headerfile and @since tags. Improve grouping of non-member
functions via @relates tags.

Mark the std::pair base class of std::sub_match as undocumented, so that
the docs don't show all the related non-member functions are part of the
sub_match API. Use a new macro to re-add the data members for Doxygen
only.

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Define macro
	_GLIBCXX_DOXYGEN_ONLY to expand its argument.
	* include/bits/c++config (_GLIBCXX_DOXYGEN_ONLY): Define.
	* include/bits/regex.h: Improve doxygen docs.
	* include/bits/regex_constants.h: Likewise.
	* include/bits/regex_error.h: Likewise.
2022-05-13 13:32:22 +01:00
Jonathan Wakely
1566ca0969 libstdc++: Improve doxygen docs for <atomic>
libstdc++-v3/ChangeLog:

	* include/std/atomic: Suppress doxygen docs for
	implementation details.
	* include/bits/atomic_base.h: Likewise.
	* include/bits/shared_ptr_atomic.h: Use markdown. Fix grouping
	so that std::atomic is not added to the pointer abstractions
	group.
2022-05-13 13:32:22 +01:00
Jonathan Wakely
20b917e7c0 libstdc++: Improve doxygen docs for <system_error>
libstdc++-v3/ChangeLog:

	* include/std/system_error: Improve doxygen comments.
2022-05-13 13:32:22 +01:00
Jonathan Wakely
757146fb1c libstdc++: Improve doxygen docs for std::pointer_traits
libstdc++-v3/ChangeLog:

	* include/bits/ptr_traits.h: Add some doxygen comments.
2022-05-13 13:32:22 +01:00
Jonathan Wakely
e4905f1185 libstdc++: Add macros for the inline namespace std::_V2
Use macros to open and close the inline namespace _V2 that is used for
ABI versioning of individual components such as chrono::system_clock.

This allows the namespace to be hidden in the docs generated by Doxygen,
so that we document std::foo instead of std::_V2::foo.

This also makes it easy to remove that namespace entirely for the
gnu-versioned-namespace build, where everything is already versioned as
std::__8 and there are no backwards compatibility guarantees.

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Expand new macros to
	nothing.
	* include/bits/c++config (_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE)
	(_GLIBCXX_END_INLINE_ABI_NAMESPACE): Define new macros.
	* include/bits/algorithmfwd.h (_V2::__rotate): Use new macros
	for the namespace.
	* include/bits/chrono.h (chrono::_V2::system_clock): Likewise.
	* include/bits/stl_algo.h (_V2::__rotate): Likewise.
	* include/std/condition_variable (_V2::condition_variable_any):
	Likewise.
	* include/std/system_error (_V2::error_category): Likewise.
2022-05-13 13:32:22 +01:00
Jonathan Wakely
4163b0be81 libstdc++: Fix typo in doxygen @headerfile command
libstdc++-v3/ChangeLog:

	* include/bits/mofunc_impl.h: Fix doxygen command.
2022-05-13 13:32:21 +01:00