Commit graph

14731 commits

Author SHA1 Message Date
Alexandre Oliva
3d0f3382fa libsupc++: try cxa_thread_atexit_impl at runtime
g++.dg/tls/thread_local-order2.C fails when the toolchain is built for
a platform that lacks __cxa_thread_atexit_impl, even if the program is
built and run using that toolchain on a (later) platform that offers
__cxa_thread_atexit_impl.

This patch adds runtime testing for __cxa_thread_atexit_impl on select
platforms (GNU variants, for starters) that support weak symbols.


for  libstdc++-v3/ChangeLog

	PR libstdc++/112858
	* config/os/gnu-linux/os_defines.h
	(_GLIBCXX_MAY_HAVE___CXA_THREAD_ATEXIT_IMPL): Define.
	* libsupc++/atexit_thread.cc [__GXX_WEAK__ &&
	_GLIBCXX_MAY_HAVE___CXA_THREAD_ATEXIT_IMPL]
	(__cxa_thread_atexit): Add dynamic detection of
	__cxa_thread_atexit_impl.
2023-12-07 00:38:14 -03:00
GCC Administrator
ae9e48e5c0 Daily bump. 2023-12-07 00:17:06 +00:00
Jason Merrill
c1e54c82a9 c++: partial ordering of object parameter [PR53499]
Looks like we implemented option 1 (skip the object parameter) for CWG532
before the issue was resolved, and never updated to the final resolution of
option 2 (model it as a reference).  More recently CWG2445 extended this
handling to static member functions; I think that's wrong, and have
opened CWG2834 to address that and how explicit object member functions
interact with it.

The FIXME comments are to guide how the explicit object member function
support should change the uses of DECL_NONSTATIC_MEMBER_FUNCTION_P.

The library testsuite changes are to make partial ordering work again
between the generic operator- in the testcase and
_Pointer_adapter::operator-.

	DR 532
	PR c++/53499

gcc/cp/ChangeLog:

	* pt.cc (more_specialized_fn): Fix object parameter handling.

gcc/testsuite/ChangeLog:

	* g++.dg/template/partial-order4.C: New test.
	* g++.dg/template/spec26.C: Adjust for CWG532.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/vector/ext_pointer/types/1.cc
	* testsuite/23_containers/vector/ext_pointer/types/2.cc
	(N::operator-): Make less specialized.
2023-12-06 09:02:01 -05:00
Alexandre Oliva
953a9302d1 Revert "libsupc++: try cxa_thread_atexit_impl at runtime"
This reverts commit f4dd941684.
2023-12-05 22:16:37 -03:00
GCC Administrator
3dd09cd9e1 Daily bump. 2023-12-06 00:17:50 +00:00
Jonathan Wakely
08448dc146 libstdc++: Add workaround to std::ranges::subrange [PR111948]
libstdc++-v3/ChangeLog:

	PR libstdc++/111948
	* include/bits/ranges_util.h (subrange): Add constructor to
	_Size to aoid setting member in constructor.
	* testsuite/std/ranges/subrange/111948.cc: New test.
2023-12-05 23:34:12 +00:00
Jonathan Wakely
45630fbcf7 libstdc++: Implement LWG 4016 for std::ranges::to
This implements the proposed resolution of LWG 4016, so that
std::ranges::to does not use std::back_inserter and std::inserter.
Instead it inserts at the back of the container directly, using
the first supported one of emplace_back, push_back, emplace, and insert.

Using emplace avoids creating a temporary that has to be moved into the
container, for cases where the source range and the destination
container do not have the same value type.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::__container_insertable): Remove.
	(__detail::__container_inserter): Remove.
	(ranges::to): Use emplace_back or emplace, as per LWG 4016.
	* testsuite/std/ranges/conv/1.cc (Cont4, test_2_1_4): Check for
	use of emplace_back and emplace.
2023-12-05 23:34:12 +00:00
Jonathan Wakely
5e8a30d8b8 libstdc++: Redefine __glibcxx_assert to work in C++23 constexpr
The changes in r14-5979 to support unknown references in constant
expressions caused some test regressions. The way that __glibcxx_assert
is defined for constant evaluation no longer works when
_GLIBCXX_ASSERTIONS is defined.

This change simplifies __glibcxx_assert so that there is only one check,
rather than a constexpr one and a conditionally-enabled runtime one. The
constexpr one does not need to use __builtin_unreachable to cause a
compilation failure, because __glibcxx_assert_fail is not usable in
constant expressions, so that will cause a failure too.

As well as fixing the regressions, this makes the code for the
assertions shorter and simpler, so should be quicker to compile, and
might inline better too.

libstdc++-v3/ChangeLog:

	* include/bits/c++config (__glibcxx_assert_fail): Declare even
	when assertions are not enabled.
	(__glibcxx_constexpr_assert): Remove macro.
	(__glibcxx_assert_impl): Remove macro.
	(_GLIBCXX_ASSERT_FAIL): New macro.
	(_GLIBCXX_DO_ASSERT): New macro.
	(__glibcxx_assert): Simplify to a single definition that works
	at runtime and during constant evaluation.
	* testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc:
	Adjust expected errors.
	* 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.
	* 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/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.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.
	* testsuite/26_numerics/lcm/105844.cc: Likewise.
2023-12-05 23:33:22 +00:00
Jonathan Wakely
3cd73543a1 libstdc++: Disable std::formatter::set_debug_format [PR112832]
All set_debug_format member functions should be guarded by the
__cpp_lib_formatting_ranges macro (which is not defined yet).

libstdc++-v3/ChangeLog:

	PR libstdc++/112832
	* include/std/format (formatter::set_debug_format): Ensure this
	member is defined conditionally for all specializations.
	* testsuite/std/format/formatter/112832.cc: New test.
2023-12-05 16:40:43 +00:00
Will Hawkins
9fff752695 libstdc++: Add test for LWG Issue 3897
Add a test to verify that the implementation of inout_ptr is not
vulnerable to LWG Issue 3897.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/smartptr.adapt/inout_ptr/2.cc: Add check
	for LWG Issue 3897.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
2023-12-05 16:40:43 +00:00
Marek Polacek
1f1c432226 c++: implement P2564, consteval needs to propagate up [PR107687]
This patch implements P2564, described at <wg21.link/p2564>, whereby
certain functions are promoted to consteval.  For example:

  consteval int id(int i) { return i; }

  template <typename T>
  constexpr int f(T t)
  {
    return t + id(t); // id causes f<int> to be promoted to consteval
  }

  void g(int i)
  {
    f (3);
  }

now compiles.  Previously the code was ill-formed: we would complain
that 't' in 'f' is not a constant expression.  Since 'f' is now
consteval, it means that the call to id(t) is in an immediate context,
so doesn't have to produce a constant -- this is how we allow consteval
functions composition.  But making 'f<int>' consteval also means that
the call to 'f' in 'g' must yield a constant; failure to do so results
in an error.  I made the effort to have cc1plus explain to us what's
going on.  For example, calling f(i) produces this neat diagnostic:

w.C:11:11: error: call to consteval function 'f<int>(i)' is not a constant expression
   11 |         f (i);
      |         ~~^~~
w.C:11:11: error: 'i' is not a constant expression
w.C:6:22: note: 'constexpr int f(T) [with T = int]' was promoted to an immediate function because its body contains an immediate-escalating expression 'id(t)'
    6 |         return t + id(t); // id causes f<int> to be promoted to consteval
      |                    ~~^~~

which hopefully makes it clear what's going on.

Implementing this proposal has been tricky.  One problem was delayed
instantiation: instantiating a function can set off a domino effect
where one call promotes a function to consteval but that then means
that another function should also be promoted, etc.

In v1, I addressed the delayed instantiation problem by instantiating
trees early, so that we can escalate functions right away.  That caused
a number of problems, and in certain cases, like consteval-prop3.C, it
can't work, because we need to wait till EOF to see the definition of
the function anyway.  Overeager instantiation tends to cause diagnostic
problems too.

In v2, I attempted to move the escalation to the gimplifier, at which
point all templates have been instantiated.  That attempt flopped,
however, because once we've gimplified a function, its body is discarded
and as a consequence, you can no longer evaluate a call to that function
which is required for escalating, which needs to decide if a call is
a constant expression or not.

Therefore, we have to perform the escalation before gimplifying, but
after instantiate_pending_templates.  That's not easy because we have
no way to walk all the trees.  In the v2 patch, I use two vectors: one
to store function decls that may become consteval, and another to
remember references to immediate-escalating functions.  Unfortunately
the latter must also stash functions that call immediate-escalating
functions.  Consider:

  int g(int i)
  {
    f<int>(i); // f is immediate-escalating
  }

where g itself is not immediate-escalating, but we have to make sure
that if f gets promoted to consteval, we give an error.

A new option, -fno-immediate-escalation, is provided to suppress
escalating functions.

v2 also adds a new flag, DECL_ESCALATION_CHECKED_P, so that we don't
escalate a function multiple times, and so that we can distinguish between
explicitly consteval functions and functions that have been promoted
to consteval.

In v3, I removed one of the new vectors and changed the other one
to a hash set.  This version also contains numerous cleanups.

v4 merges find_escalating_expr_r into cp_fold_immediate_r.  It also
adds a new optimization in cp_fold_function.

v5 greatly simplifies the code.

v6 simplifies the code further and removes an ff_ flag.

v7 removes maybe_promote_function_to_consteval and further simplifies
cp_fold_immediate_r logic.

v8 removes maybe_store_immediate_escalating_fn.

	PR c++/107687
	PR c++/110997

gcc/c-family/ChangeLog:

	* c-cppbuiltin.cc (c_cpp_builtins): Update __cpp_consteval.
	* c-opts.cc (c_common_post_options): Pre-C++20, unset
	flag_immediate_escalation.
	* c.opt (fimmediate-escalation): New option.

gcc/cp/ChangeLog:

	* call.cc (in_immediate_context): No longer static.
	* constexpr.cc (cxx_eval_call_expression): Adjust assert.
	* cp-gimplify.cc (deferred_escalating_exprs): New vec.
	(remember_escalating_expr): New.
	(enum fold_flags): Remove ff_fold_immediate.
	(immediate_escalating_function_p): New.
	(unchecked_immediate_escalating_function_p): New.
	(promote_function_to_consteval): New.
	(cp_fold_immediate): Move above.  Return non-null if any errors were
	emitted.
	(maybe_explain_promoted_consteval): New.
	(cp_gimplify_expr) <case CALL_EXPR>: Assert we've handled all
	immediate invocations.
	(taking_address_of_imm_fn_error): New.
	(cp_fold_immediate_r): Merge ADDR_EXPR and PTRMEM_CST cases.  Implement
	P2564 - promoting functions to consteval.
	<case CALL_EXPR>: Implement P2564 - promoting functions to consteval.
	(cp_fold_r): If an expression turns into a CALL_EXPR after cp_fold,
	call cp_fold_immediate_r on the CALL_EXPR.
	(cp_fold_function): Set DECL_ESCALATION_CHECKED_P if
	deferred_escalating_exprs does not contain current_function_decl.
	(process_and_check_pending_immediate_escalating_fns): New.
	* cp-tree.h (struct lang_decl_fn): Add escalated_p bit-field.
	(DECL_ESCALATION_CHECKED_P): New.
	(immediate_invocation_p): Declare.
	(process_pending_immediate_escalating_fns): Likewise.
	* decl2.cc (c_parse_final_cleanups): Set at_eof to 2 after all
	templates have been instantiated; and to 3 at the end of the function.
	Call process_pending_immediate_escalating_fns.
	* error.cc (dump_template_bindings): Check at_eof against an updated
	value.
	* module.cc (trees_out::lang_decl_bools): Stream escalated_p.
	(trees_in::lang_decl_bools): Likewise.
	* pt.cc (push_tinst_level_loc): Set at_eof to 3, not 2.
	* typeck.cc (cp_build_addr_expr_1): Don't check
	DECL_IMMEDIATE_FUNCTION_P.

gcc/ChangeLog:

	* doc/invoke.texi: Document -fno-immediate-escalation.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/comparisons/categories/zero_neg.cc: Add
	dg-prune-output.
	* testsuite/std/format/string_neg.cc: Add dg-error.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/consteval-if10.C: Remove dg-error.
	* g++.dg/cpp23/consteval-if2.C: Likewise.
	* g++.dg/cpp23/feat-cxx2b.C: Adjust expected value of __cpp_consteval.
	* g++.dg/cpp26/feat-cxx26.C: Likewise.
	* g++.dg/cpp2a/consteval-memfn1.C: Add dg-error.
	* g++.dg/cpp2a/consteval11.C: Likewise.
	* g++.dg/cpp2a/consteval3.C: Adjust dg-error.
	* g++.dg/cpp2a/consteval34.C: Add dg-error.
	* g++.dg/cpp2a/consteval36.C: Likewise.
	* g++.dg/cpp2a/consteval9.C: Likewise.
	* g++.dg/cpp2a/feat-cxx2a.C: Adjust expected value of __cpp_consteval.
	* g++.dg/cpp2a/spaceship-synth9.C: Adjust dg-error.
	* g++.dg/cpp2a/consteval-prop1.C: New test.
	* g++.dg/cpp2a/consteval-prop10.C: New test.
	* g++.dg/cpp2a/consteval-prop11.C: New test.
	* g++.dg/cpp2a/consteval-prop12.C: New test.
	* g++.dg/cpp2a/consteval-prop13.C: New test.
	* g++.dg/cpp2a/consteval-prop14.C: New test.
	* g++.dg/cpp2a/consteval-prop15.C: New test.
	* g++.dg/cpp2a/consteval-prop16.C: New test.
	* g++.dg/cpp2a/consteval-prop17.C: New test.
	* g++.dg/cpp2a/consteval-prop18.C: New test.
	* g++.dg/cpp2a/consteval-prop19.C: New test.
	* g++.dg/cpp2a/consteval-prop20.C: New test.
	* g++.dg/cpp2a/consteval-prop2.C: New test.
	* g++.dg/cpp2a/consteval-prop3.C: New test.
	* g++.dg/cpp2a/consteval-prop4.C: New test.
	* g++.dg/cpp2a/consteval-prop5.C: New test.
	* g++.dg/cpp2a/consteval-prop6.C: New test.
	* g++.dg/cpp2a/consteval-prop7.C: New test.
	* g++.dg/cpp2a/consteval-prop8.C: New test.
	* g++.dg/cpp2a/consteval-prop9.C: New test.
2023-12-04 19:42:09 -05:00
GCC Administrator
04d4a4943a Daily bump. 2023-12-03 00:16:41 +00:00
Alexandre Oliva
f4dd941684 libsupc++: try cxa_thread_atexit_impl at runtime
g++.dg/tls/thread_local-order2.C fails when the toolchain is built for
a platform that lacks __cxa_thread_atexit_impl, even if the program is
built and run using that toolchain on a (later) platform that offers
__cxa_thread_atexit_impl.

This patch adds runtime testing for __cxa_thread_atexit_impl on
platforms that support weak symbols.


for  libstdc++-v3/ChangeLog

	* libsupc++/atexit_thread.cc [__GXX_WEAK__]: Add dynamic
	detection of __cxa_thread_atexit_impl.
2023-12-02 14:14:02 -03:00
GCC Administrator
2e0f3f9759 Daily bump. 2023-12-02 00:16:54 +00:00
Jason Merrill
c3f281a0c1 c++: mangle function template constraints
Per https://github.com/itanium-cxx-abi/cxx-abi/issues/24 and
https://github.com/itanium-cxx-abi/cxx-abi/pull/166

We need to mangle constraints to be able to distinguish between function
templates that only differ in constraints.  From the latter link, we want to
use the template parameter mangling previously specified for lambdas to also
make explicit the form of a template parameter where the argument is not a
"natural" fit for it, such as when the parameter is constrained or deduced.

I'm concerned about how the latter link changes the mangling for some C++98
and C++11 patterns, so I've limited template_parm_natural_p to avoid two
cases found by running the testsuite with -Wabi forced on:

template <class T, T V> T f() { return V; }
int main() { return f<int,42>(); }

template <int i> int max() { return i; }
template <int i, int j, int... rest> int max()
{
  int sub = max<j, rest...>();
  return i > sub ? i : sub;
}
int main() {  return max<1,2,3>(); }

A third C++11 pattern is changed by this patch:

template <template <typename...> class TT, typename... Ts> TT<Ts...> f();
template <typename> struct A { };
int main() { f<A,int>(); }

I aim to resolve these with the ABI committee before GCC 14.1.

We also need to resolve https://github.com/itanium-cxx-abi/cxx-abi/issues/38
(mangling references to dependent template-ids where the name is fully
resolved) as references to concepts in std:: will consistently run into this
area.  This is why mangle-concepts1.C only refers to concepts in the global
namespace so far.

The library changes are to avoid trying to mangle builtins, which fails.

Demangler support and test coverage is not complete yet.

gcc/cp/ChangeLog:

	* cp-tree.h (TEMPLATE_ARGS_TYPE_CONSTRAINT_P): New.
	(get_concept_check_template): Declare.
	* constraint.cc (combine_constraint_expressions)
	(finish_shorthand_constraint): Use UNKNOWN_LOCATION.
	* pt.cc (convert_generic_types_to_packs): Likewise.
	* mangle.cc (write_constraint_expression)
	(write_tparms_constraints, write_type_constraint)
	(template_parm_natural_p, write_requirement)
	(write_requires_expr): New.
	(write_encoding): Mangle trailing requires-clause.
	(write_name): Pass parms to write_template_args.
	(write_template_param_decl): Factor out from...
	(write_closure_template_head): ...here.
	(write_template_args): Mangle non-natural parms
	and requires-clause.
	(write_expression): Handle REQUIRES_EXPR.

include/ChangeLog:

	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_CONSTRAINTS.

libiberty/ChangeLog:

	* cp-demangle.c (d_make_comp): Handle
	DEMANGLE_COMPONENT_CONSTRAINTS.
	(d_count_templates_scopes): Likewise.
	(d_print_comp_inner): Likewise.
	(d_maybe_constraints): New.
	(d_encoding, d_template_args_1): Call it.
	(d_parmlist): Handle 'Q'.
	* testsuite/demangle-expected: Add some constraint tests.

libstdc++-v3/ChangeLog:

	* include/std/bit: Avoid builtins in requires-clauses.
	* include/std/variant: Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/abi/mangle10.C: Disable compat aliases.
	* g++.dg/abi/mangle52.C: Specify ABI 18.
	* g++.dg/cpp2a/class-deduction-alias3.C
	* g++.dg/cpp2a/class-deduction-alias8.C:
	Avoid builtins in requires-clauses.
	* g++.dg/abi/mangle-concepts1.C: New test.
	* g++.dg/abi/mangle-ttp1.C: New test.
2023-12-01 16:08:25 -05:00
Rainer Orth
8228855001 libstdc++: Regenerate GCC_CHECK_ASSEMBLER_HWCAP users
This patch regenerates the remaining user of the GCC_CHECK_ASSEMBLER_HWCAP
macro.  No functional changes.

2023-11-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libstdc++-v3:
	* configure: Regenerate.
2023-12-01 09:59:08 +01:00
GCC Administrator
8428bcd703 Daily bump. 2023-12-01 00:17:36 +00:00
Jonathan Wakely
18d8a50a04 libstdc++: Fix std::ranges::to errors
Fix some errors that Patrick noticed, and remove a #if 0 group that I
didn't mean to leave in the file.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::__toable): Fix incorrect use of
	_Range instead of _Cont.
	(__detail::_ToClosure, __detail::_ToClosure2): Add missing
	constexpr specifier on constructors.
	* testsuite/std/ranges/conv/1.cc (_Cont, _Cont2, _Cont3): Remove
	unnecessary begin() and end() members.
	(test_constexpr): New function to check range adaptors are
	usable in constant expressions.
2023-11-30 15:45:30 +00:00
GCC Administrator
31d8cf17ca Daily bump. 2023-11-30 00:17:38 +00:00
Thomas Schwinge
762b428815 Fix '23_containers/span/at.cc' for '-fno-exceptions' configurations
Added in recent commit 1fa85dcf65
"libstdc++: Add std::span::at for C++26 (P2821R5)", the test case already
does use '#if __cpp_exceptions', but failed to correspondingly guard the
'dg-warning' directives, resulting in:

    FAIL: 23_containers/span/at.cc  -std=gnu++26  (test for warnings, line 15)
    FAIL: 23_containers/span/at.cc  -std=gnu++26  (test for warnings, line 26)
    PASS: 23_containers/span/at.cc  -std=gnu++26 (test for excess errors)
    PASS: 23_containers/span/at.cc  -std=gnu++26 execution test

	libstdc++-v3/
	* testsuite/23_containers/span/at.cc: Fix for '-fno-exceptions'
	configurations.
2023-11-29 14:12:56 +01:00
GCC Administrator
6c85b8a987 Daily bump. 2023-11-29 00:17:27 +00:00
Jonathan Wakely
6c8f2d3a08 libstdc++: Include <stdint.h> in <bits/atomic_wait.h>
This is needed in order to compile it as a header-unit, which might be
desired because it's included by both <atomic> and <semaphore>.

libstdc++-v3/ChangeLog:

	* include/bits/atomic_wait.h: Include <stdint.h>.
2023-11-28 12:43:15 +00:00
Jonathan Wakely
3e35c54a9b libstdc++: Fix typo in comment
libstdc++-v3/ChangeLog:

	* include/bits/stl_uninitialized.h: Fix typo in comment.
2023-11-28 12:43:09 +00:00
GCC Administrator
77cf1dba78 Daily bump. 2023-11-25 00:17:46 +00:00
Jan Hubicka
c2dcfb6ba6 Use memcpy instead of memmove in __relocate_a_1
__relocate_a_1 is used to copy data after vector reizing.  This can be done by memcpy
rather than memmove.

libstdc++-v3/ChangeLog:

	PR middle-end/109849
	* include/bits/stl_uninitialized.h (__relocate_a_1): Use memcpy instead
	of memmove.
2023-11-24 17:59:44 +01:00
GCC Administrator
6fb55db0e1 Daily bump. 2023-11-24 00:17:53 +00:00
Jonathan Wakely
7a6a29c455 libstdc++: Define std::ranges::to for C++23 (P1206R7) [PR111055]
This adds the std::ranges::to functions for C++23. The rest of P1206R7
is not yet implemented, i.e. the new constructors taking the
std::from_range tag, and the new insert_range, assign_range, etc. member
functions. std::ranges::to works with the standard containers even
without the new constructors, so this is useful immediately.

The __cpp_lib_ranges_to_container feature test macro can be defined now,
because that only indicates support for the changes in <ranges>, which
are implemented by this patch. The __cpp_lib_containers_ranges macro
will be defined once all containers support the new member functions.

libstdc++-v3/ChangeLog:

	PR libstdc++/111055
	* include/bits/ranges_base.h (from_range_t): Define new tag
	type.
	(from_range): Define new tag object.
	* include/bits/version.def (ranges_to_container): Define.
	* include/bits/version.h: Regenerate.
	* include/std/ranges (ranges::to): Define.
	* testsuite/std/ranges/conv/1.cc: New test.
	* testsuite/std/ranges/conv/2_neg.cc: New test.
	* testsuite/std/ranges/conv/version.cc: New test.
2023-11-23 17:48:41 +00:00
Jonathan Wakely
0585daf7de libstdc++: Fix access error in __gnu_test::uneq_allocator
The operator== function is only a friend of the LHS argument, so cannot
access the private member of the RHS argument. Use the public accessor
instead.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_allocator.h (uneq_allocator): Fix
	equality operator for heterogeneous comparisons.
2023-11-23 17:44:26 +00:00
GCC Administrator
92c480a423 Daily bump. 2023-11-22 00:17:52 +00:00
Jonathan Wakely
7adb7c6ea4 libstdc++: Do not declare strtok for C++26 freestanding (P2937R0)
This was recently approved for C++26.

We should define the __cpp_lib_freestanding_cstring macro in <string.h>
as well as <cstring>, but we do not currently install our own <string.h>
for most targets.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (freestanding_cstring): Add.
	* include/bits/version.h: Regenerate.
	* include/c_compatibility/string.h (strtok): Do not declare for
	C++26 freestanding.
	* include/c_global/cstring (strtok): Likewise.
	* testsuite/21_strings/headers/cstring/version.cc: New test.
2023-11-21 15:58:21 +00:00
Jonathan Wakely
43626143c9 libstdc++: Add freestanding feature test macros (P2407R5)
This C++26 change makes several classes "partially freestanding", but we
already fully supported them in freestanding mode. All we need to do is
define the new feature test macros and add tests for them.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (freestanding_algorithm)
	(freestanding_array, freestanding_optional)
	(freestanding_string_view, freestanding_variant): Add.
	* include/bits/version.h: Regenerate.
	* include/std/algorithm (__glibcxx_want_freestanding_algorithm):
	Define.
	* include/std/array (__glibcxx_want_freestanding_array):
	Define.
	* include/std/optional (__glibcxx_want_freestanding_optional):
	Define.
	* include/std/string_view
	(__glibcxx_want_freestanding_string_view): Define.
	* include/std/variant (__glibcxx_want_freestanding_variant):
	Define.
	* testsuite/20_util/optional/version.cc: Add checks for
	__cpp_lib_freestanding_optional.
	* testsuite/20_util/variant/version.cc: Add checks for
	__cpp_lib_freestanding_variant.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Adjust dg-error line numbers.
	* testsuite/21_strings/basic_string_view/requirements/version.cc:
	New test.
	* testsuite/23_containers/array/requirements/version.cc: New
	test.
	* testsuite/25_algorithms/fill_n/requirements/version.cc: New
	test.
	* testsuite/25_algorithms/swap_ranges/requirements/version.cc:
	New test.
2023-11-21 15:58:21 +00:00
Jonathan Wakely
1fa85dcf65 libstdc++: Add std::span::at for C++26 (P2821R5)
Also define the new feature test macros from P2833R2, indicating that
std::span and std::expected are supported for freestanding mode.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (freestanding_expected): New macro.
	(span): Add C++26 value.
	* include/bits/version.h: Regenerate.
	* include/std/expected (__glibcxx_want_freestanding_expected):
	Define.
	* include/std/span (span::at): New member function.
	* testsuite/20_util/expected/version.cc: Add checks for
	__cpp_lib_freestanding_expected.
	* testsuite/23_containers/span/2.cc: Moved to...
	* testsuite/23_containers/span/version.cc: ...here. Add checks
	for __cpp_lib_span in <span> as well as in <version>.
	* testsuite/23_containers/span/1.cc: Removed.
	* testsuite/23_containers/span/at.cc: New test.
2023-11-21 15:58:21 +00:00
Jonathan Wakely
49f7620a12 libstdc++: Fix std::tr2::dynamic_bitset support for alternate characters
libstdc++-v3/ChangeLog:

	* include/tr2/dynamic_bitset (dynamic_bitset): Pass zero and one
	characters to _M_copy_from_string.
	* testsuite/tr2/dynamic_bitset/string.cc: New test.
2023-11-21 15:58:21 +00:00
Jonathan Wakely
623b8081ab libstdc++: Remove outdated references to buildstat.html
The buildstat.html pages have not existed since gcc-8 so remove
referencs to them in the libstdc++ manual.

libstdc++-v3/ChangeLog:

	* doc/html/*: Regenerate.
	* doc/xml/faq.xml: Remove reference to buildstat.html pages.
	* doc/xml/manual/test.xml: Likewise
2023-11-21 15:58:20 +00:00
Jan Hubicka
1d82fc2e68 optimize std::vector::push_back
this patch speeds up the push_back at -O3 significantly by making the
reallocation to be inlined by default.  _M_realloc_insert is general
insertion that takes iterator pointing to location where the value
should be inserted.  As such it contains code to move other entries around
that is quite large.

Since appending to the end of array is common operation, I think we should
have specialized code for that.  Sadly it is really hard to work out this
from IPA passes, since we basically care whether the iterator points to
the same place as the end pointer, which are both passed by reference.
This is inter-procedural value numbering that is quite out of reach.

I also added extra check making it clear that the new length of the vector
is non-zero.  This saves extra conditionals.  Again it is quite hard case
since _M_check_len seem to be able to return 0 if its parameter is 0.
This never happens here, but we are not able to propagate this early nor
at IPA stage.

libstdc++-v3/ChangeLog:

	PR libstdc++/110287
	PR middle-end/109811
	PR middle-end/109849
	* include/bits/stl_vector.h (_M_realloc_append): New member function.
	(push_back): Use it.
	* include/bits/vector.tcc: (emplace_back): Use it.
	(_M_realloc_insert): Let compiler know that new vector size is non-zero.
	(_M_realloc_append): New member function.
2023-11-21 15:17:16 +01:00
GCC Administrator
9d58d2d8ba Daily bump. 2023-11-19 00:17:38 +00:00
Jonathan Wakely
279e407a06 libstdc++: Check string value_type in std::make_format_args [PR112607]
libstdc++-v3/ChangeLog:

	PR libstdc++/112607
	* include/std/format (basic_format_arg::_S_to_arg_type): Check
	value_type for basic_string_view and basic_string
	specializations.
	* testsuite/std/format/arguments/112607.cc: New test.
2023-11-18 21:42:33 +00:00
Jonathan Wakely
41a5ea4cab libstdc++: Add fast path for std::format("{}", x) [PR110801]
This optimizes the simple case of formatting a single string, integer
or bool, with no format-specifier (so no padding, alignment, alternate
form etc.)

libstdc++-v3/ChangeLog:

	PR libstdc++/110801
	* include/std/format (_Sink_iter::_M_reserve): New member
	function.
	(_Sink::_Reservation): New nested class.
	(_Sink::_M_reserve, _Sink::_M_bump): New virtual functions.
	(_Seq_sink::_M_reserve, _Seq_sink::_M_bump): New virtual
	overrides.
	(_Iter_sink<O, ContigIter>::_M_reserve): Likewise.
	(__do_vformat_to): Use new functions to optimize "{}" case.
2023-11-18 21:22:32 +00:00
GCC Administrator
c63a0bbce5 Daily bump. 2023-11-18 00:16:46 +00:00
Jonathan Wakely
bc274b8d67 libstdc++: Regenerate config.h.in
libstdc++-v3/ChangeLog:

	* config.h.in: Regenerate.
2023-11-17 15:28:43 +00:00
Jonathan Wakely
568eb2d25c libstdc++: Define C++26 saturation arithmetic functions (P0543R3)
This was approved for C++26 last week at the WG21 meeting in Kona.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/version.def (saturation_arithmetic): Define.
	* include/bits/version.h: Regenerate.
	* include/std/numeric: Include new header.
	* include/bits/sat_arith.h: New file.
	* testsuite/26_numerics/saturation/add.cc: New test.
	* testsuite/26_numerics/saturation/cast.cc: New test.
	* testsuite/26_numerics/saturation/div.cc: New test.
	* testsuite/26_numerics/saturation/mul.cc: New test.
	* testsuite/26_numerics/saturation/sub.cc: New test.
	* testsuite/26_numerics/saturation/version.cc: New test.
2023-11-17 15:28:30 +00:00
Jonathan Wakely
97fc8851f6 libstdc++: Adjust std::in_range template parameter name
This is more consistent with the specification in the standard.

libstdc++-v3/ChangeLog:

	* include/std/utility (in_range): Rename _Up parameter to _Res.
2023-11-17 14:46:46 +00:00
Jonathan Wakely
66c15287dd libstdc++: Add more Doxygen comments and another test for std::out_ptr
Improve Doxygen comments for std::out_ptr etc. and add a test for the
feature test macro.  Also remove a redundant preprocessor condition.

Ideally the docs for std::out_ptr and std::inout_ptr would show examples
of how to use them and what they do, but that would take some effort.
I'll aim to do that before GCC 14 is released.

libstdc++-v3/ChangeLog:

	* include/bits/out_ptr.h: Add Doxygen comments. Remove a
	redundant preprocessor condition.
	* testsuite/20_util/smartptr.adapt/version.cc: New test.
2023-11-17 14:46:30 +00:00
Jonathan Wakely
9c950c0ad8 libstdc++: Fix Doxygen markup
libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h: Fix Doxygen markup.
2023-11-17 14:27:50 +00:00
GCC Administrator
5cb13173e8 Daily bump. 2023-11-17 00:17:33 +00:00
Jonathan Wakely
23725aa53b libstdc++: Fix aligned formatting of stacktrace_entry and thread::id [PR112564]
The formatter for std:🧵:id should default to right-align, and the
formatter for std::stacktrace_entry should not just ignore the
fill-and-align and width from the format-spec!

libstdc++-v3/ChangeLog:

	PR libstdc++/112564
	* include/std/stacktrace (formatter::format): Format according
	to format-spec.
	* include/std/thread (formatter::format): Use _Align_right as
	default.
	* testsuite/19_diagnostics/stacktrace/output.cc: Check
	fill-and-align handling. Change compile test to run.
	* testsuite/30_threads/thread/id/output.cc: Check fill-and-align
	handling.
2023-11-16 17:20:00 +00:00
Jonathan Wakely
c7f6537db9 libstdc++: Implement std::out_ptr and std::inout_ptr for C++23 [PR111667]
This implements that changes from P1132R8, including optimized paths for
std::shared_ptr and std::unique_ptr.

For std::shared_ptr we pre-allocate a new control block in the
std::out_ptr_t constructor so that the destructor is non-throwing. This
requires some care because unlike the shared_ptr(Y*, D, A) constructor,
we don't want to invoke the deleter if allocating the control block
throws, because we don't own any pointer yet. In order to avoid the
unwanted deleter invocation, we create the control block manually. We
also want to avoid invoking the deleter on a null pointer on
destruction, so we destroy the control block manually if there is no
pointer to take ownership of.

For std::unique_ptr and for raw pointers, the out_ptr_t object hands out
direct access to the pointer, so that we don't have anything to do
(except possibly assign a new deleter) in the ~out_ptr_t destructor.

These optimizations avoid requiring additional temporary storage for the
pointer (and optional arguments), and avoid additional instructions to
copy that pointer into the smart pointer at the end.

libstdc++-v3/ChangeLog:

	PR libstdc++/111667
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/out_ptr.h: New file.
	* include/bits/shared_ptr.h (__is_shared_ptr): Move definition
	to here ...
	* include/bits/shared_ptr_atomic.h (__is_shared_ptr): ... from
	here.
	* include/bits/shared_ptr_base.h (__shared_count): Declare
	out_ptr_t as a friend.
	(_Sp_counted_deleter, __shared_ptr): Likewise.
	* include/bits/unique_ptr.h (unique_ptr, unique_ptr<T[], D>):
	Declare out_ptr_t and inout_ptr_t as friends.
	(__is_unique_ptr): Define new variable template.
	* include/bits/version.def (out_ptr): Define.
	* include/bits/version.h: Regenerate.
	* include/std/memory: Include new header.
	* testsuite/20_util/smartptr.adapt/inout_ptr/1.cc: New test.
	* testsuite/20_util/smartptr.adapt/inout_ptr/2.cc: New test.
	* testsuite/20_util/smartptr.adapt/inout_ptr/shared_ptr_neg.cc:
	New test.
	* testsuite/20_util/smartptr.adapt/inout_ptr/void_ptr.cc: New
	test.
	* testsuite/20_util/smartptr.adapt/out_ptr/1.cc: New test.
	* testsuite/20_util/smartptr.adapt/out_ptr/2.cc: New test.
	* testsuite/20_util/smartptr.adapt/out_ptr/shared_ptr_neg.cc:
	New test.
	* testsuite/20_util/smartptr.adapt/out_ptr/void_ptr.cc: New
	test.
2023-11-16 08:10:26 +00:00
Jonathan Wakely
7ffa63df8f libstdc++: Only declare feature test macros in standard headers
This change moves the definitions of feature test macros (or strictly
speaking, the requests for <bits/version.h> to define them) so that only
standard headers define them. For example, <bits/shared_ptr.h> will no
longer define macros related to std::shared_ptr, only <memory> and
<version> will define them. This means that __cpp_lib_shared_ptr_arrays
will not be defined by <future> or by other headers that include
<bits/shared_ptr.h>. It will only be defined when <memory> has been
included. This will discourage users from relying on transitive
includes.

As a result, internal headers that need to query the macros should use
the internal macros like __glibcxx_shared_ptr_arrays instead of
__cpp_lib_shared_ptr_arrays, as those internal macros are defined by the
internal headers after icluding <bits/version.h>. There are some
exceptions to this rule, because __cpp_lib_is_constant_evaluated is
defined by bits/c++config.h and so is available everywhere, and
__cpp_lib_three_way_comparison is defined by <compare> which several
headers are explicitly specified to include, so its macro is guaranteed
to be usable too.

N.B. not many internal headers actually need an explicit include of
<bits/version.h>, because most of them include <type_traits> and so get
all the __glibcxx_foo internal macros from there.

libstdc++-v3/ChangeLog:

	* include/bits/algorithmfwd.h: Do not define standard feature
	test macro here.
	* include/bits/align.h: Likewise. Test internal macros instead
	of standard macros.
	* include/bits/alloc_traits.h: Likewise.
	* include/bits/allocator.h: Likewise.
	* include/bits/atomic_base.h: Likewise.
	* include/bits/atomic_timed_wait.h: Likewise.
	* include/bits/atomic_wait.h: Likewise.
	* include/bits/basic_string.h: Likewise.
	* include/bits/basic_string.tcc: Likewise.
	* include/bits/char_traits.h: Likewise.
	* include/bits/chrono.h: Likewise.
	* include/bits/cow_string.h: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/hashtable.h: Likewise.
	* include/bits/ios_base.h: Likewise.
	* include/bits/memory_resource.h: Likewise.
	* include/bits/move.h: Likewise.
	* include/bits/move_only_function.h: Likewise.
	* include/bits/node_handle.h: Likewise.
	* include/bits/ptr_traits.h: Likewise.
	* include/bits/range_access.h: Likewise.
	* include/bits/ranges_algo.h: Likewise.
	* include/bits/ranges_cmp.h: Likewise.
	* include/bits/ranges_util.h: Likewise.
	* include/bits/semaphore_base.h: Likewise.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/shared_ptr_atomic.h: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/bits/stl_algo.h: Likewise.
	* include/bits/stl_algobase.h: Likewise.
	* include/bits/stl_function.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_pair.h: Likewise.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/stl_uninitialized.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/uses_allocator_args.h: Likewise.
	* include/bits/utility.h: Likewise.
	* include/bits/erase_if.h: Add comment.
	* include/std/algorithm: Define standard feature test macros
	here.
	* include/std/atomic: Likewise.
	* include/std/array: Likewise.
	* include/std/chrono: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/deque: Likewise.
	* include/std/format: Likewise.
	* include/std/functional: Likewise.
	* include/std/forward_list: Likewise.
	* include/std/ios: Likewise.
	* include/std/iterator: Likewise.
	* include/std/list: Likewise.
	* include/std/map: Likewise.
	* include/std/memory: Likewise.
	* include/std/numeric: Likewise.
	* include/std/queue: Likewise.
	* include/std/ranges: Likewise.
	* include/std/regex: Likewise.
	* include/std/set: Likewise.
	* include/std/stack: Likewise.
	* include/std/stop_token: Likewise.
	* include/std/string: Likewise.
	* include/std/string_view:
	* include/std/tuple: Likewise.
	* include/std/unordered_map:
	* include/std/unordered_set:
	* include/std/utility: Likewise.
	* include/std/vector: Likewise.
	* include/std/scoped_allocator: Query internal macros instead of
	standard macros.
2023-11-16 08:10:19 +00:00
Jonathan Wakely
f4ab68469c libstdc++: Test for feature test macros more accurately
Tests which check for feature test macros should use the no_pch option,
so that we're really testing for the definition being in the intended
header, and not just testing that it's present in <bits/stdc++.h> (which
includes all the standard headers and so defines all the macros).

libstdc++-v3/ChangeLog:

	* testsuite/18_support/byte/requirements.cc: Disable PCH.
	* testsuite/18_support/destroying_delete.cc: Likewise.
	* testsuite/18_support/source_location/1.cc: Likewise.
	* testsuite/18_support/source_location/version.cc: Likewise.
	* testsuite/18_support/type_info/constexpr.cc: Likewise.
	* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc:
	Likewise.
	* testsuite/19_diagnostics/stacktrace/output.cc: Likewise.
	* testsuite/19_diagnostics/stacktrace/synopsis.cc: Likewise.
	* testsuite/19_diagnostics/stacktrace/version.cc: Likewise.
	* testsuite/20_util/addressof/requirements/constexpr.cc:
	Likewise.
	* testsuite/20_util/allocator_traits/header-2.cc: Likewise.
	* testsuite/20_util/allocator_traits/header.cc: Likewise.
	* testsuite/20_util/as_const/1.cc: Likewise. Likewise.
	* testsuite/20_util/bitset/cons/constexpr_c++23.cc: Likewise.
	* testsuite/20_util/bitset/version.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.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/exchange/constexpr.cc: Likewise.
	* testsuite/20_util/expected/synopsis.cc: Likewise.
	* testsuite/20_util/expected/version.cc: Likewise.
	* testsuite/20_util/function_objects/bind_front/1.cc: Likewise.
	* testsuite/20_util/function_objects/bind_front/2.cc: Likewise.
	* testsuite/20_util/function_objects/invoke/3.cc: Likewise.
	* testsuite/20_util/function_objects/invoke/4.cc: Likewise.
	* testsuite/20_util/function_objects/invoke/constexpr.cc:
	Likewise.
	* testsuite/20_util/function_objects/invoke/version.cc:
	Likewise.
	* testsuite/20_util/function_objects/searchers.cc: Likewise.
	* testsuite/20_util/integer_comparisons/1.cc: Likewise.
	* testsuite/20_util/integer_comparisons/2.cc: Likewise.
	* testsuite/20_util/is_bounded_array/value.cc: Likewise.
	* testsuite/20_util/is_layout_compatible/value.cc: Likewise.
	* testsuite/20_util/is_layout_compatible/version.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/value.h: Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/explicit_instantiation.cc:
	Remove redundant checks already tested elsewhere.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/value.cc: Disable
	PCH.
	* testsuite/20_util/is_pointer_interconvertible/value.cc:
	Likewise.
	* testsuite/20_util/is_pointer_interconvertible/version.cc:
	Likewise.
	* testsuite/20_util/is_scoped_enum/value.cc: Likewise.
	* testsuite/20_util/is_scoped_enum/version.cc: Likewise.
	* testsuite/20_util/is_swappable/requirements/explicit_instantiation.cc:
	Remove redundant checks already tested elsewhere.
	* testsuite/20_util/is_swappable/requirements/typedefs.cc:
	Remove redundant checks already tested elsewhere.
	* testsuite/20_util/is_swappable/value.cc: Disable PCH.
	* testsuite/20_util/is_swappable/value.h: Reorder headers.
	* testsuite/20_util/is_swappable_with/requirements/explicit_instantiation.cc:
	Remove redundant checks already tested elsewhere.
	* testsuite/20_util/is_swappable_with/requirements/typedefs.cc:
	Remove redundant checks already tested elsewhere.
	* testsuite/20_util/is_swappable_with/value.cc: Disable PCH.
	* testsuite/20_util/is_unbounded_array/value.cc: Likewise.
	* testsuite/20_util/move_only_function/cons.cc: Likewise.
	* testsuite/20_util/move_only_function/version.cc: Likewise.
	* testsuite/20_util/optional/monadic/and_then.cc: Likewise.
	* testsuite/20_util/optional/requirements.cc: Likewise.
	* testsuite/20_util/optional/version.cc: Likewise.
	* testsuite/20_util/owner_less/void.cc: Likewise.
	* testsuite/20_util/reference_from_temporary/value.cc: Likewise.
	* testsuite/20_util/reference_from_temporary/version.cc:
	Likewise.
	* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
	Likewise.
	* testsuite/20_util/shared_ptr/creation/array.cc: Likewise.
	* testsuite/20_util/shared_ptr/creation/overwrite.cc: Likewise.
	* testsuite/20_util/shared_ptr/creation/version.cc: Likewise.
	* testsuite/20_util/time_point_cast/rounding.cc: Likewise.
	* testsuite/20_util/to_chars/constexpr.cc: Likewise.
	* testsuite/20_util/to_chars/result.cc: Likewise.
	* testsuite/20_util/to_chars/version.cc: Likewise.
	* testsuite/20_util/to_underlying/1.cc: Likewise.
	* testsuite/20_util/to_underlying/version.cc: Likewise.
	* testsuite/20_util/tuple/apply/1.cc: Likewise.
	* testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc:
	Likewise.
	* testsuite/20_util/tuple/make_from_tuple/1.cc: Likewise.
	* testsuite/20_util/tuple/p2321r2.cc: Likewise.
	* testsuite/20_util/tuple/tuple_element_t.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/constexpr_c++20.cc:
	Likewise.
	* testsuite/20_util/unique_ptr/creation/for_overwrite.cc:
	Likewise.
	* testsuite/20_util/unreachable/1.cc: Likewise.
	* testsuite/20_util/unreachable/version.cc: Likewise.
	* testsuite/20_util/unwrap_reference/1.cc: Likewise.
	* testsuite/20_util/unwrap_reference/3.cc: Likewise.
	* testsuite/20_util/variant/constexpr.cc: Likewise.
	* testsuite/20_util/variant/version.cc: Likewise.
	* testsuite/20_util/variant/visit_inherited.cc: Likewise.
	* testsuite/20_util/void_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/constexpr.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/constexpr.cc:
	Likewise.
	* testsuite/21_strings/basic_string/erasure.cc: Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/to_string_float.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/version.cc:
	Likewise.
	* testsuite/21_strings/basic_string/version.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operations/contains/char.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/contains/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.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/21_strings/char_traits/requirements/version.cc:
	Likewise.
	* testsuite/23_containers/array/comparison_operators/constexpr.cc:
	Likewise.
	* testsuite/23_containers/array/creation/1.cc: Likewise.
	* testsuite/23_containers/array/creation/2.cc: Likewise.
	* testsuite/23_containers/array/element_access/constexpr_c++17.cc:
	Likewise.
	* testsuite/23_containers/array/requirements/constexpr_fill.cc:
	Likewise.
	* testsuite/23_containers/array/requirements/constexpr_iter.cc:
	Likewise.
	* testsuite/23_containers/deque/erasure.cc: Likewise.
	* testsuite/23_containers/forward_list/erasure.cc: Likewise.
	* testsuite/23_containers/list/erasure.cc: Likewise.
	* testsuite/23_containers/map/erasure.cc: Likewise.
	* testsuite/23_containers/queue/cons_from_iters.cc: Likewise.
	* testsuite/23_containers/set/erasure.cc: Likewise.
	* testsuite/23_containers/span/1.cc: Likewise.
	* testsuite/23_containers/span/2.cc: Likewise.
	* testsuite/23_containers/stack/cons_from_iters.cc: Likewise.
	* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_map/operations/1.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_set/operations/1.cc:
	Likewise.
	* testsuite/23_containers/vector/cons/constexpr.cc: Likewise.
	* testsuite/23_containers/vector/erasure.cc: Likewise.
	* testsuite/23_containers/vector/requirements/version.cc:
	Likewise.
	* testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise.
	* testsuite/25_algorithms/clamp/constexpr.cc: Likewise.
	* testsuite/25_algorithms/clamp/requirements/explicit_instantiation/1.cc:
	Remove redundant checks already tested elsewhere.
	* testsuite/25_algorithms/constexpr_macro.cc: Likewise.
	* testsuite/25_algorithms/cpp_lib_constexpr.cc: Likewise.
	* testsuite/25_algorithms/fold_left/1.cc: Likewise.
	* testsuite/25_algorithms/pstl/feature_test-2.cc: Likewise.
	* testsuite/25_algorithms/pstl/feature_test-3.cc: Likewise.
	* testsuite/25_algorithms/pstl/feature_test-4.cc: Likewise.
	* testsuite/25_algorithms/pstl/feature_test-5.cc: Likewise.
	* testsuite/25_algorithms/pstl/feature_test.cc: Likewise.
	* testsuite/26_numerics/bit/bit.byteswap/byteswap.cc: Likewise.
	* testsuite/26_numerics/bit/bit.byteswap/version.cc: Likewise.
	* testsuite/26_numerics/bit/bit.cast/bit_cast.cc: Likewise.
	* testsuite/26_numerics/bit/bit.cast/version.cc: Likewise.
	* testsuite/26_numerics/bit/header-2.cc: Likewise.
	* testsuite/26_numerics/bit/header.cc: Likewise.
	* testsuite/26_numerics/complex/1.cc: Likewise.
	* testsuite/26_numerics/complex/2.cc: Likewise.
	* testsuite/26_numerics/endian/2.cc: Likewise.
	* testsuite/26_numerics/endian/3.cc: Likewise.
	* testsuite/26_numerics/gcd/1.cc: Likewise.
	* testsuite/26_numerics/lcm/1.cc: Likewise.
	* testsuite/26_numerics/lerp/1.cc: Likewise.
	* testsuite/26_numerics/lerp/version.cc: Likewise.
	* testsuite/26_numerics/midpoint/integral.cc: Likewise.
	* testsuite/26_numerics/midpoint/version.cc: Likewise.
	* testsuite/26_numerics/numbers/1.cc: Likewise.
	* testsuite/26_numerics/numbers/2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/native_handle/char/1.cc:
	Likewise.
	* testsuite/27_io/basic_filebuf/native_handle/version.cc:
	Likewise.
	* testsuite/27_io/basic_ofstream/open/char/noreplace.cc:
	Likewise.
	* testsuite/27_io/basic_ofstream/open/wchar_t/noreplace.cc:
	Likewise.
	* testsuite/27_io/basic_syncbuf/1.cc: Likewise.
	* testsuite/27_io/basic_syncbuf/2.cc: Likewise.
	* testsuite/27_io/basic_syncstream/1.cc: Likewise.
	* testsuite/27_io/basic_syncstream/2.cc: Likewise.
	* testsuite/27_io/spanstream/1.cc: Likewise.
	* testsuite/27_io/spanstream/version.cc: Likewise.
	* testsuite/29_atomics/atomic/cons/value_init.cc: Likewise.
	* testsuite/29_atomics/atomic/lock_free_aliases.cc: Likewise.
	* testsuite/29_atomics/atomic/wait_notify/1.cc: Likewise.
	* testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise.
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc:
	Likewise.
	* testsuite/29_atomics/headers/stdatomic.h/version.cc: Likewise.
	* testsuite/30_threads/barrier/1.cc: Likewise.
	* testsuite/30_threads/barrier/2.cc: Likewise.
	* testsuite/30_threads/condition_variable_any/stop_token/1.cc:
	Likewise.
	* testsuite/30_threads/condition_variable_any/stop_token/2.cc:
	Likewise.
	* testsuite/30_threads/jthread/1.cc: Likewise.
	* testsuite/30_threads/jthread/version.cc: Likewise.
	* testsuite/30_threads/latch/1.cc: Likewise.
	* testsuite/30_threads/latch/2.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc:
	Likewise.
	* testsuite/30_threads/semaphore/1.cc: Likewise.
	* testsuite/30_threads/semaphore/2.cc: Likewise.
	* testsuite/30_threads/stop_token/1.cc: Likewise.
	* testsuite/30_threads/stop_token/2.cc: Likewise.
	* testsuite/experimental/feat-char8_t.cc: Likewise.
	* testsuite/experimental/iterator/ostream_joiner.cc: Likewise.
	* testsuite/experimental/numeric/gcd.cc: Likewise.
	* testsuite/experimental/scopeguard/uniqueres.cc: Likewise.
	* testsuite/std/concepts/1.cc: Likewise.
	* testsuite/std/concepts/2.cc: Likewise.
	* testsuite/std/ranges/adaptors/as_const/1.cc: Likewise.
	* testsuite/std/ranges/adaptors/as_rvalue/1.cc: Likewise.
	* testsuite/std/ranges/adaptors/chunk/1.cc: Likewise.
	* testsuite/std/ranges/adaptors/chunk_by/1.cc: Likewise.
	* testsuite/std/ranges/adaptors/enumerate/1.cc: Likewise.
	* testsuite/std/ranges/adaptors/join_with/1.cc: Likewise.
	* testsuite/std/ranges/adaptors/slide/1.cc: Likewise.
	* testsuite/std/ranges/adaptors/stride/1.cc: Likewise.
	* testsuite/std/ranges/cartesian_product/1.cc: Likewise.
	* testsuite/std/ranges/headers/ranges/synopsis.cc: Likewise.
	* testsuite/std/ranges/repeat/1.cc: Likewise.
	* testsuite/std/ranges/version_c++23.cc: Likewise.
	* testsuite/std/ranges/zip/1.cc: Likewise.
	* testsuite/std/time/syn_c++20.cc: Likewise.
	* testsuite/experimental/feat-cxx14.cc: Likewise. Include
	<algorithm> and <iterator>.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Adjust dg-error line numbers.
2023-11-16 08:06:59 +00:00
Jonathan Wakely
e469f9003d libstdc++: Use 202100L as feature test check for C++23
I noticed that our C++23 features were not being defined when using
Clang 16 with -std=c++2b, because it only defines __cplusplus=202101L
but <bits/version.h> uses 202302L since my r14-3252-g0c316669b092fb
change.

This changes <bits/version.h> to use 202100 instead of the final 202302
value so that we support Clang 16's -std=c++2b mode.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (stds): Use >= 202100 for C++23
	condition.
	* include/bits/version.h: Regenerate.
	* include/std/thread: Use > C++20 instead of >= C++23 for
	__cplusplus condition.
2023-11-16 08:00:36 +00:00