public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header
@ 2023-08-13 19:35 Arsen Arsenović
  2023-08-13 19:35 ` [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use Arsen Arsenović
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arsen Arsenović @ 2023-08-13 19:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Arsen Arsenović

This commit replaces the ad-hoc logic in <version> with an AutoGen
database that (mostly) declaratively generates a version.h bit which
combines all of the FTM logic across all headers together.

This generated header defines macros of the form __glibcxx_foo,
equivalent to their __cpp_lib_foo variants, according to rules specified
in version.def and, optionally, if __glibcxx_want_foo or
__glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
the same definition.

libstdc++-v3/ChangeLog:

	* include/Makefile.am (bits_freestanding): Add version.h.
	(allcreated): Add version.h.
	(${bits_srcdir}/version.h): New rule.  Regenerates
	version.h out of version.{def,tpl}.
	* include/Makefile.in: Regenerate.
	* include/bits/version.def: New file.  Declares a list of
	all feature test macros, their values and their preconditions.
	* include/bits/version.tpl: New file.  Turns version.def
	into a sequence of #if blocks.
	* include/bits/version.h: New file.  Generated from
	version.def.
	* include/std/version: Replace with a __glibcxx_want_all define
	and bits/version.h include.
---
This patchset is a rebase of
https://inbox.sourceware.org/libstdc++/20230429101640.1697750-1-arsen@aarsen.me/

... passing the same two checks (difall / vercmp) I wrote for the first
pass.  Testsuite runs are still pending.

Changes in this revision:
- Replace the ${bits_srcdir}/version.h rule with a update-version phony,
- Add the new __cpp_lib_chrono value,
- Add __cpp_lib_{ranges_{contains,find_last,fold,iota}},
- Add comments to various replaced conditions which summarize their
  condition,
- Correct a few minor errors spotted in review

OK for trunk (if those testsuite runs end up clean)?

 libstdc++-v3/include/Makefile.am      |   10 +-
 libstdc++-v3/include/Makefile.in      |   10 +-
 libstdc++-v3/include/bits/version.def | 1597 ++++++++++++++++++++
 libstdc++-v3/include/bits/version.h   | 1942 +++++++++++++++++++++++++
 libstdc++-v3/include/bits/version.tpl |  210 +++
 libstdc++-v3/include/std/version      |  350 +----
 6 files changed, 3770 insertions(+), 349 deletions(-)
 create mode 100644 libstdc++-v3/include/bits/version.def
 create mode 100644 libstdc++-v3/include/bits/version.h
 create mode 100644 libstdc++-v3/include/bits/version.tpl

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index a880e8ee227..9c71c75393a 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -154,6 +154,7 @@ bits_freestanding = \
 	${bits_srcdir}/stl_raw_storage_iter.h \
 	${bits_srcdir}/stl_relops.h \
 	${bits_srcdir}/stl_uninitialized.h \
+	${bits_srcdir}/version.h \
 	${bits_srcdir}/string_view.tcc \
 	${bits_srcdir}/uniform_int_dist.h \
 	${bits_srcdir}/unique_ptr.h \
@@ -1113,7 +1114,8 @@ allcreated = \
 	${host_builddir}/c++config.h \
 	${host_builddir}/largefile-config.h \
 	${thread_host_headers} \
-	${pch_build}
+	${pch_build} \
+	${bits_srcdir}/version.h
 
 # Here are the rules for building the headers
 all-local: ${allstamped} ${allcreated}
@@ -1463,6 +1465,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
 	-mkdir -p ${pch3_output_builddir}
 	$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen <bits/version.h>.
+.PHONY: update-version
+update-version:
+	cd ${bits_srcdir} && \
+	autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 0ff875b280b..f5b04d3fe8a 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -509,6 +509,7 @@ bits_freestanding = \
 	${bits_srcdir}/stl_raw_storage_iter.h \
 	${bits_srcdir}/stl_relops.h \
 	${bits_srcdir}/stl_uninitialized.h \
+	${bits_srcdir}/version.h \
 	${bits_srcdir}/string_view.tcc \
 	${bits_srcdir}/uniform_int_dist.h \
 	${bits_srcdir}/unique_ptr.h \
@@ -1441,7 +1442,8 @@ allcreated = \
 	${host_builddir}/c++config.h \
 	${host_builddir}/largefile-config.h \
 	${thread_host_headers} \
-	${pch_build}
+	${pch_build} \
+	${bits_srcdir}/version.h
 
 
 # Host includes for threads
@@ -1937,6 +1939,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
 	-mkdir -p ${pch3_output_builddir}
 	$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen <bits/version.h>.
+${bits_srcdir}/version.h: ${bits_srcdir}/version.def \
+				${bits_srcdir}/version.tpl
+	cd $(@D) && \
+	autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
new file mode 100644
index 00000000000..e63715e17e7
--- /dev/null
+++ b/libstdc++-v3/include/bits/version.def
@@ -0,0 +1,1597 @@
+// Feature test macro definitions                                  -*- C++ -*-
+// Copyright (C) 2023 Free Software Foundation, Inc.
+
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+AutoGen Definitions version.tpl;
+
+// The top level variable ftms is an array of feature test macros.  Each entry
+// consists of a structure like following:
+
+// Schema:
+// ftms = {
+//   name = FTM NAME;
+//   [stdname = FTM STANDARD MACRO NAME;]
+//   values = {
+//     v = VALUE FOR FTM IF MATCHING;
+//     [extra_cond = STRING;]
+//     [cxxmin = NUMBER;]
+//     [gnuxxmin = NUMBER;]
+//     [gthread = yes|no;]
+//     [hosted = yes|no;]
+//     [cxx11abi = yes|no;]
+//   }; ...
+// };
+
+// The elements in square brackets are optional.  These are formulated into a
+// logical expression like:
+//   ((strict && c++ >= cxxmin) || (!strict && c++ >= gnuxxmin))
+//   && (gthr <=> gthread)
+//   && (host <=> hosted)
+//   && (cxx11 <=> cxx11abi)
+//   && (extra_cond)
+// Where gthr, cxx11 and host are _GLIBCXX_HAS_GTHREADS, _GLIBCXX_USE_CXX11_ABI
+// and _GLIBCXX_HOSTED respectively.  If any of these are omitted, their
+// sub-expressions are equivalent to the identity.  Specially, if gnuxxmin is
+// omitted, it is taken to be the value of cxxmin, and so, only if both are
+// omitted, the clause is omitted.
+
+// stdname configures the name of the *standard* macro emitted, i.e. it
+// replaces only the __cpp_lib_ macro in the emitted definition.  Defaults to
+// __cpp_lib_${name}
+
+// N.B This list needs to be in topological sort order, as later entries in
+// this list can and do use the earlier entries.
+
+ftms = {
+  name = incomplete_container_elements;
+  values = {
+    v = 201505;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = uncaught_exceptions;
+  values = {
+    v = 201411;
+    cxxmin = 17;
+    gnuxxmin = 03;
+  };
+};
+
+ftms = {
+  name = allocator_traits_is_always_equal;
+  values = {
+    v = 201411;
+    cxxmin = 11;
+  };
+};
+
+ftms = {
+  name = is_null_pointer;
+  values = {
+    v = 201309;
+    cxxmin = 11;
+  };
+};
+
+ftms = {
+  name = result_of_sfinae;
+  values = {
+    v = 201210;
+    cxxmin = 11;
+  };
+};
+
+ftms = {
+  name = shared_ptr_arrays;
+  values = {
+    v = 201707;
+    cxxmin = 20;
+    hosted = yes;
+  };
+  values = {
+    v = 201611;
+    cxxmin = 11;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = is_swappable;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+    gnuxxmin = 11;
+  };
+};
+
+ftms = {
+  name = void_t;
+  values = {
+    v = 201411;
+    cxxmin = 17;
+    gnuxxmin = 11;
+  };
+};
+
+ftms = {
+  name = enable_shared_from_this;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+    gnuxxmin = 11;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = math_spec_funcs;
+  stdname = "__STDCPP_MATH_SPEC_FUNCS__";
+  values = {
+    v = 201003;
+    cxxmin = 11;
+  };
+};
+
+ftms = {
+  name = coroutine;
+  values = {
+    v = 201902;
+    // It is very likely that earlier versions would work, but they are
+    // untested.
+    cxxmin = 14;
+    extra_cond = "__cpp_impl_coroutine";
+  };
+};
+
+ftms = {
+  name = exchange_function;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = integer_sequence;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = integral_constant_callable;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = is_final;
+  values = {
+    v = 201402;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = make_reverse_iterator;
+  values = {
+    v = 201402;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = null_iterators;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+    extra_cond = "!defined(_GLIBCXX_DEBUG)";
+  };
+};
+
+ftms = {
+  name = transformation_trait_aliases;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = transparent_operators;
+  values = {
+    v = 201510;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = tuple_element_t;
+  values = {
+    v = 201402;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = tuples_by_type;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = robust_nonmodifying_seq_ops;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+  };
+};
+
+ftms = {
+  name = to_chars;
+  values = {
+    v = 201611;
+    cxxmin = 14;
+    extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
+    "&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
+    "&& __SIZE_WIDTH__ >= 32";
+  };
+};
+
+ftms = {
+  name = chrono_udls;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = complex_udls;
+  values = {
+    v = 201309;
+    cxxmin = 14;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = generic_associative_lookup;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = make_unique;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = quoted_string_io;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = shared_timed_mutex;
+  values = {
+    v = 201402;
+    cxxmin = 14;
+    hosted = yes;
+    gthread = yes;
+  };
+};
+
+ftms = {
+  name = string_udls;
+  values = {
+    v = 201304;
+    cxxmin = 14;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = addressof_constexpr;
+  values = {
+    // _GLIBCXX_RESOLVE_LIB_DEFECTS
+    // 2296. std::addressof should be constexpr
+    v = 201603;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = any;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = apply;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = as_const;
+  values = {
+    v = 201510;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = atomic_is_always_lock_free;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = bool_constant;
+  values = {
+    v = 201505;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = byte;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = has_unique_object_representations;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+    extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)";
+  };
+};
+
+ftms = {
+  name = hardware_interference_size;
+  values = {
+    v = 201703;
+    cxxmin = 17;
+    extra_cond = "defined(__GCC_DESTRUCTIVE_SIZE)";
+  };
+};
+
+ftms = {
+  name = invoke;
+  values = {
+    v = 201411;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = is_aggregate;
+  values = {
+    v = 201703;
+    cxxmin = 17;
+    extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE)";
+  };
+};
+
+ftms = {
+  name = is_invocable;
+  values = {
+    v = 201703;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = launder;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+    extra_cond = "defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER)";
+  };
+};
+
+ftms = {
+  name = logical_traits;
+  values = {
+    v = 201510;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = make_from_tuple;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = not_fn;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = type_trait_variable_templates;
+  values = {
+    v = 201510;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = variant;
+  values = {
+    v = 202106;
+    cxxmin = 20;
+    extra_cond = "__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L";
+  };
+  values = {
+    v = 202102;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  // Used in earlier draft of SD6.
+  name = lcm;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  // Used in earlier draft of SD6.
+  name = gcd;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = gcd_lcm;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = raw_memory_algorithms;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = array_constexpr;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+  values = {
+    v = 201803;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = nonmember_container_access;
+  values = {
+    v = 201411;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = clamp;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = sample;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = boyer_moore_searcher;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = chrono;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    hosted = yes;
+  };
+  values = {
+    v = 201611;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = execution;
+  values = {
+    v = 201902;  // FIXME: should be 201603L
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = filesystem;
+  values = {
+    v = 201703;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = hypot;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = map_try_emplace;
+  values = {
+    v = 201411;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = math_special_functions;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = memory_resource;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+    hosted = yes;
+    gthread = yes;
+  };
+  values = {
+    v = 1;
+    /* For when there's no gthread.  */
+    cxxmin = 17;
+    hosted = yes;
+    gthread = no;
+  };
+};
+
+ftms = {
+  name = node_extract;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = parallel_algorithm;
+  values = {
+    v = 201603;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = scoped_lock;
+  values = {
+    v = 201703;
+    cxxmin = 17;
+    hosted = yes;
+    gthread = yes;
+  };
+};
+
+ftms = {
+  name = shared_mutex;
+  values = {
+    v = 201505;
+    cxxmin = 17;
+    hosted = yes;
+    gthread = yes;
+  };
+};
+
+ftms = {
+  name = shared_ptr_weak_type;
+  values = {
+    v = 201606;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = string_view;
+  values = {
+    v = 201803;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = unordered_map_try_emplace;
+  values = {
+    v = 201411;
+    cxxmin = 17;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = assume_aligned;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = atomic_flag_test;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = atomic_float;
+  values = {
+    v = 201711;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = atomic_lock_free_type_aliases;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = atomic_ref;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = atomic_value_initialization;
+  values = {
+    v = 201911;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = bind_front;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = starts_ends_with;
+  values = {
+    v = 201711;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = bit_cast;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+    extra_cond = "__has_builtin(__builtin_bit_cast)";
+  };
+};
+
+ftms = {
+  name = bitops;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = bounded_array_traits;
+  values = {
+    v = 201902;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = concepts;
+  values = {
+    v = 202002;
+    cxxmin = 20;
+    extra_cond = "__cpp_concepts >= 201907L";
+  };
+};
+
+// Moved down here (after concepts) by topological sort.
+ftms = {
+  name = optional;
+  values = {
+    v = 202110;
+    cxxmin = 23;
+    extra_cond = "__glibcxx_concepts";
+  };
+  values = {
+    v = 202106;
+    cxxmin = 20;
+  };
+  values = {
+    v = 201606;
+    cxxmin = 17;
+  };
+};
+
+ftms = {
+  name = destroying_delete;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+    extra_cond = "__cpp_impl_destroying_delete";
+  };
+};
+
+ftms = {
+  name = constexpr_string_view;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = endian;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = int_pow2;
+  values = {
+    v = 202002;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = integer_comparison_functions;
+  values = {
+    v = 202002;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = is_constant_evaluated;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+    extra_cond = "defined(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)";
+  };
+};
+
+// Moved down here (after is_constant_evaluated) by topological sort.
+ftms = {
+  name = constexpr_char_traits;
+  values = {
+    // Unofficial macro indicating P1032R1 support in C++20
+    v = 201811;
+    cxxmin = 20;
+    extra_cond = "defined(__glibcxx_is_constant_evaluated)";
+  };
+  values = {
+    // Unofficial macro indicating P0426R1 support in C++17
+    v = 201611;
+    cxxmin = 17;
+    extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
+  };
+};
+
+ftms = {
+  name = is_layout_compatible;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    extra_cond = "__has_builtin(__is_layout_compatible) "
+    "&& __has_builtin(__builtin_is_corresponding_member)";
+  };
+};
+
+ftms = {
+  name = is_nothrow_convertible;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = is_pointer_interconvertible;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    extra_cond =
+    "__has_builtin(__is_pointer_interconvertible_base_of) "
+    "&& __has_builtin(__builtin_is_pointer_interconvertible_with_class)";
+  };
+};
+
+ftms = {
+  name = math_constants;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = make_obj_using_allocator;
+  values = {
+    // Not specified by C++20, used internally
+    v = 201811;
+    cxxmin = 20;
+    extra_cond = "__cpp_concepts";
+  };
+};
+
+ftms = {
+  name = remove_cvref;
+  values = {
+    v = 201711;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = source_location;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    extra_cond = "__has_builtin(__builtin_source_location)";
+  };
+};
+
+ftms = {
+  name = span;
+  values = {
+    v = 202002;
+    cxxmin = 20;
+    extra_cond = "__glibcxx_concepts";
+  };
+};
+
+ftms = {
+  name = ssize;
+  values = {
+    v = 201902;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = three_way_comparison;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    extra_cond = "__cpp_impl_three_way_comparison >= 201907L "
+    "&& __glibcxx_concepts";
+  };
+};
+
+ftms = {
+  name = to_address;
+  values = {
+    v = 201711;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = to_array;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    extra_cond = "__cpp_generic_lambdas >= 201707L";
+  };
+};
+
+ftms = {
+  name = type_identity;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = unwrap_ref;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = constexpr_iterator;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = interpolate;
+  values = {
+    v = 201902;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = constexpr_utility;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = shift;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = ranges;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+    extra_cond = "__glibcxx_concepts";
+  };
+  values = {
+    v = 202110;
+    cxxmin = 20;
+    extra_cond = "__glibcxx_concepts";
+  };
+};
+
+ftms = {
+  name = constexpr_numeric;
+  values = {
+    v = 201911;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = constexpr_functional;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = constexpr_algorithms;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = constexpr_tuple;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = constexpr_memory;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+    extra_cond = "__cpp_constexpr_dynamic_alloc";
+  };
+  values = {
+    v = 201811;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = atomic_shared_ptr;
+  values = {
+    v = 201711;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = atomic_wait;
+  // atomic_wait is available if either futexes or gthread are.
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    hosted = yes;
+    gthread = yes;
+  };
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    hosted = yes;
+    gthread = no;
+    extra_cond = "defined(_GLIBCXX_HAVE_LINUX_FUTEX)";
+  };
+};
+
+ftms = {
+  name = barrier;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    // This condition carries in the hosted&&(futex||gthread) logic from above.
+    extra_cond = "__cpp_aligned_new && __glibcxx_atomic_wait";
+  };
+};
+
+ftms = {
+  // 201907 Text Formatting, Integration of chrono, printf corner cases.
+  // 202106 std::format improvements.
+  // 202110 Fixing locale handling in chrono formatters, generator-like types.
+  // 202207 Encodings in localized formatting of chrono, basic-format-string.
+  // 202207 P2286R8 Formatting Ranges
+  // 202207 P2585R1 Improving default container formatting
+  // TODO: #define __cpp_lib_format_ranges 202207L
+  name = format;
+  values = {
+    v = 202106;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+// #undef __glibcxx_chrono
+// #define __glibcxx_chrono 201907L
+// FIXME: #define __glibcxx_execution 201902L
+
+ftms = {
+  name = constexpr_complex;
+  values = {
+    v = 201711;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = constexpr_dynamic_alloc;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = constexpr_string;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    hosted = yes;
+    cxx11abi = yes;
+    extra_cond = "defined(__glibcxx_is_constant_evaluated)";
+  };
+  values = {
+    v = 201811;
+    cxxmin = 20;
+    hosted = yes;
+    cxx11abi = no;
+    extra_cond = "defined(__glibcxx_is_constant_evaluated)";
+  };
+  values = {
+    v = 201611;
+    cxxmin = 17;
+    hosted = yes;
+    extra_cond = "_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED";
+  };
+};
+
+ftms = {
+  name = constexpr_vector;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = erase_if;
+  values = {
+    v = 202002;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = generic_unordered_lookup;
+  values = {
+    v = 201811;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = jthread;
+  values = {
+    v = 201911;
+    gthread = yes;
+    hosted = yes;
+    cxxmin = 20;
+  };
+};
+
+ftms = {
+  name = latch;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    extra_cond = "__glibcxx_atomic_wait";
+  };
+};
+
+ftms = {
+  name = list_remove_return_type;
+  values = {
+    v = 201806;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = polymorphic_allocator;
+  values = {
+    v = 201902;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = move_iterator_concept;
+  values = {
+    v = 202207;
+    // This is P2520R0, a C++23 change, but we treat it as a DR against C++20.
+    cxxmin = 20;
+    extra_cond = "__glibcxx_concepts";
+  };
+};
+
+ftms = {
+  name = semaphore;
+  values = {
+    v = 201907;
+    cxxmin = 20;
+    hosted = yes;
+    extra_cond = "__glibcxx_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE";
+  };
+};
+
+ftms = {
+  name = smart_ptr_for_overwrite;
+  values = {
+    v = 202002;
+    cxxmin = 20;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = syncbuf;
+  values = {
+    v = 201803;
+    cxxmin = 20;
+    hosted = yes;
+    cxx11abi = yes;
+  };
+};
+
+ftms = {
+  name = byteswap;
+  values = {
+    v = 202110;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = constexpr_charconv;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = constexpr_typeinfo;
+  values = {
+    v = 202106;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = expected;
+  values = {
+    v = 202211;
+    cxxmin = 23;
+    extra_cond = "__cpp_concepts >= 202002L";
+  };
+};
+
+ftms = {
+  name = invoke_r;
+  values = {
+    v = 202106;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = is_scoped_enum;
+  values = {
+    v = 202011;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = reference_from_temporary;
+  values = {
+    v = 202202;
+    extra_cond =
+    "__has_builtin(__reference_constructs_from_temporary) "
+    "&& __has_builtin(__reference_converts_from_temporary)";
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = to_underlying;
+  values = {
+    v = 202102;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = unreachable;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_zip;
+  values = {
+    v = 202110;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_chunk;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_slide;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_chunk_by;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_join_with;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_repeat;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_stride;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_cartesian_product;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_as_rvalue;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_as_const;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_enumerate;
+  values = {
+    v = 202302;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_fold;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_contains;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_iota;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = ranges_find_last;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = constexpr_bitset;
+  values = {
+    v = 202202;
+    cxxmin = 23;
+    hosted = yes;
+    extra_cond = "__cpp_constexpr_dynamic_alloc";
+  };
+};
+
+ftms = {
+  name = stdatomic_h;
+  values = {
+    v = 202011;
+    cxxmin = 23;
+  };
+};
+
+ftms = {
+  name = adaptor_iterator_pair_constructor;
+  values = {
+    v = 202106;
+    cxxmin = 23;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = ios_noreplace;
+  values = {
+    v = 202207;
+    cxxmin = 23;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = move_only_function;
+  values = {
+    v = 202110;
+    cxxmin = 23;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = spanstream;
+  values = {
+    v = 202106;
+    cxxmin = 23;
+    hosted = yes;
+    extra_cond = "__glibcxx_span";
+  };
+};
+
+ftms = {
+  name = stacktrace;
+  values = {
+    v = 202011;
+    cxxmin = 23;
+    hosted = yes;
+    extra_cond = "_GLIBCXX_HAVE_STACKTRACE";
+  };
+};
+
+ftms = {
+  name = string_contains;
+  values = {
+    v = 202011;
+    cxxmin = 23;
+    hosted = yes;
+  };
+};
+
+ftms = {
+  name = string_resize_and_overwrite;
+  values = {
+    v = 202110;
+    cxxmin = 23;
+    hosted = yes;
+    cxx11abi = yes;
+  };
+};
+
+// Standard test specifications.
+stds[97] = ">= 199711L";
+stds[03] = ">= 199711L";
+stds[11] = ">= 201103L";
+stds[14] = ">= 201402L";
+stds[17] = ">= 201703L";
+stds[20] = ">= 202002L";
+stds[23] = ">  202002L"; // TODO: update when finalized
+
+// Local Variables:
+// compile-command: "autogen version.def"
+// End:
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
new file mode 100644
index 00000000000..5c5e7ff3264
--- /dev/null
+++ b/libstdc++-v3/include/bits/version.h
@@ -0,0 +1,1942 @@
+// Copyright (C) 2023 Free Software Foundation, Inc.
+
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// DO NOT EDIT THIS FILE   (version.h)
+//
+// It has been AutoGen-ed
+// From the definitions    version.def
+// and the template file   version.tpl
+
+/** @file bits/version.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{version}
+ */
+
+// Usage guide:
+//
+// In your usual header, do something like:
+//
+//   #define __glibcxx_want_ranges
+//   #define __glibcxx_want_concepts
+//   #include <bits/version.h>
+//
+// This will generate the FTMs you named, and let you use them in your code as
+// if it was user code.  All macros are also exposed under __glibcxx_NAME even
+// if unwanted, to permit bits and other FTMs to depend on them for condtional
+// computation without exposing extra FTMs to user code.
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+// from version.def line 65
+#if !defined(__cpp_lib_incomplete_container_elements)
+# if _GLIBCXX_HOSTED
+#  define __glibcxx_incomplete_container_elements 201505L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_incomplete_container_elements)
+#   define __cpp_lib_incomplete_container_elements 201505L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_incomplete_container_elements) && defined(__glibcxx_want_incomplete_container_elements) */
+#undef __glibcxx_want_incomplete_container_elements
+
+// from version.def line 73
+#if !defined(__cpp_lib_uncaught_exceptions)
+# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 199711L))
+#  define __glibcxx_uncaught_exceptions 201411L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_uncaught_exceptions)
+#   define __cpp_lib_uncaught_exceptions 201411L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_uncaught_exceptions) && defined(__glibcxx_want_uncaught_exceptions) */
+#undef __glibcxx_want_uncaught_exceptions
+
+// from version.def line 82
+#if !defined(__cpp_lib_allocator_traits_is_always_equal)
+# if (__cplusplus >= 201103L)
+#  define __glibcxx_allocator_traits_is_always_equal 201411L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_allocator_traits_is_always_equal)
+#   define __cpp_lib_allocator_traits_is_always_equal 201411L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_allocator_traits_is_always_equal) && defined(__glibcxx_want_allocator_traits_is_always_equal) */
+#undef __glibcxx_want_allocator_traits_is_always_equal
+
+// from version.def line 90
+#if !defined(__cpp_lib_is_null_pointer)
+# if (__cplusplus >= 201103L)
+#  define __glibcxx_is_null_pointer 201309L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_null_pointer)
+#   define __cpp_lib_is_null_pointer 201309L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_null_pointer) && defined(__glibcxx_want_is_null_pointer) */
+#undef __glibcxx_want_is_null_pointer
+
+// from version.def line 98
+#if !defined(__cpp_lib_result_of_sfinae)
+# if (__cplusplus >= 201103L)
+#  define __glibcxx_result_of_sfinae 201210L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_result_of_sfinae)
+#   define __cpp_lib_result_of_sfinae 201210L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_result_of_sfinae) && defined(__glibcxx_want_result_of_sfinae) */
+#undef __glibcxx_want_result_of_sfinae
+
+// from version.def line 106
+#if !defined(__cpp_lib_shared_ptr_arrays)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_shared_ptr_arrays 201707L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_arrays)
+#   define __cpp_lib_shared_ptr_arrays 201707L
+#  endif
+# elif (__cplusplus >= 201103L) && _GLIBCXX_HOSTED
+#  define __glibcxx_shared_ptr_arrays 201611L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_arrays)
+#   define __cpp_lib_shared_ptr_arrays 201611L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_shared_ptr_arrays) && defined(__glibcxx_want_shared_ptr_arrays) */
+#undef __glibcxx_want_shared_ptr_arrays
+
+// from version.def line 120
+#if !defined(__cpp_lib_is_swappable)
+# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L))
+#  define __glibcxx_is_swappable 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_swappable)
+#   define __cpp_lib_is_swappable 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_swappable) && defined(__glibcxx_want_is_swappable) */
+#undef __glibcxx_want_is_swappable
+
+// from version.def line 129
+#if !defined(__cpp_lib_void_t)
+# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L))
+#  define __glibcxx_void_t 201411L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_void_t)
+#   define __cpp_lib_void_t 201411L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_void_t) && defined(__glibcxx_want_void_t) */
+#undef __glibcxx_want_void_t
+
+// from version.def line 138
+#if !defined(__cpp_lib_enable_shared_from_this)
+# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L)) && _GLIBCXX_HOSTED
+#  define __glibcxx_enable_shared_from_this 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_enable_shared_from_this)
+#   define __cpp_lib_enable_shared_from_this 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_enable_shared_from_this) && defined(__glibcxx_want_enable_shared_from_this) */
+#undef __glibcxx_want_enable_shared_from_this
+
+// from version.def line 148
+#if !defined(__cpp_lib_math_spec_funcs)
+# if (__cplusplus >= 201103L)
+#  define __glibcxx_math_spec_funcs 201003L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_spec_funcs)
+#   define __STDCPP_MATH_SPEC_FUNCS__ 201003L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_math_spec_funcs) && defined(__glibcxx_want_math_spec_funcs) */
+#undef __glibcxx_want_math_spec_funcs
+
+// from version.def line 157
+#if !defined(__cpp_lib_coroutine)
+# if (__cplusplus >= 201402L) && (__cpp_impl_coroutine)
+#  define __glibcxx_coroutine 201902L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_coroutine)
+#   define __cpp_lib_coroutine 201902L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_coroutine) && defined(__glibcxx_want_coroutine) */
+#undef __glibcxx_want_coroutine
+
+// from version.def line 168
+#if !defined(__cpp_lib_exchange_function)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_exchange_function 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_exchange_function)
+#   define __cpp_lib_exchange_function 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_exchange_function) && defined(__glibcxx_want_exchange_function) */
+#undef __glibcxx_want_exchange_function
+
+// from version.def line 176
+#if !defined(__cpp_lib_integer_sequence)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_integer_sequence 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_sequence)
+#   define __cpp_lib_integer_sequence 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_integer_sequence) && defined(__glibcxx_want_integer_sequence) */
+#undef __glibcxx_want_integer_sequence
+
+// from version.def line 184
+#if !defined(__cpp_lib_integral_constant_callable)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_integral_constant_callable 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_integral_constant_callable)
+#   define __cpp_lib_integral_constant_callable 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_integral_constant_callable) && defined(__glibcxx_want_integral_constant_callable) */
+#undef __glibcxx_want_integral_constant_callable
+
+// from version.def line 192
+#if !defined(__cpp_lib_is_final)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_is_final 201402L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_final)
+#   define __cpp_lib_is_final 201402L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_final) && defined(__glibcxx_want_is_final) */
+#undef __glibcxx_want_is_final
+
+// from version.def line 200
+#if !defined(__cpp_lib_make_reverse_iterator)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_make_reverse_iterator 201402L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_reverse_iterator)
+#   define __cpp_lib_make_reverse_iterator 201402L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_make_reverse_iterator) && defined(__glibcxx_want_make_reverse_iterator) */
+#undef __glibcxx_want_make_reverse_iterator
+
+// from version.def line 208
+#if !defined(__cpp_lib_null_iterators)
+# if (__cplusplus >= 201402L) && (!defined(_GLIBCXX_DEBUG))
+#  define __glibcxx_null_iterators 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_null_iterators)
+#   define __cpp_lib_null_iterators 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_null_iterators) && defined(__glibcxx_want_null_iterators) */
+#undef __glibcxx_want_null_iterators
+
+// from version.def line 217
+#if !defined(__cpp_lib_transformation_trait_aliases)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_transformation_trait_aliases 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_transformation_trait_aliases)
+#   define __cpp_lib_transformation_trait_aliases 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_transformation_trait_aliases) && defined(__glibcxx_want_transformation_trait_aliases) */
+#undef __glibcxx_want_transformation_trait_aliases
+
+// from version.def line 225
+#if !defined(__cpp_lib_transparent_operators)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_transparent_operators 201510L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_transparent_operators)
+#   define __cpp_lib_transparent_operators 201510L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_transparent_operators) && defined(__glibcxx_want_transparent_operators) */
+#undef __glibcxx_want_transparent_operators
+
+// from version.def line 233
+#if !defined(__cpp_lib_tuple_element_t)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_tuple_element_t 201402L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_element_t)
+#   define __cpp_lib_tuple_element_t 201402L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_tuple_element_t) && defined(__glibcxx_want_tuple_element_t) */
+#undef __glibcxx_want_tuple_element_t
+
+// from version.def line 241
+#if !defined(__cpp_lib_tuples_by_type)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_tuples_by_type 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuples_by_type)
+#   define __cpp_lib_tuples_by_type 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_tuples_by_type) && defined(__glibcxx_want_tuples_by_type) */
+#undef __glibcxx_want_tuples_by_type
+
+// from version.def line 249
+#if !defined(__cpp_lib_robust_nonmodifying_seq_ops)
+# if (__cplusplus >= 201402L)
+#  define __glibcxx_robust_nonmodifying_seq_ops 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_robust_nonmodifying_seq_ops)
+#   define __cpp_lib_robust_nonmodifying_seq_ops 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_robust_nonmodifying_seq_ops) && defined(__glibcxx_want_robust_nonmodifying_seq_ops) */
+#undef __glibcxx_want_robust_nonmodifying_seq_ops
+
+// from version.def line 257
+#if !defined(__cpp_lib_to_chars)
+# if (__cplusplus >= 201402L) && (_GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && __SIZE_WIDTH__ >= 32)
+#  define __glibcxx_to_chars 201611L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_chars)
+#   define __cpp_lib_to_chars 201611L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_to_chars) && defined(__glibcxx_want_to_chars) */
+#undef __glibcxx_want_to_chars
+
+// from version.def line 268
+#if !defined(__cpp_lib_chrono_udls)
+# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED
+#  define __glibcxx_chrono_udls 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono_udls)
+#   define __cpp_lib_chrono_udls 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_chrono_udls) && defined(__glibcxx_want_chrono_udls) */
+#undef __glibcxx_want_chrono_udls
+
+// from version.def line 277
+#if !defined(__cpp_lib_complex_udls)
+# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED
+#  define __glibcxx_complex_udls 201309L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_complex_udls)
+#   define __cpp_lib_complex_udls 201309L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_complex_udls) && defined(__glibcxx_want_complex_udls) */
+#undef __glibcxx_want_complex_udls
+
+// from version.def line 286
+#if !defined(__cpp_lib_generic_associative_lookup)
+# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED
+#  define __glibcxx_generic_associative_lookup 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_generic_associative_lookup)
+#   define __cpp_lib_generic_associative_lookup 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_generic_associative_lookup) && defined(__glibcxx_want_generic_associative_lookup) */
+#undef __glibcxx_want_generic_associative_lookup
+
+// from version.def line 295
+#if !defined(__cpp_lib_make_unique)
+# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED
+#  define __glibcxx_make_unique 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_unique)
+#   define __cpp_lib_make_unique 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_make_unique) && defined(__glibcxx_want_make_unique) */
+#undef __glibcxx_want_make_unique
+
+// from version.def line 304
+#if !defined(__cpp_lib_quoted_string_io)
+# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED
+#  define __glibcxx_quoted_string_io 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_quoted_string_io)
+#   define __cpp_lib_quoted_string_io 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_quoted_string_io) && defined(__glibcxx_want_quoted_string_io) */
+#undef __glibcxx_want_quoted_string_io
+
+// from version.def line 313
+#if !defined(__cpp_lib_shared_timed_mutex)
+# if (__cplusplus >= 201402L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+#  define __glibcxx_shared_timed_mutex 201402L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_timed_mutex)
+#   define __cpp_lib_shared_timed_mutex 201402L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_shared_timed_mutex) && defined(__glibcxx_want_shared_timed_mutex) */
+#undef __glibcxx_want_shared_timed_mutex
+
+// from version.def line 323
+#if !defined(__cpp_lib_string_udls)
+# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED
+#  define __glibcxx_string_udls 201304L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_udls)
+#   define __cpp_lib_string_udls 201304L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_string_udls) && defined(__glibcxx_want_string_udls) */
+#undef __glibcxx_want_string_udls
+
+// from version.def line 332
+#if !defined(__cpp_lib_addressof_constexpr)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_addressof_constexpr 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_addressof_constexpr)
+#   define __cpp_lib_addressof_constexpr 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_addressof_constexpr) && defined(__glibcxx_want_addressof_constexpr) */
+#undef __glibcxx_want_addressof_constexpr
+
+// from version.def line 342
+#if !defined(__cpp_lib_any)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_any 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_any)
+#   define __cpp_lib_any 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_any) && defined(__glibcxx_want_any) */
+#undef __glibcxx_want_any
+
+// from version.def line 350
+#if !defined(__cpp_lib_apply)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_apply 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_apply)
+#   define __cpp_lib_apply 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_apply) && defined(__glibcxx_want_apply) */
+#undef __glibcxx_want_apply
+
+// from version.def line 358
+#if !defined(__cpp_lib_as_const)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_as_const 201510L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_as_const)
+#   define __cpp_lib_as_const 201510L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_as_const) && defined(__glibcxx_want_as_const) */
+#undef __glibcxx_want_as_const
+
+// from version.def line 366
+#if !defined(__cpp_lib_atomic_is_always_lock_free)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_atomic_is_always_lock_free 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_is_always_lock_free)
+#   define __cpp_lib_atomic_is_always_lock_free 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_is_always_lock_free) && defined(__glibcxx_want_atomic_is_always_lock_free) */
+#undef __glibcxx_want_atomic_is_always_lock_free
+
+// from version.def line 374
+#if !defined(__cpp_lib_bool_constant)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_bool_constant 201505L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_bool_constant)
+#   define __cpp_lib_bool_constant 201505L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_bool_constant) && defined(__glibcxx_want_bool_constant) */
+#undef __glibcxx_want_bool_constant
+
+// from version.def line 382
+#if !defined(__cpp_lib_byte)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_byte 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_byte)
+#   define __cpp_lib_byte 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_byte) && defined(__glibcxx_want_byte) */
+#undef __glibcxx_want_byte
+
+// from version.def line 390
+#if !defined(__cpp_lib_has_unique_object_representations)
+# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP))
+#  define __glibcxx_has_unique_object_representations 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_has_unique_object_representations)
+#   define __cpp_lib_has_unique_object_representations 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_has_unique_object_representations) && defined(__glibcxx_want_has_unique_object_representations) */
+#undef __glibcxx_want_has_unique_object_representations
+
+// from version.def line 399
+#if !defined(__cpp_lib_hardware_interference_size)
+# if (__cplusplus >= 201703L) && (defined(__GCC_DESTRUCTIVE_SIZE))
+#  define __glibcxx_hardware_interference_size 201703L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_hardware_interference_size)
+#   define __cpp_lib_hardware_interference_size 201703L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_hardware_interference_size) && defined(__glibcxx_want_hardware_interference_size) */
+#undef __glibcxx_want_hardware_interference_size
+
+// from version.def line 408
+#if !defined(__cpp_lib_invoke)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_invoke 201411L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_invoke)
+#   define __cpp_lib_invoke 201411L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_invoke) && defined(__glibcxx_want_invoke) */
+#undef __glibcxx_want_invoke
+
+// from version.def line 416
+#if !defined(__cpp_lib_is_aggregate)
+# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE))
+#  define __glibcxx_is_aggregate 201703L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_aggregate)
+#   define __cpp_lib_is_aggregate 201703L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_aggregate) && defined(__glibcxx_want_is_aggregate) */
+#undef __glibcxx_want_is_aggregate
+
+// from version.def line 425
+#if !defined(__cpp_lib_is_invocable)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_is_invocable 201703L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_invocable)
+#   define __cpp_lib_is_invocable 201703L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_invocable) && defined(__glibcxx_want_is_invocable) */
+#undef __glibcxx_want_is_invocable
+
+// from version.def line 433
+#if !defined(__cpp_lib_launder)
+# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER))
+#  define __glibcxx_launder 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_launder)
+#   define __cpp_lib_launder 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_launder) && defined(__glibcxx_want_launder) */
+#undef __glibcxx_want_launder
+
+// from version.def line 442
+#if !defined(__cpp_lib_logical_traits)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_logical_traits 201510L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_logical_traits)
+#   define __cpp_lib_logical_traits 201510L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_logical_traits) && defined(__glibcxx_want_logical_traits) */
+#undef __glibcxx_want_logical_traits
+
+// from version.def line 450
+#if !defined(__cpp_lib_make_from_tuple)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_make_from_tuple 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_from_tuple)
+#   define __cpp_lib_make_from_tuple 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_make_from_tuple) && defined(__glibcxx_want_make_from_tuple) */
+#undef __glibcxx_want_make_from_tuple
+
+// from version.def line 458
+#if !defined(__cpp_lib_not_fn)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_not_fn 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_not_fn)
+#   define __cpp_lib_not_fn 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_not_fn) && defined(__glibcxx_want_not_fn) */
+#undef __glibcxx_want_not_fn
+
+// from version.def line 466
+#if !defined(__cpp_lib_type_trait_variable_templates)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_type_trait_variable_templates 201510L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_type_trait_variable_templates)
+#   define __cpp_lib_type_trait_variable_templates 201510L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_type_trait_variable_templates) && defined(__glibcxx_want_type_trait_variable_templates) */
+#undef __glibcxx_want_type_trait_variable_templates
+
+// from version.def line 474
+#if !defined(__cpp_lib_variant)
+# if (__cplusplus >= 202002L) && (__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L)
+#  define __glibcxx_variant 202106L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant)
+#   define __cpp_lib_variant 202106L
+#  endif
+# elif (__cplusplus >= 201703L)
+#  define __glibcxx_variant 202102L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant)
+#   define __cpp_lib_variant 202102L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_variant) && defined(__glibcxx_want_variant) */
+#undef __glibcxx_want_variant
+
+// from version.def line 488
+#if !defined(__cpp_lib_lcm)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_lcm 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_lcm)
+#   define __cpp_lib_lcm 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_lcm) && defined(__glibcxx_want_lcm) */
+#undef __glibcxx_want_lcm
+
+// from version.def line 497
+#if !defined(__cpp_lib_gcd)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_gcd 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_gcd)
+#   define __cpp_lib_gcd 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_gcd) && defined(__glibcxx_want_gcd) */
+#undef __glibcxx_want_gcd
+
+// from version.def line 505
+#if !defined(__cpp_lib_gcd_lcm)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_gcd_lcm 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_gcd_lcm)
+#   define __cpp_lib_gcd_lcm 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_gcd_lcm) && defined(__glibcxx_want_gcd_lcm) */
+#undef __glibcxx_want_gcd_lcm
+
+// from version.def line 513
+#if !defined(__cpp_lib_raw_memory_algorithms)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_raw_memory_algorithms 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_raw_memory_algorithms)
+#   define __cpp_lib_raw_memory_algorithms 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_raw_memory_algorithms) && defined(__glibcxx_want_raw_memory_algorithms) */
+#undef __glibcxx_want_raw_memory_algorithms
+
+// from version.def line 521
+#if !defined(__cpp_lib_array_constexpr)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_array_constexpr 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_array_constexpr)
+#   define __cpp_lib_array_constexpr 201811L
+#  endif
+# elif (__cplusplus >= 201703L)
+#  define __glibcxx_array_constexpr 201803L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_array_constexpr)
+#   define __cpp_lib_array_constexpr 201803L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_array_constexpr) && defined(__glibcxx_want_array_constexpr) */
+#undef __glibcxx_want_array_constexpr
+
+// from version.def line 533
+#if !defined(__cpp_lib_nonmember_container_access)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_nonmember_container_access 201411L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_nonmember_container_access)
+#   define __cpp_lib_nonmember_container_access 201411L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_nonmember_container_access) && defined(__glibcxx_want_nonmember_container_access) */
+#undef __glibcxx_want_nonmember_container_access
+
+// from version.def line 541
+#if !defined(__cpp_lib_clamp)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_clamp 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_clamp)
+#   define __cpp_lib_clamp 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_clamp) && defined(__glibcxx_want_clamp) */
+#undef __glibcxx_want_clamp
+
+// from version.def line 549
+#if !defined(__cpp_lib_sample)
+# if (__cplusplus >= 201703L)
+#  define __glibcxx_sample 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_sample)
+#   define __cpp_lib_sample 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_sample) && defined(__glibcxx_want_sample) */
+#undef __glibcxx_want_sample
+
+// from version.def line 557
+#if !defined(__cpp_lib_boyer_moore_searcher)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_boyer_moore_searcher 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_boyer_moore_searcher)
+#   define __cpp_lib_boyer_moore_searcher 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_boyer_moore_searcher) && defined(__glibcxx_want_boyer_moore_searcher) */
+#undef __glibcxx_want_boyer_moore_searcher
+
+// from version.def line 566
+#if !defined(__cpp_lib_chrono)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_chrono 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono)
+#   define __cpp_lib_chrono 201907L
+#  endif
+# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_chrono 201611L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono)
+#   define __cpp_lib_chrono 201611L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_chrono) && defined(__glibcxx_want_chrono) */
+#undef __glibcxx_want_chrono
+
+// from version.def line 580
+#if !defined(__cpp_lib_execution)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_execution 201902L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_execution)
+#   define __cpp_lib_execution 201902L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_execution) && defined(__glibcxx_want_execution) */
+#undef __glibcxx_want_execution
+
+// from version.def line 589
+#if !defined(__cpp_lib_filesystem)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_filesystem 201703L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_filesystem)
+#   define __cpp_lib_filesystem 201703L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_filesystem) && defined(__glibcxx_want_filesystem) */
+#undef __glibcxx_want_filesystem
+
+// from version.def line 598
+#if !defined(__cpp_lib_hypot)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_hypot 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_hypot)
+#   define __cpp_lib_hypot 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_hypot) && defined(__glibcxx_want_hypot) */
+#undef __glibcxx_want_hypot
+
+// from version.def line 607
+#if !defined(__cpp_lib_map_try_emplace)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_map_try_emplace 201411L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_map_try_emplace)
+#   define __cpp_lib_map_try_emplace 201411L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_map_try_emplace) && defined(__glibcxx_want_map_try_emplace) */
+#undef __glibcxx_want_map_try_emplace
+
+// from version.def line 616
+#if !defined(__cpp_lib_math_special_functions)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_math_special_functions 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_special_functions)
+#   define __cpp_lib_math_special_functions 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_math_special_functions) && defined(__glibcxx_want_math_special_functions) */
+#undef __glibcxx_want_math_special_functions
+
+// from version.def line 625
+#if !defined(__cpp_lib_memory_resource)
+# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+#  define __glibcxx_memory_resource 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_memory_resource)
+#   define __cpp_lib_memory_resource 201603L
+#  endif
+# elif (__cplusplus >= 201703L) && !defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+#  define __glibcxx_memory_resource 1L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_memory_resource)
+#   define __cpp_lib_memory_resource 1L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_memory_resource) && defined(__glibcxx_want_memory_resource) */
+#undef __glibcxx_want_memory_resource
+
+// from version.def line 642
+#if !defined(__cpp_lib_node_extract)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_node_extract 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_node_extract)
+#   define __cpp_lib_node_extract 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_node_extract) && defined(__glibcxx_want_node_extract) */
+#undef __glibcxx_want_node_extract
+
+// from version.def line 651
+#if !defined(__cpp_lib_parallel_algorithm)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_parallel_algorithm 201603L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_parallel_algorithm)
+#   define __cpp_lib_parallel_algorithm 201603L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_parallel_algorithm) && defined(__glibcxx_want_parallel_algorithm) */
+#undef __glibcxx_want_parallel_algorithm
+
+// from version.def line 660
+#if !defined(__cpp_lib_scoped_lock)
+# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+#  define __glibcxx_scoped_lock 201703L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_scoped_lock)
+#   define __cpp_lib_scoped_lock 201703L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_scoped_lock) && defined(__glibcxx_want_scoped_lock) */
+#undef __glibcxx_want_scoped_lock
+
+// from version.def line 670
+#if !defined(__cpp_lib_shared_mutex)
+# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+#  define __glibcxx_shared_mutex 201505L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_mutex)
+#   define __cpp_lib_shared_mutex 201505L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_shared_mutex) && defined(__glibcxx_want_shared_mutex) */
+#undef __glibcxx_want_shared_mutex
+
+// from version.def line 680
+#if !defined(__cpp_lib_shared_ptr_weak_type)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_shared_ptr_weak_type 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_weak_type)
+#   define __cpp_lib_shared_ptr_weak_type 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_shared_ptr_weak_type) && defined(__glibcxx_want_shared_ptr_weak_type) */
+#undef __glibcxx_want_shared_ptr_weak_type
+
+// from version.def line 689
+#if !defined(__cpp_lib_string_view)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_string_view 201803L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_view)
+#   define __cpp_lib_string_view 201803L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_string_view) && defined(__glibcxx_want_string_view) */
+#undef __glibcxx_want_string_view
+
+// from version.def line 698
+#if !defined(__cpp_lib_unordered_map_try_emplace)
+# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED
+#  define __glibcxx_unordered_map_try_emplace 201411L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_unordered_map_try_emplace)
+#   define __cpp_lib_unordered_map_try_emplace 201411L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_unordered_map_try_emplace) && defined(__glibcxx_want_unordered_map_try_emplace) */
+#undef __glibcxx_want_unordered_map_try_emplace
+
+// from version.def line 707
+#if !defined(__cpp_lib_assume_aligned)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_assume_aligned 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_assume_aligned)
+#   define __cpp_lib_assume_aligned 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_assume_aligned) && defined(__glibcxx_want_assume_aligned) */
+#undef __glibcxx_want_assume_aligned
+
+// from version.def line 715
+#if !defined(__cpp_lib_atomic_flag_test)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_atomic_flag_test 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_flag_test)
+#   define __cpp_lib_atomic_flag_test 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_flag_test) && defined(__glibcxx_want_atomic_flag_test) */
+#undef __glibcxx_want_atomic_flag_test
+
+// from version.def line 723
+#if !defined(__cpp_lib_atomic_float)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_atomic_float 201711L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_float)
+#   define __cpp_lib_atomic_float 201711L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_float) && defined(__glibcxx_want_atomic_float) */
+#undef __glibcxx_want_atomic_float
+
+// from version.def line 731
+#if !defined(__cpp_lib_atomic_lock_free_type_aliases)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_atomic_lock_free_type_aliases 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_lock_free_type_aliases)
+#   define __cpp_lib_atomic_lock_free_type_aliases 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_lock_free_type_aliases) && defined(__glibcxx_want_atomic_lock_free_type_aliases) */
+#undef __glibcxx_want_atomic_lock_free_type_aliases
+
+// from version.def line 739
+#if !defined(__cpp_lib_atomic_ref)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_atomic_ref 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_ref)
+#   define __cpp_lib_atomic_ref 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_ref) && defined(__glibcxx_want_atomic_ref) */
+#undef __glibcxx_want_atomic_ref
+
+// from version.def line 747
+#if !defined(__cpp_lib_atomic_value_initialization)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_atomic_value_initialization 201911L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_value_initialization)
+#   define __cpp_lib_atomic_value_initialization 201911L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_value_initialization) && defined(__glibcxx_want_atomic_value_initialization) */
+#undef __glibcxx_want_atomic_value_initialization
+
+// from version.def line 755
+#if !defined(__cpp_lib_bind_front)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_bind_front 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_bind_front)
+#   define __cpp_lib_bind_front 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_bind_front) && defined(__glibcxx_want_bind_front) */
+#undef __glibcxx_want_bind_front
+
+// from version.def line 763
+#if !defined(__cpp_lib_starts_ends_with)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_starts_ends_with 201711L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_starts_ends_with)
+#   define __cpp_lib_starts_ends_with 201711L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_starts_ends_with) && defined(__glibcxx_want_starts_ends_with) */
+#undef __glibcxx_want_starts_ends_with
+
+// from version.def line 771
+#if !defined(__cpp_lib_bit_cast)
+# if (__cplusplus >= 202002L) && (__has_builtin(__builtin_bit_cast))
+#  define __glibcxx_bit_cast 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_bit_cast)
+#   define __cpp_lib_bit_cast 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_bit_cast) && defined(__glibcxx_want_bit_cast) */
+#undef __glibcxx_want_bit_cast
+
+// from version.def line 780
+#if !defined(__cpp_lib_bitops)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_bitops 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_bitops)
+#   define __cpp_lib_bitops 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_bitops) && defined(__glibcxx_want_bitops) */
+#undef __glibcxx_want_bitops
+
+// from version.def line 788
+#if !defined(__cpp_lib_bounded_array_traits)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_bounded_array_traits 201902L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_bounded_array_traits)
+#   define __cpp_lib_bounded_array_traits 201902L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_bounded_array_traits) && defined(__glibcxx_want_bounded_array_traits) */
+#undef __glibcxx_want_bounded_array_traits
+
+// from version.def line 796
+#if !defined(__cpp_lib_concepts)
+# if (__cplusplus >= 202002L) && (__cpp_concepts >= 201907L)
+#  define __glibcxx_concepts 202002L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_concepts)
+#   define __cpp_lib_concepts 202002L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_concepts) && defined(__glibcxx_want_concepts) */
+#undef __glibcxx_want_concepts
+
+// from version.def line 806
+#if !defined(__cpp_lib_optional)
+# if (__cplusplus >  202002L) && (__glibcxx_concepts)
+#  define __glibcxx_optional 202110L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional)
+#   define __cpp_lib_optional 202110L
+#  endif
+# elif (__cplusplus >= 202002L)
+#  define __glibcxx_optional 202106L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional)
+#   define __cpp_lib_optional 202106L
+#  endif
+# elif (__cplusplus >= 201703L)
+#  define __glibcxx_optional 201606L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional)
+#   define __cpp_lib_optional 201606L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_optional) && defined(__glibcxx_want_optional) */
+#undef __glibcxx_want_optional
+
+// from version.def line 823
+#if !defined(__cpp_lib_destroying_delete)
+# if (__cplusplus >= 202002L) && (__cpp_impl_destroying_delete)
+#  define __glibcxx_destroying_delete 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_destroying_delete)
+#   define __cpp_lib_destroying_delete 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_destroying_delete) && defined(__glibcxx_want_destroying_delete) */
+#undef __glibcxx_want_destroying_delete
+
+// from version.def line 832
+#if !defined(__cpp_lib_constexpr_string_view)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_string_view 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string_view)
+#   define __cpp_lib_constexpr_string_view 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_string_view) && defined(__glibcxx_want_constexpr_string_view) */
+#undef __glibcxx_want_constexpr_string_view
+
+// from version.def line 840
+#if !defined(__cpp_lib_endian)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_endian 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_endian)
+#   define __cpp_lib_endian 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_endian) && defined(__glibcxx_want_endian) */
+#undef __glibcxx_want_endian
+
+// from version.def line 848
+#if !defined(__cpp_lib_int_pow2)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_int_pow2 202002L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_int_pow2)
+#   define __cpp_lib_int_pow2 202002L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_int_pow2) && defined(__glibcxx_want_int_pow2) */
+#undef __glibcxx_want_int_pow2
+
+// from version.def line 856
+#if !defined(__cpp_lib_integer_comparison_functions)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_integer_comparison_functions 202002L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_comparison_functions)
+#   define __cpp_lib_integer_comparison_functions 202002L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_integer_comparison_functions) && defined(__glibcxx_want_integer_comparison_functions) */
+#undef __glibcxx_want_integer_comparison_functions
+
+// from version.def line 864
+#if !defined(__cpp_lib_is_constant_evaluated)
+# if (__cplusplus >= 202002L) && (defined(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED))
+#  define __glibcxx_is_constant_evaluated 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_constant_evaluated)
+#   define __cpp_lib_is_constant_evaluated 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_constant_evaluated) && defined(__glibcxx_want_is_constant_evaluated) */
+#undef __glibcxx_want_is_constant_evaluated
+
+// from version.def line 874
+#if !defined(__cpp_lib_constexpr_char_traits)
+# if (__cplusplus >= 202002L) && (defined(__glibcxx_is_constant_evaluated))
+#  define __glibcxx_constexpr_char_traits 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_char_traits)
+#   define __cpp_lib_constexpr_char_traits 201811L
+#  endif
+# elif (__cplusplus >= 201703L) && (_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)
+#  define __glibcxx_constexpr_char_traits 201611L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_char_traits)
+#   define __cpp_lib_constexpr_char_traits 201611L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_char_traits) && defined(__glibcxx_want_constexpr_char_traits) */
+#undef __glibcxx_want_constexpr_char_traits
+
+// from version.def line 890
+#if !defined(__cpp_lib_is_layout_compatible)
+# if (__cplusplus >= 202002L) && (__has_builtin(__is_layout_compatible) && __has_builtin(__builtin_is_corresponding_member))
+#  define __glibcxx_is_layout_compatible 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_layout_compatible)
+#   define __cpp_lib_is_layout_compatible 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_layout_compatible) && defined(__glibcxx_want_is_layout_compatible) */
+#undef __glibcxx_want_is_layout_compatible
+
+// from version.def line 900
+#if !defined(__cpp_lib_is_nothrow_convertible)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_is_nothrow_convertible 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_nothrow_convertible)
+#   define __cpp_lib_is_nothrow_convertible 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_nothrow_convertible) && defined(__glibcxx_want_is_nothrow_convertible) */
+#undef __glibcxx_want_is_nothrow_convertible
+
+// from version.def line 908
+#if !defined(__cpp_lib_is_pointer_interconvertible)
+# if (__cplusplus >= 202002L) && (__has_builtin(__is_pointer_interconvertible_base_of) && __has_builtin(__builtin_is_pointer_interconvertible_with_class))
+#  define __glibcxx_is_pointer_interconvertible 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_pointer_interconvertible)
+#   define __cpp_lib_is_pointer_interconvertible 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_pointer_interconvertible) && defined(__glibcxx_want_is_pointer_interconvertible) */
+#undef __glibcxx_want_is_pointer_interconvertible
+
+// from version.def line 919
+#if !defined(__cpp_lib_math_constants)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_math_constants 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_constants)
+#   define __cpp_lib_math_constants 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_math_constants) && defined(__glibcxx_want_math_constants) */
+#undef __glibcxx_want_math_constants
+
+// from version.def line 927
+#if !defined(__cpp_lib_make_obj_using_allocator)
+# if (__cplusplus >= 202002L) && (__cpp_concepts)
+#  define __glibcxx_make_obj_using_allocator 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_obj_using_allocator)
+#   define __cpp_lib_make_obj_using_allocator 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_make_obj_using_allocator) && defined(__glibcxx_want_make_obj_using_allocator) */
+#undef __glibcxx_want_make_obj_using_allocator
+
+// from version.def line 937
+#if !defined(__cpp_lib_remove_cvref)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_remove_cvref 201711L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_remove_cvref)
+#   define __cpp_lib_remove_cvref 201711L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_remove_cvref) && defined(__glibcxx_want_remove_cvref) */
+#undef __glibcxx_want_remove_cvref
+
+// from version.def line 945
+#if !defined(__cpp_lib_source_location)
+# if (__cplusplus >= 202002L) && (__has_builtin(__builtin_source_location))
+#  define __glibcxx_source_location 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_source_location)
+#   define __cpp_lib_source_location 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_source_location) && defined(__glibcxx_want_source_location) */
+#undef __glibcxx_want_source_location
+
+// from version.def line 954
+#if !defined(__cpp_lib_span)
+# if (__cplusplus >= 202002L) && (__glibcxx_concepts)
+#  define __glibcxx_span 202002L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_span)
+#   define __cpp_lib_span 202002L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_span) && defined(__glibcxx_want_span) */
+#undef __glibcxx_want_span
+
+// from version.def line 963
+#if !defined(__cpp_lib_ssize)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_ssize 201902L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ssize)
+#   define __cpp_lib_ssize 201902L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ssize) && defined(__glibcxx_want_ssize) */
+#undef __glibcxx_want_ssize
+
+// from version.def line 971
+#if !defined(__cpp_lib_three_way_comparison)
+# if (__cplusplus >= 202002L) && (__cpp_impl_three_way_comparison >= 201907L && __glibcxx_concepts)
+#  define __glibcxx_three_way_comparison 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_three_way_comparison)
+#   define __cpp_lib_three_way_comparison 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_three_way_comparison) && defined(__glibcxx_want_three_way_comparison) */
+#undef __glibcxx_want_three_way_comparison
+
+// from version.def line 981
+#if !defined(__cpp_lib_to_address)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_to_address 201711L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_address)
+#   define __cpp_lib_to_address 201711L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_to_address) && defined(__glibcxx_want_to_address) */
+#undef __glibcxx_want_to_address
+
+// from version.def line 989
+#if !defined(__cpp_lib_to_array)
+# if (__cplusplus >= 202002L) && (__cpp_generic_lambdas >= 201707L)
+#  define __glibcxx_to_array 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_array)
+#   define __cpp_lib_to_array 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_to_array) && defined(__glibcxx_want_to_array) */
+#undef __glibcxx_want_to_array
+
+// from version.def line 998
+#if !defined(__cpp_lib_type_identity)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_type_identity 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_type_identity)
+#   define __cpp_lib_type_identity 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_type_identity) && defined(__glibcxx_want_type_identity) */
+#undef __glibcxx_want_type_identity
+
+// from version.def line 1006
+#if !defined(__cpp_lib_unwrap_ref)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_unwrap_ref 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_unwrap_ref)
+#   define __cpp_lib_unwrap_ref 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_unwrap_ref) && defined(__glibcxx_want_unwrap_ref) */
+#undef __glibcxx_want_unwrap_ref
+
+// from version.def line 1014
+#if !defined(__cpp_lib_constexpr_iterator)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_iterator 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_iterator)
+#   define __cpp_lib_constexpr_iterator 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_iterator) && defined(__glibcxx_want_constexpr_iterator) */
+#undef __glibcxx_want_constexpr_iterator
+
+// from version.def line 1022
+#if !defined(__cpp_lib_interpolate)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_interpolate 201902L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_interpolate)
+#   define __cpp_lib_interpolate 201902L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_interpolate) && defined(__glibcxx_want_interpolate) */
+#undef __glibcxx_want_interpolate
+
+// from version.def line 1030
+#if !defined(__cpp_lib_constexpr_utility)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_utility 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_utility)
+#   define __cpp_lib_constexpr_utility 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_utility) && defined(__glibcxx_want_constexpr_utility) */
+#undef __glibcxx_want_constexpr_utility
+
+// from version.def line 1038
+#if !defined(__cpp_lib_shift)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_shift 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_shift)
+#   define __cpp_lib_shift 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_shift) && defined(__glibcxx_want_shift) */
+#undef __glibcxx_want_shift
+
+// from version.def line 1046
+#if !defined(__cpp_lib_ranges)
+# if (__cplusplus >  202002L) && (__glibcxx_concepts)
+#  define __glibcxx_ranges 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges)
+#   define __cpp_lib_ranges 202202L
+#  endif
+# elif (__cplusplus >= 202002L) && (__glibcxx_concepts)
+#  define __glibcxx_ranges 202110L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges)
+#   define __cpp_lib_ranges 202110L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges) && defined(__glibcxx_want_ranges) */
+#undef __glibcxx_want_ranges
+
+// from version.def line 1060
+#if !defined(__cpp_lib_constexpr_numeric)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_numeric 201911L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_numeric)
+#   define __cpp_lib_constexpr_numeric 201911L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_numeric) && defined(__glibcxx_want_constexpr_numeric) */
+#undef __glibcxx_want_constexpr_numeric
+
+// from version.def line 1068
+#if !defined(__cpp_lib_constexpr_functional)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_functional 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_functional)
+#   define __cpp_lib_constexpr_functional 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_functional) && defined(__glibcxx_want_constexpr_functional) */
+#undef __glibcxx_want_constexpr_functional
+
+// from version.def line 1076
+#if !defined(__cpp_lib_constexpr_algorithms)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_algorithms 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_algorithms)
+#   define __cpp_lib_constexpr_algorithms 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_algorithms) && defined(__glibcxx_want_constexpr_algorithms) */
+#undef __glibcxx_want_constexpr_algorithms
+
+// from version.def line 1084
+#if !defined(__cpp_lib_constexpr_tuple)
+# if (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_tuple 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_tuple)
+#   define __cpp_lib_constexpr_tuple 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_tuple) && defined(__glibcxx_want_constexpr_tuple) */
+#undef __glibcxx_want_constexpr_tuple
+
+// from version.def line 1092
+#if !defined(__cpp_lib_constexpr_memory)
+# if (__cplusplus >  202002L) && (__cpp_constexpr_dynamic_alloc)
+#  define __glibcxx_constexpr_memory 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_memory)
+#   define __cpp_lib_constexpr_memory 202202L
+#  endif
+# elif (__cplusplus >= 202002L)
+#  define __glibcxx_constexpr_memory 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_memory)
+#   define __cpp_lib_constexpr_memory 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_memory) && defined(__glibcxx_want_constexpr_memory) */
+#undef __glibcxx_want_constexpr_memory
+
+// from version.def line 1105
+#if !defined(__cpp_lib_atomic_shared_ptr)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_atomic_shared_ptr 201711L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_shared_ptr)
+#   define __cpp_lib_atomic_shared_ptr 201711L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_shared_ptr) && defined(__glibcxx_want_atomic_shared_ptr) */
+#undef __glibcxx_want_atomic_shared_ptr
+
+// from version.def line 1114
+#if !defined(__cpp_lib_atomic_wait)
+# if (__cplusplus >= 202002L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+#  define __glibcxx_atomic_wait 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_wait)
+#   define __cpp_lib_atomic_wait 201907L
+#  endif
+# elif (__cplusplus >= 202002L) && !defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED && (defined(_GLIBCXX_HAVE_LINUX_FUTEX))
+#  define __glibcxx_atomic_wait 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_wait)
+#   define __cpp_lib_atomic_wait 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_atomic_wait) && defined(__glibcxx_want_atomic_wait) */
+#undef __glibcxx_want_atomic_wait
+
+// from version.def line 1132
+#if !defined(__cpp_lib_barrier)
+# if (__cplusplus >= 202002L) && (__cpp_aligned_new && __glibcxx_atomic_wait)
+#  define __glibcxx_barrier 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_barrier)
+#   define __cpp_lib_barrier 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_barrier) && defined(__glibcxx_want_barrier) */
+#undef __glibcxx_want_barrier
+
+// from version.def line 1149
+#if !defined(__cpp_lib_format)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_format 202106L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_format)
+#   define __cpp_lib_format 202106L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_format) && defined(__glibcxx_want_format) */
+#undef __glibcxx_want_format
+
+// from version.def line 1162
+#if !defined(__cpp_lib_constexpr_complex)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_constexpr_complex 201711L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_complex)
+#   define __cpp_lib_constexpr_complex 201711L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_complex) && defined(__glibcxx_want_constexpr_complex) */
+#undef __glibcxx_want_constexpr_complex
+
+// from version.def line 1171
+#if !defined(__cpp_lib_constexpr_dynamic_alloc)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_constexpr_dynamic_alloc 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_dynamic_alloc)
+#   define __cpp_lib_constexpr_dynamic_alloc 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_dynamic_alloc) && defined(__glibcxx_want_constexpr_dynamic_alloc) */
+#undef __glibcxx_want_constexpr_dynamic_alloc
+
+// from version.def line 1180
+#if !defined(__cpp_lib_constexpr_string)
+# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED && (defined(__glibcxx_is_constant_evaluated))
+#  define __glibcxx_constexpr_string 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string)
+#   define __cpp_lib_constexpr_string 201907L
+#  endif
+# elif (__cplusplus >= 202002L) && !_GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED && (defined(__glibcxx_is_constant_evaluated))
+#  define __glibcxx_constexpr_string 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string)
+#   define __cpp_lib_constexpr_string 201811L
+#  endif
+# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED && (_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)
+#  define __glibcxx_constexpr_string 201611L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string)
+#   define __cpp_lib_constexpr_string 201611L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_string) && defined(__glibcxx_want_constexpr_string) */
+#undef __glibcxx_want_constexpr_string
+
+// from version.def line 1204
+#if !defined(__cpp_lib_constexpr_vector)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_constexpr_vector 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_vector)
+#   define __cpp_lib_constexpr_vector 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_vector) && defined(__glibcxx_want_constexpr_vector) */
+#undef __glibcxx_want_constexpr_vector
+
+// from version.def line 1213
+#if !defined(__cpp_lib_erase_if)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_erase_if 202002L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_erase_if)
+#   define __cpp_lib_erase_if 202002L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_erase_if) && defined(__glibcxx_want_erase_if) */
+#undef __glibcxx_want_erase_if
+
+// from version.def line 1222
+#if !defined(__cpp_lib_generic_unordered_lookup)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_generic_unordered_lookup 201811L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_generic_unordered_lookup)
+#   define __cpp_lib_generic_unordered_lookup 201811L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_generic_unordered_lookup) && defined(__glibcxx_want_generic_unordered_lookup) */
+#undef __glibcxx_want_generic_unordered_lookup
+
+// from version.def line 1231
+#if !defined(__cpp_lib_jthread)
+# if (__cplusplus >= 202002L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+#  define __glibcxx_jthread 201911L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_jthread)
+#   define __cpp_lib_jthread 201911L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_jthread) && defined(__glibcxx_want_jthread) */
+#undef __glibcxx_want_jthread
+
+// from version.def line 1241
+#if !defined(__cpp_lib_latch)
+# if (__cplusplus >= 202002L) && (__glibcxx_atomic_wait)
+#  define __glibcxx_latch 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_latch)
+#   define __cpp_lib_latch 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_latch) && defined(__glibcxx_want_latch) */
+#undef __glibcxx_want_latch
+
+// from version.def line 1250
+#if !defined(__cpp_lib_list_remove_return_type)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_list_remove_return_type 201806L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_list_remove_return_type)
+#   define __cpp_lib_list_remove_return_type 201806L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_list_remove_return_type) && defined(__glibcxx_want_list_remove_return_type) */
+#undef __glibcxx_want_list_remove_return_type
+
+// from version.def line 1259
+#if !defined(__cpp_lib_polymorphic_allocator)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_polymorphic_allocator 201902L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_polymorphic_allocator)
+#   define __cpp_lib_polymorphic_allocator 201902L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_polymorphic_allocator) && defined(__glibcxx_want_polymorphic_allocator) */
+#undef __glibcxx_want_polymorphic_allocator
+
+// from version.def line 1268
+#if !defined(__cpp_lib_move_iterator_concept)
+# if (__cplusplus >= 202002L) && (__glibcxx_concepts)
+#  define __glibcxx_move_iterator_concept 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_move_iterator_concept)
+#   define __cpp_lib_move_iterator_concept 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_move_iterator_concept) && defined(__glibcxx_want_move_iterator_concept) */
+#undef __glibcxx_want_move_iterator_concept
+
+// from version.def line 1278
+#if !defined(__cpp_lib_semaphore)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED && (__glibcxx_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE)
+#  define __glibcxx_semaphore 201907L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_semaphore)
+#   define __cpp_lib_semaphore 201907L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_semaphore) && defined(__glibcxx_want_semaphore) */
+#undef __glibcxx_want_semaphore
+
+// from version.def line 1288
+#if !defined(__cpp_lib_smart_ptr_for_overwrite)
+# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_smart_ptr_for_overwrite 202002L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_smart_ptr_for_overwrite)
+#   define __cpp_lib_smart_ptr_for_overwrite 202002L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_smart_ptr_for_overwrite) && defined(__glibcxx_want_smart_ptr_for_overwrite) */
+#undef __glibcxx_want_smart_ptr_for_overwrite
+
+// from version.def line 1297
+#if !defined(__cpp_lib_syncbuf)
+# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED
+#  define __glibcxx_syncbuf 201803L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_syncbuf)
+#   define __cpp_lib_syncbuf 201803L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_syncbuf) && defined(__glibcxx_want_syncbuf) */
+#undef __glibcxx_want_syncbuf
+
+// from version.def line 1307
+#if !defined(__cpp_lib_byteswap)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_byteswap 202110L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_byteswap)
+#   define __cpp_lib_byteswap 202110L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_byteswap) && defined(__glibcxx_want_byteswap) */
+#undef __glibcxx_want_byteswap
+
+// from version.def line 1315
+#if !defined(__cpp_lib_constexpr_charconv)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_constexpr_charconv 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_charconv)
+#   define __cpp_lib_constexpr_charconv 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_charconv) && defined(__glibcxx_want_constexpr_charconv) */
+#undef __glibcxx_want_constexpr_charconv
+
+// from version.def line 1323
+#if !defined(__cpp_lib_constexpr_typeinfo)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_constexpr_typeinfo 202106L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_typeinfo)
+#   define __cpp_lib_constexpr_typeinfo 202106L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_typeinfo) && defined(__glibcxx_want_constexpr_typeinfo) */
+#undef __glibcxx_want_constexpr_typeinfo
+
+// from version.def line 1331
+#if !defined(__cpp_lib_expected)
+# if (__cplusplus >  202002L) && (__cpp_concepts >= 202002L)
+#  define __glibcxx_expected 202211L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_expected)
+#   define __cpp_lib_expected 202211L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_expected) && defined(__glibcxx_want_expected) */
+#undef __glibcxx_want_expected
+
+// from version.def line 1340
+#if !defined(__cpp_lib_invoke_r)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_invoke_r 202106L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_invoke_r)
+#   define __cpp_lib_invoke_r 202106L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_invoke_r) && defined(__glibcxx_want_invoke_r) */
+#undef __glibcxx_want_invoke_r
+
+// from version.def line 1348
+#if !defined(__cpp_lib_is_scoped_enum)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_is_scoped_enum 202011L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_scoped_enum)
+#   define __cpp_lib_is_scoped_enum 202011L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_is_scoped_enum) && defined(__glibcxx_want_is_scoped_enum) */
+#undef __glibcxx_want_is_scoped_enum
+
+// from version.def line 1356
+#if !defined(__cpp_lib_reference_from_temporary)
+# if (__cplusplus >  202002L) && (__has_builtin(__reference_constructs_from_temporary) && __has_builtin(__reference_converts_from_temporary))
+#  define __glibcxx_reference_from_temporary 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_reference_from_temporary)
+#   define __cpp_lib_reference_from_temporary 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_reference_from_temporary) && defined(__glibcxx_want_reference_from_temporary) */
+#undef __glibcxx_want_reference_from_temporary
+
+// from version.def line 1367
+#if !defined(__cpp_lib_to_underlying)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_to_underlying 202102L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_underlying)
+#   define __cpp_lib_to_underlying 202102L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_to_underlying) && defined(__glibcxx_want_to_underlying) */
+#undef __glibcxx_want_to_underlying
+
+// from version.def line 1375
+#if !defined(__cpp_lib_unreachable)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_unreachable 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_unreachable)
+#   define __cpp_lib_unreachable 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_unreachable) && defined(__glibcxx_want_unreachable) */
+#undef __glibcxx_want_unreachable
+
+// from version.def line 1383
+#if !defined(__cpp_lib_ranges_zip)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_zip 202110L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_zip)
+#   define __cpp_lib_ranges_zip 202110L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_zip) && defined(__glibcxx_want_ranges_zip) */
+#undef __glibcxx_want_ranges_zip
+
+// from version.def line 1391
+#if !defined(__cpp_lib_ranges_chunk)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_chunk 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_chunk)
+#   define __cpp_lib_ranges_chunk 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_chunk) && defined(__glibcxx_want_ranges_chunk) */
+#undef __glibcxx_want_ranges_chunk
+
+// from version.def line 1399
+#if !defined(__cpp_lib_ranges_slide)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_slide 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_slide)
+#   define __cpp_lib_ranges_slide 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_slide) && defined(__glibcxx_want_ranges_slide) */
+#undef __glibcxx_want_ranges_slide
+
+// from version.def line 1407
+#if !defined(__cpp_lib_ranges_chunk_by)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_chunk_by 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_chunk_by)
+#   define __cpp_lib_ranges_chunk_by 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_chunk_by) && defined(__glibcxx_want_ranges_chunk_by) */
+#undef __glibcxx_want_ranges_chunk_by
+
+// from version.def line 1415
+#if !defined(__cpp_lib_ranges_join_with)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_join_with 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_join_with)
+#   define __cpp_lib_ranges_join_with 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_join_with) && defined(__glibcxx_want_ranges_join_with) */
+#undef __glibcxx_want_ranges_join_with
+
+// from version.def line 1423
+#if !defined(__cpp_lib_ranges_repeat)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_repeat 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_repeat)
+#   define __cpp_lib_ranges_repeat 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_repeat) && defined(__glibcxx_want_ranges_repeat) */
+#undef __glibcxx_want_ranges_repeat
+
+// from version.def line 1431
+#if !defined(__cpp_lib_ranges_stride)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_stride 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_stride)
+#   define __cpp_lib_ranges_stride 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_stride) && defined(__glibcxx_want_ranges_stride) */
+#undef __glibcxx_want_ranges_stride
+
+// from version.def line 1439
+#if !defined(__cpp_lib_ranges_cartesian_product)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_cartesian_product 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_cartesian_product)
+#   define __cpp_lib_ranges_cartesian_product 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_cartesian_product) && defined(__glibcxx_want_ranges_cartesian_product) */
+#undef __glibcxx_want_ranges_cartesian_product
+
+// from version.def line 1447
+#if !defined(__cpp_lib_ranges_as_rvalue)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_as_rvalue 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_as_rvalue)
+#   define __cpp_lib_ranges_as_rvalue 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_as_rvalue) && defined(__glibcxx_want_ranges_as_rvalue) */
+#undef __glibcxx_want_ranges_as_rvalue
+
+// from version.def line 1455
+#if !defined(__cpp_lib_ranges_as_const)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_as_const 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_as_const)
+#   define __cpp_lib_ranges_as_const 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_as_const) && defined(__glibcxx_want_ranges_as_const) */
+#undef __glibcxx_want_ranges_as_const
+
+// from version.def line 1463
+#if !defined(__cpp_lib_ranges_enumerate)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_enumerate 202302L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_enumerate)
+#   define __cpp_lib_ranges_enumerate 202302L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_enumerate) && defined(__glibcxx_want_ranges_enumerate) */
+#undef __glibcxx_want_ranges_enumerate
+
+// from version.def line 1471
+#if !defined(__cpp_lib_ranges_fold)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_fold 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_fold)
+#   define __cpp_lib_ranges_fold 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_fold) && defined(__glibcxx_want_ranges_fold) */
+#undef __glibcxx_want_ranges_fold
+
+// from version.def line 1479
+#if !defined(__cpp_lib_ranges_contains)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_contains 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_contains)
+#   define __cpp_lib_ranges_contains 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_contains) && defined(__glibcxx_want_ranges_contains) */
+#undef __glibcxx_want_ranges_contains
+
+// from version.def line 1487
+#if !defined(__cpp_lib_ranges_iota)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_iota 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_iota)
+#   define __cpp_lib_ranges_iota 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_iota) && defined(__glibcxx_want_ranges_iota) */
+#undef __glibcxx_want_ranges_iota
+
+// from version.def line 1495
+#if !defined(__cpp_lib_ranges_find_last)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_ranges_find_last 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_find_last)
+#   define __cpp_lib_ranges_find_last 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ranges_find_last) && defined(__glibcxx_want_ranges_find_last) */
+#undef __glibcxx_want_ranges_find_last
+
+// from version.def line 1503
+#if !defined(__cpp_lib_constexpr_bitset)
+# if (__cplusplus >  202002L) && _GLIBCXX_HOSTED && (__cpp_constexpr_dynamic_alloc)
+#  define __glibcxx_constexpr_bitset 202202L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_bitset)
+#   define __cpp_lib_constexpr_bitset 202202L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_constexpr_bitset) && defined(__glibcxx_want_constexpr_bitset) */
+#undef __glibcxx_want_constexpr_bitset
+
+// from version.def line 1513
+#if !defined(__cpp_lib_stdatomic_h)
+# if (__cplusplus >  202002L)
+#  define __glibcxx_stdatomic_h 202011L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_stdatomic_h)
+#   define __cpp_lib_stdatomic_h 202011L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_stdatomic_h) && defined(__glibcxx_want_stdatomic_h) */
+#undef __glibcxx_want_stdatomic_h
+
+// from version.def line 1521
+#if !defined(__cpp_lib_adaptor_iterator_pair_constructor)
+# if (__cplusplus >  202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_adaptor_iterator_pair_constructor 202106L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_adaptor_iterator_pair_constructor)
+#   define __cpp_lib_adaptor_iterator_pair_constructor 202106L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_adaptor_iterator_pair_constructor) && defined(__glibcxx_want_adaptor_iterator_pair_constructor) */
+#undef __glibcxx_want_adaptor_iterator_pair_constructor
+
+// from version.def line 1530
+#if !defined(__cpp_lib_ios_noreplace)
+# if (__cplusplus >  202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_ios_noreplace 202207L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ios_noreplace)
+#   define __cpp_lib_ios_noreplace 202207L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_ios_noreplace) && defined(__glibcxx_want_ios_noreplace) */
+#undef __glibcxx_want_ios_noreplace
+
+// from version.def line 1539
+#if !defined(__cpp_lib_move_only_function)
+# if (__cplusplus >  202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_move_only_function 202110L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_move_only_function)
+#   define __cpp_lib_move_only_function 202110L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_move_only_function) && defined(__glibcxx_want_move_only_function) */
+#undef __glibcxx_want_move_only_function
+
+// from version.def line 1548
+#if !defined(__cpp_lib_spanstream)
+# if (__cplusplus >  202002L) && _GLIBCXX_HOSTED && (__glibcxx_span)
+#  define __glibcxx_spanstream 202106L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_spanstream)
+#   define __cpp_lib_spanstream 202106L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_spanstream) && defined(__glibcxx_want_spanstream) */
+#undef __glibcxx_want_spanstream
+
+// from version.def line 1558
+#if !defined(__cpp_lib_stacktrace)
+# if (__cplusplus >  202002L) && _GLIBCXX_HOSTED && (_GLIBCXX_HAVE_STACKTRACE)
+#  define __glibcxx_stacktrace 202011L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_stacktrace)
+#   define __cpp_lib_stacktrace 202011L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_stacktrace) && defined(__glibcxx_want_stacktrace) */
+#undef __glibcxx_want_stacktrace
+
+// from version.def line 1568
+#if !defined(__cpp_lib_string_contains)
+# if (__cplusplus >  202002L) && _GLIBCXX_HOSTED
+#  define __glibcxx_string_contains 202011L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_contains)
+#   define __cpp_lib_string_contains 202011L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_string_contains) && defined(__glibcxx_want_string_contains) */
+#undef __glibcxx_want_string_contains
+
+// from version.def line 1577
+#if !defined(__cpp_lib_string_resize_and_overwrite)
+# if (__cplusplus >  202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED
+#  define __glibcxx_string_resize_and_overwrite 202110L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_resize_and_overwrite)
+#   define __cpp_lib_string_resize_and_overwrite 202110L
+#  endif
+# endif
+#endif /* !defined(__cpp_lib_string_resize_and_overwrite) && defined(__glibcxx_want_string_resize_and_overwrite) */
+#undef __glibcxx_want_string_resize_and_overwrite
+
+#undef __glibcxx_want_all
diff --git a/libstdc++-v3/include/bits/version.tpl b/libstdc++-v3/include/bits/version.tpl
new file mode 100644
index 00000000000..0b15eed35c3
--- /dev/null
+++ b/libstdc++-v3/include/bits/version.tpl
@@ -0,0 +1,210 @@
+/*{ AutoGen5 template                                              -*- C++ -*-
+h
+(use-modules (srfi srfi-1))
+}*/
+// Copyright (C) 2023 Free Software Foundation, Inc.
+
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*{ (dne "// ") }*/
+
+/** @file bits/version.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{version}
+ */
+
+// Usage guide:
+//
+// In your usual header, do something like:
+//
+//   #define __glibcxx_want_ranges
+//   #define __glibcxx_want_concepts
+//   #include <bits/version.h>
+//
+// This will generate the FTMs you named, and let you use them in your code as
+// if it was user code.  All macros are also exposed under __glibcxx_NAME even
+// if unwanted, to permit bits and other FTMs to depend on them for condtional
+// computation without exposing extra FTMs to user code.
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+/*{
+
+;; Helper for dealing with autogens redefined (error)
+(define (ferror msg . args)
+  (error (apply format (cons* #f msg args))))
+
+  ;; Helper function that, in the context of a single FTM value, generates the
+;; condition expression that fulfills the specification of this value.  See the
+;; comment block in version.def for an explanation of the format this
+;; function parses.
+(define (generate-cond)
+  (define c++min #f)
+  (define gnu++min #f)
+  (define gthread #f)
+  (define hosted #f)
+  (define c++11-abi #f)
+  (define extra-cond (get "extra_cond"))
+
+  (define conds '())
+  (define (prepend x)
+    (if x (set! conds (cons x conds))))
+
+  (if (string-null? extra-cond)
+      (set! extra-cond #f))
+
+  (let ((cxxmin (get "cxxmin"))
+	(gnuxxmin (get "gnuxxmin"))
+	(getstdcond
+	 (lambda (var)
+	   (let ((ver (get var)))
+	     (if (not (string-null? ver))
+	       (let ((std-cond (get (format #f "stds[~a]" ver))))
+		 (if (string-null? std-cond)
+		     (ferror "Standard ~s invalid." ver))
+		 std-cond)
+	       #f)))))
+    (set! c++min (getstdcond "cxxmin"))
+    (set! gnu++min (getstdcond "gnuxxmin")))
+
+  (let ((process-tristate
+	 (lambda (name)
+	   (let ((val (get name)))
+	     (cond
+	       ((equal? val "") #f)    ; Don't test
+	       ((equal? val "yes") "") ; Test directly
+	       ((equal? val "no") "!") ; Invert
+	       (else (ferror "Bad ~a value ~a." name val)))))))
+    (set! gthread (process-tristate "gthread"))
+    (set! c++11-abi (process-tristate "cxx11abi"))
+    (set! hosted (process-tristate "hosted")))
+
+  (prepend (if extra-cond (format #f "(~a)" extra-cond) #f))
+  (prepend (if hosted (format #f "~a~a" hosted "_GLIBCXX_HOSTED") #f))
+  (prepend (if gthread (format #f "~a~a" gthread "defined(_GLIBCXX_HAS_GTHREADS)") #f))
+  (prepend (if c++11-abi (format #f "~a~a" c++11-abi "_GLIBCXX_USE_CXX11_ABI") #f))
+
+  (prepend
+   (let ((strict "defined(__STRICT_ANSI__)")
+	 (c++ "__cplusplus"))
+     (cond
+      ((or (and (equal? c++min gnu++min) c++min)
+	   (and (not gnu++min) c++min))
+       ;; If we have both values, and they are equal, or we only have gnu++min,
+       ;; we want to output a simple check.
+       (format #f "(~a ~a)" c++ c++min))
+      ((and gnu++min c++min)
+       ;; We have differing cases for strict and non-strict modes.
+       (format #f "((~a && ~a ~a) || (!~a && ~a ~a))"
+	       strict c++ c++min
+	       strict c++ gnu++min))
+      ((and gnu++min (not c++min))
+       (format #f "(!~a && (~a ~a))" strict c++ gnu++min))
+      (else #f))))
+  (string-join conds " && " 'strict-infix))
+
+
+  }*/
+/*{ FOR ftms
+  }*/// /*{ (def-file-line "name") }*/
+#if !defined(__cpp_lib_/*{name}*/)
+/*{ FOR values }*//*{ #
+
+  This macro block defines two versions of each FTM:
+
+  1. __glibcxx_NAME, which is defined unconditionally, and
+  2. __cpp_lib_NAME, which is defined only if marked as wanted.
+
+  This allows FTMs to depend on eachother in their definitions without messing
+  with the exported values.
+
+  This can also be used by bits that do not want to expose FTMs that they can't
+  implement.
+
+}*/# /*{(unless (first-for?) "el")}*/if /*{(generate-cond)}*/
+#  define __glibcxx_/*{name}*/ /*{v}*/L
+#  if defined(__glibcxx_want_all) || defined(__glibcxx_want_/*{name}*/)
+#   define /*{
+;; Compute the name for this FTM based on stdname/name.
+(if (exist? "stdname")
+    (get "stdname")
+    (format #f "__cpp_lib_~a" (get "name")))
+}*/ /*{v}*/L
+#  endif
+/*{ ENDFOR values
+  }*/# endif
+#endif /* !defined(__cpp_lib_/*{name}*/) && defined(__glibcxx_want_/*{name}*/) */
+#undef __glibcxx_want_/*{name
+}*//*{ (unless (last-for?) "\n\n" "\n")}*/
+/*{ ENDFOR ftms }*//*{
+
+;; Helper that generates [LO, HI].
+(define (closed-int-set lo hi)
+  (iota (+ (- hi lo) 1) lo))
+
+;; Sanity checking for duplicates and for value order.
+(let ((ht (make-hash-table (count "ftms"))))
+  (for-each
+   (lambda (idx)
+     (let ((name (get (format #f "ftms[~a].name" idx))))
+       (if (string-null? name) (ferror "No name for FTM ~a" idx))
+       (let ((cur (cdr (or (hash-get-handle ht name) '(1 . 0)))))
+	 (hash-set! ht name (+ cur 1)))))
+   (closed-int-set (low-lim "ftms") (high-lim "ftms")))
+  (if (hash-fold
+       (lambda (name count prior)
+	 (if (= 1 count)
+	     prior
+	     (begin
+	       (printf "FTM %s appears %d times.\n" name count)
+	       #t)))
+       #f ht)
+      (error "Duplicates found.")))
+
+(define (check-value-order ftm key order)
+  (let ((valmin 999999)) ; TODO(arsen): bump before year 10000
+    (for-each
+     (lambda (vidx)
+       (let* ((sval (get (format #f "values[~a].~a" vidx key)))
+	      (val (string->number sval)))
+	 (unless (string-null? sval)
+	   (unless val (ferror "Bad value in FTM ~a" ftm))
+	   (if (order val valmin)
+	       (ferror "Found inverted ~s value in FTM ~a: ~a" key ftm sval))
+	   (set! valmin val))))
+     (closed-int-set (low-lim "values") (high-lim "values")))))
+
+}*//*{ FOR ftms }*//*{#
+  Check for values that are in ascending order.  Because it is generally the
+  case that FTMs increase as the values of tests they probe for do, we check
+  them to prevent simple, silly errors.
+
+  We're iterating in a separate FOR block rather than in pure Guile since, for
+  some reason, high-lim and low-lim do not work with complex names that include
+  periods and indices (whereas exist? and others do).
+}*//*{
+(let ((ftm (get "name")))
+  (check-value-order (get "name") "v" >)
+  (check-value-order (get "name") "cxxmin" >)
+  (check-value-order (get "name") "gnuxxmin" >))
+}*//*{ ENDFOR ftms }*/
+#undef __glibcxx_want_all
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 5264c8bff34..4963e4058f6 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -30,353 +30,9 @@
 #ifndef _GLIBCXX_VERSION_INCLUDED
 #define _GLIBCXX_VERSION_INCLUDED
 
-// To facilitate testsuite/17_intro/versionconflict.cc
-#ifndef _GLIBCXX_TESTING_SYSHDR
-# pragma GCC system_header
-#endif
+#pragma GCC system_header
 
-#include <bits/c++config.h>
-
-// c++03
-#if _GLIBCXX_HOSTED
-# define __cpp_lib_incomplete_container_elements 201505L
-#endif
-
-#if !defined(__STRICT_ANSI__)
-// gnu++03
-# define __cpp_lib_uncaught_exceptions 201411L
-#endif
-
-#if __cplusplus >= 201103L
-// c++11
-#define __cpp_lib_allocator_traits_is_always_equal 201411L
-#define __cpp_lib_is_null_pointer 201309L
-#define __cpp_lib_result_of_sfinae 201210L
-
-#if _GLIBCXX_HOSTED
-#if __cplusplus <= 201703L // N.B. updated value in C++20
-# define __cpp_lib_shared_ptr_arrays 201611L
-#endif
-#endif
-
-#if !defined(__STRICT_ANSI__)
-// gnu++11
-# define __cpp_lib_is_swappable 201603L
-# define __cpp_lib_void_t 201411L
-# if _GLIBCXX_HOSTED
-#  define __cpp_lib_enable_shared_from_this 201603L
-# endif
-#endif
-
-// For C++11 and later we support ISO/IEC 29124 Mathematical Special Functions
-#define __STDCPP_MATH_SPEC_FUNCS__ 201003L
-
-#if __cplusplus >= 201402L
-// c++14
-#if __cpp_impl_coroutine
-# define __cpp_lib_coroutine 201902L
-#endif
-#define __cpp_lib_exchange_function 201304L
-#define __cpp_lib_integer_sequence 201304L
-#define __cpp_lib_integral_constant_callable 201304L
-#define __cpp_lib_is_final 201402L
-#define __cpp_lib_make_reverse_iterator 201402L
-#ifndef _GLIBCXX_DEBUG // PR libstdc++/70303
-# define __cpp_lib_null_iterators 201304L
-#endif
-#define __cpp_lib_robust_nonmodifying_seq_ops 201304L
-#define __cpp_lib_transformation_trait_aliases 201304L
-#define __cpp_lib_transparent_operators 201510L
-#define __cpp_lib_tuple_element_t 201402L
-#define __cpp_lib_tuples_by_type 201304L
-
-#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \
-    && __SIZE_WIDTH__ >= 32
-# define __cpp_lib_to_chars 201611L
-#endif
-
-#if _GLIBCXX_HOSTED
-# define __cpp_lib_chrono_udls 201304L
-# define __cpp_lib_complex_udls 201309L
-# define __cpp_lib_generic_associative_lookup 201304L
-# define __cpp_lib_make_unique 201304L
-# define __cpp_lib_quoted_string_io 201304L
-# ifdef _GLIBCXX_HAS_GTHREADS
-#  define __cpp_lib_shared_timed_mutex 201402L
-# endif
-# define __cpp_lib_string_udls 201304L
-#endif
-
-#if __cplusplus >= 201703L
-// c++17
-#define __cpp_lib_addressof_constexpr 201603L
-#define __cpp_lib_any 201606L
-#define __cpp_lib_apply 201603L
-#define __cpp_lib_as_const 201510L
-#define __cpp_lib_atomic_is_always_lock_free 201603L
-#define __cpp_lib_bool_constant 201505L
-#define __cpp_lib_byte 201603L
-#define __cpp_lib_clamp 201603L
-#define __cpp_lib_gcd 201606L
-#define __cpp_lib_gcd_lcm 201606L
-#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
-# define __cpp_lib_has_unique_object_representations 201606L
-#endif
-#ifdef __GCC_DESTRUCTIVE_SIZE
-# define __cpp_lib_hardware_interference_size 201703L
-#endif
-#define __cpp_lib_invoke 201411L
-#ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
-# define __cpp_lib_is_aggregate 201703L
-#endif
-#define __cpp_lib_is_invocable 201703L
-#define __cpp_lib_is_swappable 201603L
-#ifdef _GLIBCXX_HAVE_BUILTIN_LAUNDER
-# define __cpp_lib_launder 201606L
-#endif
-#define __cpp_lib_lcm 201606L
-#define __cpp_lib_logical_traits 201510L
-#define __cpp_lib_make_from_tuple 201606L
-#define __cpp_lib_nonmember_container_access 201411L
-#define __cpp_lib_not_fn 201603L
-#if __cplusplus == 201703L // N.B. updated value in C++20
-# define __cpp_lib_optional 201606L
-#endif
-#define __cpp_lib_raw_memory_algorithms 201606L
-#define __cpp_lib_sample 201603L
-#define __cpp_lib_type_trait_variable_templates 201510L
-#define __cpp_lib_uncaught_exceptions 201411L
-#if !(__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L)
-// N.B. updated value in C++20
-# define __cpp_lib_variant 202102L
-#endif
-#define __cpp_lib_void_t 201411L
-#if __cplusplus == 201703L // N.B. updated value in C++20
-# define __cpp_lib_array_constexpr 201803L
-#endif
-#if __cplusplus == 201703L // N.B. updated value in C++20
-# if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-#  define __cpp_lib_constexpr_char_traits 201611L
-#  define __cpp_lib_constexpr_string 201611L
-# endif
-#endif
-
-#if _GLIBCXX_HOSTED
-#define __cpp_lib_boyer_moore_searcher 201603L
-#define __cpp_lib_chrono 201611L
-#define __cpp_lib_enable_shared_from_this 201603L
-#define __cpp_lib_execution 201902L // FIXME: should be 201603L
-#define __cpp_lib_filesystem 201703L
-#define __cpp_lib_hypot 201603L
-#define __cpp_lib_map_try_emplace 201411L
-#define __cpp_lib_math_special_functions 201603L
-#ifdef _GLIBCXX_HAS_GTHREADS
-# define __cpp_lib_memory_resource 201603L
-#else
-# define __cpp_lib_memory_resource 1
-#endif
-#define __cpp_lib_node_extract 201606L
-#define __cpp_lib_parallel_algorithm 201603L
-#ifdef _GLIBCXX_HAS_GTHREADS
-# define __cpp_lib_scoped_lock 201703L
-# define __cpp_lib_shared_mutex 201505L
-#endif
-#define __cpp_lib_shared_ptr_weak_type 201606L
-#define __cpp_lib_string_view 201803L
-#define __cpp_lib_unordered_map_try_emplace 201411L
-#endif
-
-#if __cplusplus >= 202002L
-// c++20
-#define __cpp_lib_assume_aligned 201811L
-#define __cpp_lib_atomic_flag_test 201907L
-#define __cpp_lib_atomic_float 201711L
-#define __cpp_lib_atomic_lock_free_type_aliases 201907L
-#define __cpp_lib_atomic_ref 201806L
-#define __cpp_lib_atomic_value_initialization 201911L
-#define __cpp_lib_bind_front 201907L
-#define __cpp_lib_starts_ends_with 201711L
-#if __has_builtin(__builtin_bit_cast)
-# define __cpp_lib_bit_cast 201806L
-#endif
-#define __cpp_lib_bitops 201907L
-#define __cpp_lib_bounded_array_traits 201902L
-// __cpp_lib_char8_t is defined in <bits/c++config.h>
-#if __cpp_concepts >= 201907L
-# define __cpp_lib_concepts 202002L
-#endif
-#if __cpp_impl_destroying_delete
-# define __cpp_lib_destroying_delete 201806L
-#endif
-#define __cpp_lib_constexpr_string_view 201811L
-#define __cpp_lib_endian 201907L
-#define __cpp_lib_int_pow2 202002L
-#define __cpp_lib_integer_comparison_functions 202002L
-#ifdef _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-# define __cpp_lib_is_constant_evaluated 201811L
-#endif
-#if __has_builtin(__is_layout_compatible) \
-  && __has_builtin(__builtin_is_corresponding_member)
-# define __cpp_lib_is_layout_compatible 201907L
-#endif
-#define __cpp_lib_is_nothrow_convertible 201806L
-#if __has_builtin(__is_pointer_interconvertible_base_of) \
- && __has_builtin(__builtin_is_pointer_interconvertible_with_class)
-# define __cpp_lib_is_pointer_interconvertible 201907L
-#endif
-#define __cpp_lib_math_constants 201907L
-#if __cpp_lib_concepts
-# define __cpp_lib_make_obj_using_allocator 201811L
-#endif
-#if __cplusplus <= 202002L // N.B. updated value in C++23
-# define __cpp_lib_optional 202106L
-#endif
-#define __cpp_lib_remove_cvref 201711L
-#if __has_builtin(__builtin_source_location)
-# define __cpp_lib_source_location 201907L
-#endif
-#if __cpp_lib_concepts
-# define __cpp_lib_span 202002L
-#endif
-#define __cpp_lib_ssize 201902L
-#if __cpp_impl_three_way_comparison >= 201907L && __cpp_lib_concepts
-# define __cpp_lib_three_way_comparison 201907L
-#endif
-#define __cpp_lib_to_address 201711L
-#define __cpp_lib_to_array 201907L
-#define __cpp_lib_type_identity 201806L
-#define __cpp_lib_unwrap_ref 201811L
-#if __cpp_concepts >= 202002L && __cpp_constexpr >= 201811L
-# define __cpp_lib_variant 202106L
-#endif
-#define __cpp_lib_constexpr_algorithms 201806L
-#define __cpp_lib_constexpr_functional 201907L
-#if __cplusplus <= 202002L // N.B. updated value in C++23
-# define __cpp_lib_constexpr_memory 201811L
-#endif // C++20
-#define __cpp_lib_constexpr_numeric 201911L
-#define __cpp_lib_constexpr_tuple 201811L
-#define __cpp_lib_array_constexpr 201811L
-#ifdef __cpp_lib_is_constant_evaluated
-# define __cpp_lib_constexpr_char_traits 201811L
-#endif
-#define __cpp_lib_constexpr_iterator 201811L
-#define __cpp_lib_constexpr_utility 201811L
-#define __cpp_lib_interpolate 201902L
-#if __cpp_lib_concepts
-# define __cpp_lib_move_iterator_concept 202207L
-#if __cplusplus <= 202002L // N.B. updated value in C++23
-# define __cpp_lib_ranges 202110L
-#endif
-#endif
-#define __cpp_lib_shift 201806L
-
-#if _GLIBCXX_HOSTED
-#define __cpp_lib_atomic_shared_ptr 201711L
-#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
-# define __cpp_lib_atomic_wait 201907L
-# if __cpp_aligned_new
-#  define __cpp_lib_barrier 201907L
-# endif
-#endif
-#undef __cpp_lib_chrono
-#define __cpp_lib_chrono 201907L
-// FIXME: #define __cpp_lib_execution 201902L
-#define __cpp_lib_constexpr_complex 201711L
-#define __cpp_lib_constexpr_dynamic_alloc 201907L
-#define __cpp_lib_constexpr_tuple 201811L
-#ifdef __cpp_lib_is_constant_evaluated
-# if _GLIBCXX_USE_CXX11_ABI
-#  define __cpp_lib_constexpr_string 201907L
-# else
-#  define __cpp_lib_constexpr_string 201811L
-# endif
-#endif
-#define __cpp_lib_constexpr_vector 201907L
-#define __cpp_lib_erase_if 202002L
-#define __cpp_lib_format 202106L
-#define __cpp_lib_generic_unordered_lookup 201811L
-#ifdef _GLIBCXX_HAS_GTHREADS
-# define __cpp_lib_jthread 201911L
-#endif
-#if __cpp_lib_atomic_wait
-# define __cpp_lib_latch 201907L
-#endif
-#define __cpp_lib_list_remove_return_type 201806L
-#define __cpp_lib_polymorphic_allocator 201902L
-#if __cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE
-# define __cpp_lib_semaphore 201907L
-#endif
-#define __cpp_lib_shared_ptr_arrays 201707L
-#define __cpp_lib_smart_ptr_for_overwrite 202002L
-# if _GLIBCXX_USE_CXX11_ABI
-// Only supported with cxx11-abi
-#  define __cpp_lib_syncbuf 201803L
-# endif
-#endif
-
-#if __cplusplus > 202002L
-// c++23
-#define __cpp_lib_byteswap 202110L
-#define __cpp_lib_constexpr_charconv 202207L
-#define __cpp_lib_constexpr_typeinfo 202106L
-#if __cpp_concepts >= 202002L
-# define __cpp_lib_expected 202211L
-#endif
-#define __cpp_lib_invoke_r 202106L
-#define __cpp_lib_is_scoped_enum 202011L
-#if __cpp_lib_concepts
-# undef __cpp_lib_optional
-# define __cpp_lib_optional 202110L
-#endif
-#define __cpp_lib_reference_from_temporary 202202L
-#define __cpp_lib_to_underlying 202102L
-#define __cpp_lib_unreachable 202202L
-#define __cpp_lib_ranges 202202L
-#define __cpp_lib_ranges_zip 202110L
-#define __cpp_lib_ranges_chunk 202202L
-#define __cpp_lib_ranges_slide 202202L
-#define __cpp_lib_ranges_chunk_by 202202L
-#define __cpp_lib_ranges_join_with 202202L
-#define __cpp_lib_ranges_repeat 202207L
-#define __cpp_lib_ranges_stride 202207L
-#define __cpp_lib_ranges_cartesian_product 202207L
-#define __cpp_lib_ranges_as_rvalue 202207L
-#define __cpp_lib_ranges_as_const 202207L
-#define __cpp_lib_ranges_enumerate 202302L
-#define __cpp_lib_ranges_contains 202207L
-#define __cpp_lib_ranges_iota 202202L
-#define __cpp_lib_ranges_find_last 202207L
-#define __cpp_lib_ranges_fold 202207L
-#if __cpp_constexpr_dynamic_alloc
-# if _GLIBCXX_HOSTED
-#  define __cpp_lib_constexpr_bitset 202202L
-# endif
-# undef __cpp_lib_constexpr_memory
-# define __cpp_lib_constexpr_memory 202202L
-#endif
-#define __cpp_lib_stdatomic_h 202011L
-
-#if _GLIBCXX_HOSTED
-#define __cpp_lib_adaptor_iterator_pair_constructor 202106L
-#define __cpp_lib_ios_noreplace 202207L
-#define __cpp_lib_move_only_function 202110L
-#if __cpp_lib_span
-# define __cpp_lib_spanstream 202106L
-#endif
-#if _GLIBCXX_HAVE_STACKTRACE
-# define __cpp_lib_stacktrace 202011L
-#endif
-#define __cpp_lib_stdatomic_h 202011L
-#define __cpp_lib_string_contains 202011L
-#if _GLIBCXX_USE_CXX11_ABI // Only supported with cxx11-abi
-# define __cpp_lib_string_resize_and_overwrite 202110L
-#endif
-#endif
-#endif // C++23
-#endif // C++20
-#endif // C++17
-#endif // C++14
-#endif // C++11
+#define __glibcxx_want_all
+#include <bits/version.h>
 
 #endif // _GLIBCXX_VERSION_INCLUDED
-- 
2.41.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use
  2023-08-13 19:35 [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
@ 2023-08-13 19:35 ` Arsen Arsenović
  2023-08-16 11:15   ` Jonathan Wakely
  2023-08-14 15:18 ` [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
  2023-08-16 11:15 ` Jonathan Wakely
  2 siblings, 1 reply; 6+ messages in thread
From: Arsen Arsenović @ 2023-08-13 19:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Arsen Arsenović

libstdc++-v3/ChangeLog:

	* libsupc++/typeinfo: Switch to bits/version.h for
	__cpp_lib_constexpr_typeinfo.
	* libsupc++/new: Switch to bits/version.h for
	__cpp_lib_{launder,hardware_interference_size,destroying_delete}.
	(launder): Guard behind __cpp_lib_launder.
	(hardware_destructive_interference_size)
	(hardware_constructive_interference_size): Guard behind
	__cpp_lib_hardware_interference_size.
	* libsupc++/exception: Switch to bits/version.h for
	__cpp_lib_uncaught_exceptions.
	(uncaught_exceptions): Guard behind __cpp_lib_uncaught_exceptions.
	* libsupc++/compare: Switch to bits/version.h for
	__cpp_lib_three_way_comparison.
	(three_way_comparable, three_way_comparable_with)
	(compare_three_way, weak_order, strong_order, partial_order):
	Guard behind __cpp_lib_three_way_comparison >= 201907L.
	* include/std/chrono: Drop __cpp_lib_chrono definition.
	* include/std/vector: Switch to bits/version.h for
	__cpp_lib_erase_if.
	(erase, erase_if): Guard behind __cpp_lib_erase_if.
	* include/std/variant: Switch to bits/version.h for
	__cpp_lib_variant.  Guard whole header behind that FTM.
	* include/std/utility: Switch to bits/version.h for
	__cpp_lib_{exchange_function,constexpr_algorithms,as_const},
	__cpp_lib_{integer_comparison_functions,to_underlying}, and
	__cpp_lib_unreachable.
	(exchange): Guard behind __cpp_lib_exchange_function.
	(cmp_equal, cmp_not_equal, cmp_less, cmp_greater, cmp_less_equal)
	(cmp_greater_equal, in_range): Guard behind
	__cpp_lib_integer_comparison_functions.
	(to_underlying): Guard behind __cpp_lib_to_underlying.
	(unreachable): Guard behind __cpp_lib_unreachable.
	* include/std/type_traits: Switch to bits/version.h for
	__cpp_lib_is_{null_pointer,final,nothrow_convertible,aggregate},
	__cpp_lib_is_{constant_evaluated,invocable,layout_compatible},
	__cpp_lib_is_{pointer_interconvertible,scoped_enum,swappable},
	__cpp_lib_{logical_traits,reference_from_temporary,remove_cvref},
	__cpp_lib_{result_of_sfinae,transformation_trait_aliases},
	__cpp_lib_{type_identity,type_trait_variable_templates},
	__cpp_lib_{unwrap_ref,void_t,integral_constant_callable},
	__cpp_lib_{bool_constant,bounded_array_traits}, and
	__cpp_lib_has_unique_object_representations.
	(integral_constant::operator()): Guard behind
	__cpp_lib_integral_constant_callable.
	(bool_constant): Guard behind __cpp_lib_bool_constant.
	(conjunction, disjunction, negation, conjunction_v, disjunction_v)
	(negation_v): Guard behind __cpp_lib_logical_traits.
	(is_null_pointer): Guard behind __cpp_lib_is_null_pointer.
	(is_final): Guard behind __cpp_lib_is_final.
	(is_nothrow_convertible, is_nothrow_convertible_v): Guard behind
	__cpp_lib_is_nothrow_convertible.
	(remove_const_t, remove_volatile_t, remove_cv_t)
	(add_const_t, add_volatile_t, add_cv_t): Guard behind
	__cpp_lib_transformation_trait_aliases.
	(void_t): Guard behind __cpp_lib_void_t.
	(is_swappable_with_v, is_nothrow_swappable_with_v)
	(is_swappable_with, is_nothrow_swappable_with): Guard behind
	__cpp_lib_is_swappable.
	(is_nothrow_invocable_r, is_invocable_r, invoke_result)
	(is_invocable, invoke_result_t): Guard behind
	__cpp_lib_is_invocable.
	(alignment_of_v, extent_v, has_virtual_destructor_v)
	(is_abstract_v, is_arithmetic_v, is_array_v)
	(is_assignable_v, is_base_of_v, is_class_v, is_compound_v)
	(is_constructible_v, is_const_v, is_convertible_v)
	(is_copy_assignable_v, is_copy_constructible_v)
	(is_default_constructible_v, is_destructible_v)
	(is_empty_v, is_enum_v, is_final_v, is_floating_point_v)
	(is_function_v, is_fundamental_v, is_integral_v)
	(is_invocable_r_v, is_invocable_v, is_literal_type_v)
	(is_lvalue_reference_v, is_member_function_pointer_v)
	(is_member_object_pointer_v, is_member_pointer_v)
	(is_move_assignable_v, is_move_constructible_v)
	(is_nothrow_assignable_v, is_nothrow_constructible_v)
	(is_nothrow_copy_assignable_v, is_nothrow_copy_constructible_v)
	(is_nothrow_default_constructible_v, is_nothrow_destructible_v)
	(is_nothrow_invocable_r_v, is_nothrow_invocable_v)
	(is_nothrow_move_assignable_v, is_nothrow_move_constructible_v)
	(is_null_pointer_v, is_object_v, is_pod_v, is_pointer_v)
	(is_polymorphic_v, is_reference_v, is_rvalue_reference_v)
	(is_same_v, is_scalar_v, is_signed_v, is_standard_layout_v)
	(is_trivially_assignable_v, is_trivially_constructible_v)
	(is_trivially_copyable_v, is_trivially_copy_assignable_v)
	(is_trivially_copy_constructible_v)
	(is_trivially_default_constructible_v)
	(is_trivially_destructible_v, is_trivially_move_assignable_v)
	(is_trivially_move_constructible_v, is_trivial_v, is_union_v)
	(is_unsigned_v, is_void_v, is_volatile_v, rank_v, as variadic):
	Guard behind __cpp_lib_type_trait_variable_templates.
	(has_unique_object_representations)
	(has_unique_object_representations_v): Guard behind
	__cpp_lib_has_unique_object_representation.
	(is_aggregate): Guard behind __cpp_lib_is_aggregate.
	(remove_cvref, remove_cvref_t): Guard behind
	__cpp_lib_remove_cvref.
	(type_identity, type_identity_t): Guard behind
	__cpp_lib_type_identity.
	(unwrap_reference, unwrap_reference_t, unwrap_ref_decay)
	(unwrap_ref_decay_t): Guard behind __cpp_lib_unwrap_ref.
	(is_bounded_array_v, is_unbounded_array_v, is_bounded_array)
	(is_unbounded_array): Guard behind __cpp_lib_bounded_array_traits.
	(is_scoped_enum, is_scoped_enum_v): Guard behind
	__cpp_lib_is_scoped_enum.
	(reference_constructs_from_temporary)
	(reference_constructs_from_temporary_v): Guard behind
	__cpp_lib_reference_from_temporary.
	* include/std/tuple: Switch to bits/version.h for
	__cpp_lib_{constexpr_tuple,tuple_by_type,apply_make_from_tuple}.
	(get<T>): Guard behind __cpp_lib_tuple_by_type.
	(apply): Guard behind __cpp_lib_apply.
	(make_from_tuple): Guard behind __cpp_lib_make_from_tuple.
	* include/std/syncstream: Switch to bits/version.h for
	__cpp_lib_syncbuf.  Guard header behind that FTM.
	* include/std/string_view: Switch to bits/version.h for
	__cpp_lib_{string_{view,contains},constexpr_string_view} and
	__cpp_lib_starts_ends_with.
	(basic_string_view::starts_with, basic_string_view::ends_with):
	Guard behind __cpp_lib_starts_ends_with.
	[C++23 && _GLIBCXX_HOSTED && !defined(__cpp_lib_string_contains)]:
	Assert as impossible ithout a bug in C++23.
	* include/std/string: Switch to bits/version.h for
	__cpp_lib_erase_if.
	(erase, erase_if): Guard behind __cpp_lib_erase_if.
	* include/std/thread: Switch to bits/version.h for
	__cpp_lib_jthread.
	* include/std/stop_token: Switch to bits/version.h for
	__cpp_lib_jthread.
	* include/std/spanstream: Switch to bits/version.h for
	__cpp_lib_spanstream.  Guard header behind that FTM.
	* include/std/span: Switch to bits/version.h for __cpp_lib_span.
	Guard header behind that FTM.
	* include/std/source_location: Switch to bits/version.h for
	__cpp_lib_source_location.  Guard header with that FTM.
	* include/std/shared_mutex: Switch to bits/version.h for
	__cpp_lib_shared{,_timed}_mutex.
	(shared_mutex): Guard behind __cpp_lib_shared_mutex.
	* include/std/semaphore: Switch to bits/version.h for
	__cpp_lib_semaphore.  Guard header behind that FTM.
	* include/std/ranges: Switch to bits/version.h for
	__cpp_lib_ranges_{zip,chunk{,_by},slide,join_with},
	__cpp_lib_ranges_{repeat_stride,cartesian_product,as_rvalue},
	and __cpp_lib_ranges_{as_const,enumerate,iota}.
	(ranges::zip et al, ranges::chunk et al, ranges::slide et al)
	(ranges::chunk_by et al, ranges::join_with et al)
	(ranges::stride et al, ranges::cartesian_product et al)
	(ranges::as_rvalue et al, ranges::as_const et al)
	(ranges::enumerate et al): Guard behind appropriate FTM.
	* include/std/optional: Switch to bits/version.h for
	__cpp_lib_optional.  Guard header behind that FTM.
	* include/std/numeric: Switch to bits/version.h for
	__cpp_lib_{gcd{,_lcm},lcm,constexpr_numeric,interpolate}
	and __cpp_lib_parallel_algorithm.
	(gcd, lcm): Guard behind __cpp_lib_gcd_lcm.
	(midpoint): Guard behind __cpp_lib_interpolate.
	* include/std/numbers: Switch to bits/version.h for
	__cpp_lib_math_constants.  Guard header behind that FTM.
	* include/std/mutex: Switch to bits/version.h for
	__cpp_lib_scoped_lock.
	(scoped_Lock): Guard behind __cpp_lib_scoped_lock.
	* include/std/memory_resource: Switch to bits/version.h for
	__cpp_lib_{polymorphic_allocator,memory_resource}.
	(synchronized_pool_resource): Guard behind
	__cpp_lib_memory_resource >= 201603L.
	(polymorphic_allocator): Guard behind
	__cpp_lib_polymorphic_allocator.
	* include/std/memory: Switch to bits/version.h for
	__cpp_lib_{parallel_algorithm,atomic_value_initialization}.
	* include/std/list: Switch to bits/version.h for
	__cpp_lib_erase_if.
	(erase, erase_if): Guard behind __cpp_lib_erase_if.
	* include/std/latch: Switch to bits/version.h for __cpp_lib_latch.
	Guard header behind that FTM.
	* include/std/iterator: Switch to bits/version.h for
	__cpp_lib_null_iterators.
	* include/std/iomanip: Switch to bits/version.h for
	__cpp_lib_quoted_string_io.
	(quoted): Guard behind __cpp_lib_quoted_string_io.
	* include/std/functional: Switch to bits/version.h for
	__cpp_lib_{invoke{,_r},constexpr_functional,bind_front} and
	__cpp_lib_{not_fn,booyer_moore_searcher}.
	(invoke): Guard behind __cpp_lib_invoke.
	(invoke_r): Guard behind __cpp_lib_invoke_r.
	(bind_front): Guard behind __cpp_lib_bind_front.
	(not_fn): Guard behind __cpp_lib_not_fn.
	(boyer_moore_searcher, boyer_moore_horspool_searcher): Guard
	definition behind __cpp_lib_boyer_moore_searcher.
	* include/std/forward_list: Switch to bits/version.h for
	__cpp_lib_erase_if.
	(erase, erase_if): Guard behind __cpp_lib_erase_if.
	* include/std/format: Switch to bits/version.h for
	__cpp_lib_format.  Guard header behind that FTM.
	* include/std/filesystem: Switch to bits/version.h for
	__cpp_lib_filesystem.  Guard header behind that FTM.
	* include/std/expected: Switch to bits/version.h for
	__cpp_lib_expected.  Guard header behind it.
	* include/std/execution: Switch to bits/version.h for
	__cpp_lib_{execution,parallel_algorithm}.  Guard header behind
	either.
	* include/std/deque: Switch to bits/version.h for
	__cpp_lib_erase_if.
	(erase, erase_if): Guard behind __cpp_lib_erase_if.
	* include/std/coroutine: Switch to bits/version.h for
	__cpp_lib_coroutine.  Guard header behind that FTM.
	* include/std/concepts: Switch to bits/version.h for
	__cpp_lib_concepts.  Guard header behind that FTM.
	* include/std/complex: Switch to bits/version.h for
	__cpp_lib_{complex_udls,constexpr_complex}.
	(operator""if, operator""i, operator""il): Guard behind
	__cpp_lib_complex_udls.
	* include/std/charconv: Swtich to bits/version.h for
	__cpp_lib_{to_chars,constexpr_charconv}.
	* include/std/bitset: Switch to bits/version.h for
	__cpp_lib_constexpr_bitset.
	* include/std/bit: Switch to bits/version.h for
	__cpp_lib_{bit_cast,byteswap,bitops,int_pow2,endian}.
	(bit_cast): Guard behind __cpp_lib_bit_cast.
	(byteswap): Guard behind __cpp_lib_byteswap.
	(rotl, rotr, countl_zero, countl_one, countr_zero, countr_one)
	(popcount): Guard behind __cpp_lib_bitops.
	(has_single_bit, bit_ceil, bit_floor, bit_width): Guard behind
	__cpp_lib_int_pow2.
	(endian): Guard behind __cpp_lib_endian.
	* include/std/barrier: Switch to bits/version.h for
	__cpp_lib_barrier.  Guard header behind that FTM.
	* include/std/atomic: Switch to bits/version.h for
	__cpp_lib_atomic_{is_always_lock_free,float,ref}
	and __cpp_lib_lock_free_type_aliases.
	(*::is_always_lock_free): Guard behind
	__cpp_lib_atomic_is_always_lock_free.
	(atomic<float>): Guard behind __cpp_lib_atomic_float.
	(atomic_ref): Guard behind __cpp_lib_atomic_ref.
	(atomic_signed_lock_free, atomic_unsigned_lock_free): Guard behind
	__cpp_lib_atomic_lock_free_type_aliases.
	* include/std/array: Switch to bits/version.h for
	__cpp_lib_to_array.
	(to_array): Guard behind __cpp_lib_to_array.
	* include/std/any: Switch to bits/version.h for __cpp_lib_any.
	Guard header behind that FTM.
	* include/std/algorithm: Switch to bits/version.h for
	__cpp_lib_parallel_algorithm.
	* include/c_global/cstddef: Switch to bits/version.h for
	__cpp_lib_byte.
	(byte): Guard behind __cpp_lib_byte.
	* include/c_global/cmath: Switch to bits/version.h for
	__cpp_lib_{hypot,interpolate}.
	(hypot3): Guard behind __cpp_lib_hypot.
	(lerp): Guard behind __cpp_lib_interpolate.
	* include/c_compatibility/stdatomic.h: Switch to
	bits/stl_version.h for __cpp_lib_atomic.  Guard header behind that
	FTM.
	* include/bits/utility.h: Switch to bits/version.h for
	__cpp_lib_{tuple_element_t,integer_sequence,ranges_zip}.
	(tuple_element_t): Guard behind __cpp_lib_tuple_element_t.
	(integer_sequence et al): Guard behind __cpp_lib_integer_sequence.
	* include/bits/uses_allocator_args.h: Switch to bits/version.h for
	__cpp_lib_make_obj_using_allocator.  Guard header behind that FTM.
	* include/bits/unordered_map.h: Switch to bits/version.h for
	__cpp_lib_unordered_map_try_emplace.
	(try_emplace): Guard behind __cpp_lib_unordered_map_try_emplace.
	* include/bits/unique_ptr.h: Switch to bits/version.h for
	__cpp_lib_{constexpr_memory,make_unique}.
	(make_unique): Guard behind __cpp_lib_make_unique.
	* include/bits/stl_vector.h: Switch to bits/version.h for
	__cpp_lib_constexpr_vector.
	* include/bits/stl_uninitialized.h: Switch to bits/version.h for
	__cpp_lib_raw_memory_algorithms.
	(uninitialized_default_construct)
	(uninitialized_default_construct_n, uninitialized_move)
	(uninitialized_move_n, uninitialized_value_construct)
	(uninitialized_value_construct_n): Guard behind
	__cpp_lib_raw_memory_algorithms.
	* include/bits/stl_tree.h: Switch to bits/version.h for
	__cpp_lib_generic_associative_lookup.
	* include/bits/stl_stack.h: Switch to bits/version.h for
	__cpp_lib_adaptor_iterator_pair_constructor.
	(stack): Guard iterator-pair constructor behind
	__cpp_lib_adaptor_iterator_pair_constructor.
	* include/bits/stl_queue.h: Switch to bits/version.h for
	__cpp_lib_adaptor_iterator_pair_constructor.
	(queue): Guard iterator-pair constructor behind
	__cpp_lib_adaptor_iterator_pair_constructor.
	* include/bits/stl_pair.h: Switch to bits/version.h for
	__cpp_lib_{concepts,tuples_by_type}.
	(get): Guard type-getting overloads behind
	__cpp_lib_tuples_by_type.
	* include/bits/stl_map.h: Switch to bits/version.h for
	__cpp_lib_map_try_emplace.
	(map<>::try_emplace): Guard behind __cpp_lib_map_try_emplace.
	* include/bits/stl_list.h: Switch to bits/version.h for
	__cpp_lib_list_remove_return_type.
	(__remove_return_type, _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG)
	[C++20]: guard behind __cpp_lib_list_remove_return_type instead.
	* include/bits/stl_iterator.h: Switch to bits/version.h for
	__cpp_lib_{constexpr_iterator,array_constexpr} and
	__cpp_lib_{make_reverse_iterator,move_iterator_concept}.
	(make_reverse_iterator): Guard behind
	__cpp_lib_make_reverse_iterator.
	(iterator_concept et al): Guard __cpp_lib_move_iterator_concept
	changes behind that FTM.
	* include/bits/stl_function.h: Switch to bits/version.h for
	__cpp_lib_transparent_operators.
	(equal_to, not_equal_to, greater, less, greater_equal)
	(less_equal, bit_and, bit_or, bit_xor, bit_not, logical_and)
	(logical_or, logical_not, plus, minus, multiplies, divides)
	(modulus, negate): Guard '= void' fwdecls behind
	__cpp_lib_transparent_operators.
	(plus<void>, minus<void>, multiplies<void>, divides<void>)
	(modulus<void>, negate<void>, logical_and<void>, logical_or<void>)
	(logical_not<void>, bit_and<void>, bit_or<void>, bit_xor<void>)
	(equal_to<void>, not_equal_to<void>, greater<void>, less<void>)
	(greater_equal<void>, less_equal<void>, bit_not<void>)
	(__has_is_transparent): Guard behind
	__cpp_lib_transparent_operators.
	* include/bits/stl_algobase.h: Switch to bits/version.h for
	__cpp_lib_robust_nonmodifying_seq_ops.
	(robust equal, mismatch): Guard behind
	__cpp_lib_nonmember_container_access.
	* include/bits/stl_algo.h: Swtich to bits/version.h for
	__cpp_lib_{clamp,sample}.
	(clamp): Guard behind __cpp_lib_clamp.
	(sample): Guard behind __cpp_lib_sample.
	* include/bits/specfun.h: Switch to bits/version.h for
	__cpp_lib_math_special_functions and __STDCPP_MATH_SPEC_FUNCS__.
	* include/bits/shared_ptr_base.h: Switch to bits/version.h for
	__cpp_lib_{smart_ptr_for_overwrite,shared_ptr_arrays}.
	(_Sp_overwrite_tag): Guard behind
	__cpp_lib_smart_ptr_for_overwrite.
	* include/bits/shared_ptr_atomic.h: Switch to bits/version.h for
	__cpp_lib_atomic_shared_ptr.
	* include/bits/shared_ptr.h: Switch to bits/version.h for
	__cpp_lib_{enable_shared_from_this,shared_ptr_weak_type}.
	(shared_ptr<T>::weak_type): Guard behind
	__cpp_lib_shared_ptr_weak_type.
	(enable_shared_from_this<T>::weak_from_this): Guard behind
	__cpp_lib_enable_shared_from_this.
	* include/bits/ranges_cmp.h: Switch to bits/version.h for
	__cpp_lib_ranges.
	* include/bits/ranges_algo.h: Switch to bits/version.h for
	__cpp_lib_{shift,ranges_{contains,find_last,fold,iota}}.
	* include/bits/range_access.h: Switch to bits/version.h for
	__cpp_lib_nonmember_container_access
	(size, empty, data): Guard behind
	__cpp_lib_nonmember_container_access.
	(ssize): Guard behind __cpp_lib_ssize.
	* include/bits/ptr_traits.h: Switch to bits/version.h. for
	__cpp_lib_{constexpr_memory,to_address}.
	(to_address): Guard behind __cpp_lib_to_address.
	* include/bits/node_handle.h: Switch to bits/version.h for
	__cpp_lib_node_extract.  Guard header behind that FTM.
	* include/bits/move_only_function.h: Switch to bits/version.h for
	__cpp_lib_move_only_function.  Guard header behind that FTM.
	* include/bits/move.h: Switch to bits/version.h for
	__cpp_lib_addressof_constexpr.
	* include/bits/ios_base.h: Switch to bits/version.h for
	__cpp_lib_ios_noreplace.
	(noreplace): Guard with __cpp_lib_ios_noreplace.
	* include/bits/hashtable.h: Switch to bits/version.h for
	__cpp_lib_generic_unordered_lookup.
	(_M_equal_range_tr, _M_count_tr, _M_find_tr): Guard behind
	__cpp_lib_generic_unordered_lookup.
	* include/bits/forward_list.h: Switch to bits/version.h for
	__cpp_lib_list_remove_return_type.
	(__remove_return_type): Guard behind
	__cpp_lib_list_remove_return_type.
	* include/bits/erase_if.h: Switch to bits/version.h for
	__cpp_lib_erase_if.
	* include/bits/cow_string.h: Switch to bits/version.h for
	__cpp_lib_constexpr_string.
	* include/bits/chrono.h: Swtich to bits/version.h for
	__cpp_lib_chrono{,_udls}.
	(ceil): Guard behind __cpp_lib_chrono.
	(operator""ns et al): Guard behind __cpp_lib_chrono_udls.
	* include/bits/char_traits.h: Switch to bits/version.h for
	__cpp_lib_constexpr_char_traits.
	* include/bits/basic_string.h: Switch to bits/version.h for
	__cpp_lib_{constexpr_string,string_{resize_and_overwrite,udls}}.
	(resize_and_overwrite): Guard behind
	__cpp_lib_string_resize_and_overwrite.
	(operator""s): Guard behind __cpp_lib_string_udls.
	* include/bits/atomic_wait.h: Switch to bits/version.h for
	__cpp_lib_atomic_wait.  Guard header behind that FTM.
	* include/bits/atomic_base.h: Switch to bits/version.h for
	__cpp_lib_atomic_value_initialization and
	__cpp_lib_atomic_flag_test.
	(atomic_flag::test): Guard behind __cpp_lib_atomic_flag_test,
	rather than C++20.
	* include/bits/allocator.h: Switch to bits/version.h for
	__cpp_lib_incomplete_container_elements.
	* include/bits/alloc_traits.h: Switch to using bits/version.h for
	__cpp_lib_constexpr_dynamic_alloc and
	__cpp_lib_allocator_traits_is_always_equal.
	* include/bits/align.h: Switch to bits/version.h for defining
	__cpp_lib_assume_aligned.
	(assume_aligned): Guard with __cpp_lib_assume_aligned.
	* include/bits/algorithmfwd.h: Switch to bits/version.h for
	defining __cpp_lib_constexpr_algorithms.
	* include/std/stacktrace: Switch to bits/version.h for
	__cpp_lib_stacktrace.  Guard header behind that FTM.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Update line numbers.
---
 libstdc++-v3/include/bits/algorithmfwd.h      |   7 +-
 libstdc++-v3/include/bits/align.h             |   8 +-
 libstdc++-v3/include/bits/alloc_traits.h      |  11 +-
 libstdc++-v3/include/bits/allocator.h         |   3 +-
 libstdc++-v3/include/bits/atomic_base.h       |  16 +-
 libstdc++-v3/include/bits/atomic_wait.h       |  10 +-
 libstdc++-v3/include/bits/basic_string.h      |  24 ++-
 libstdc++-v3/include/bits/char_traits.h       |  11 +-
 libstdc++-v3/include/bits/chrono.h            |  18 +--
 libstdc++-v3/include/bits/cow_string.h        |   9 +-
 libstdc++-v3/include/bits/erase_if.h          |  11 +-
 libstdc++-v3/include/bits/forward_list.h      |   6 +-
 libstdc++-v3/include/bits/hashtable.h         |   9 +-
 libstdc++-v3/include/bits/ios_base.h          |   6 +-
 libstdc++-v3/include/bits/move.h              |   8 +-
 .../include/bits/move_only_function.h         |   9 +-
 libstdc++-v3/include/bits/node_handle.h       |   8 +-
 libstdc++-v3/include/bits/ptr_traits.h        |  15 +-
 libstdc++-v3/include/bits/range_access.h      |  16 +-
 libstdc++-v3/include/bits/ranges_algo.h       |  27 ++--
 libstdc++-v3/include/bits/ranges_cmp.h        |  14 +-
 libstdc++-v3/include/bits/shared_ptr.h        |  10 +-
 libstdc++-v3/include/bits/shared_ptr_atomic.h |   6 +-
 libstdc++-v3/include/bits/shared_ptr_base.h   |  23 ++-
 libstdc++-v3/include/bits/specfun.h           |   6 +-
 libstdc++-v3/include/bits/stl_algo.h          |  20 +--
 libstdc++-v3/include/bits/stl_algobase.h      |  13 +-
 libstdc++-v3/include/bits/stl_function.h      |  28 ++--
 libstdc++-v3/include/bits/stl_iterator.h      |  23 ++-
 libstdc++-v3/include/bits/stl_list.h          |   6 +-
 libstdc++-v3/include/bits/stl_map.h           |   6 +-
 libstdc++-v3/include/bits/stl_pair.h          |  12 +-
 libstdc++-v3/include/bits/stl_queue.h         |   9 +-
 libstdc++-v3/include/bits/stl_stack.h         |   7 +-
 libstdc++-v3/include/bits/stl_tree.h          |   7 +-
 libstdc++-v3/include/bits/stl_uninitialized.h |   9 +-
 libstdc++-v3/include/bits/stl_vector.h        |   4 +-
 libstdc++-v3/include/bits/unique_ptr.h        |  14 +-
 libstdc++-v3/include/bits/unordered_map.h     |   8 +-
 .../include/bits/uses_allocator_args.h        |  10 +-
 libstdc++-v3/include/bits/utility.h           |  21 ++-
 .../include/c_compatibility/stdatomic.h       |   9 +-
 libstdc++-v3/include/c_global/cmath           |  18 +--
 libstdc++-v3/include/c_global/cstddef         |   9 +-
 libstdc++-v3/include/std/algorithm            |  10 +-
 libstdc++-v3/include/std/any                  |   9 +-
 libstdc++-v3/include/std/array                |  10 +-
 libstdc++-v3/include/std/atomic               |  69 +++++----
 libstdc++-v3/include/std/barrier              |  11 +-
 libstdc++-v3/include/std/bit                  |  30 ++--
 libstdc++-v3/include/std/bitset               |   7 +-
 libstdc++-v3/include/std/charconv             |  11 +-
 libstdc++-v3/include/std/chrono               |   5 -
 libstdc++-v3/include/std/complex              |  11 +-
 libstdc++-v3/include/std/concepts             |  10 +-
 libstdc++-v3/include/std/coroutine            |  20 ++-
 libstdc++-v3/include/std/deque                |   9 +-
 libstdc++-v3/include/std/execution            |  11 +-
 libstdc++-v3/include/std/expected             |   8 +-
 libstdc++-v3/include/std/filesystem           |   9 +-
 libstdc++-v3/include/std/format               |  19 +--
 libstdc++-v3/include/std/forward_list         |  10 +-
 libstdc++-v3/include/std/functional           |  39 ++---
 libstdc++-v3/include/std/iomanip              |   9 +-
 libstdc++-v3/include/std/iterator             |   5 +-
 libstdc++-v3/include/std/latch                |  10 +-
 libstdc++-v3/include/std/list                 |  10 +-
 libstdc++-v3/include/std/memory               |  15 +-
 libstdc++-v3/include/std/memory_resource      |  20 +--
 libstdc++-v3/include/std/mutex                |   8 +-
 libstdc++-v3/include/std/numbers              |   8 +-
 libstdc++-v3/include/std/numeric              |  35 ++---
 libstdc++-v3/include/std/optional             |  15 +-
 libstdc++-v3/include/std/ranges               |  62 ++++----
 libstdc++-v3/include/std/semaphore            |   9 +-
 libstdc++-v3/include/std/shared_mutex         |  12 +-
 libstdc++-v3/include/std/source_location      |   9 +-
 libstdc++-v3/include/std/span                 |  11 +-
 libstdc++-v3/include/std/spanstream           |  11 +-
 libstdc++-v3/include/std/stacktrace           |  10 +-
 libstdc++-v3/include/std/stop_token           |   5 +-
 libstdc++-v3/include/std/string               |   9 +-
 libstdc++-v3/include/std/string_view          |  23 ++-
 libstdc++-v3/include/std/syncstream           |  17 +--
 libstdc++-v3/include/std/thread               |   3 +
 libstdc++-v3/include/std/tuple                |  25 ++--
 libstdc++-v3/include/std/type_traits          | 141 +++++++++---------
 libstdc++-v3/include/std/utility              |  38 +++--
 libstdc++-v3/include/std/variant              |  15 +-
 libstdc++-v3/include/std/vector               |   9 +-
 libstdc++-v3/libsupc++/compare                |  12 +-
 libstdc++-v3/libsupc++/exception              |   6 +-
 libstdc++-v3/libsupc++/new                    |  20 +--
 libstdc++-v3/libsupc++/typeinfo               |   7 +-
 .../array/tuple_interface/get_neg.cc          |   6 +-
 95 files changed, 703 insertions(+), 724 deletions(-)

diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index 130943d2340..bc757c340a4 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -39,6 +39,9 @@
 #include <initializer_list>
 #endif
 
+#define __glibcxx_want_constexpr_algorithms
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -191,10 +194,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // adjacent_find
 
-#if __cplusplus > 201703L
-#  define __cpp_lib_constexpr_algorithms 201806L
-#endif
-
 #if __cplusplus >= 201103L
   template<typename _IIter, typename _Predicate>
     _GLIBCXX20_CONSTEXPR
diff --git a/libstdc++-v3/include/bits/align.h b/libstdc++-v3/include/bits/align.h
index 32d9349ee25..4152639622e 100644
--- a/libstdc++-v3/include/bits/align.h
+++ b/libstdc++-v3/include/bits/align.h
@@ -32,6 +32,9 @@
 
 #include <bits/c++config.h>
 
+#define __glibcxx_want_assume_aligned
+#include <bits/version.h>
+
 #include <bit>          // std::has_single_bit
 #include <stdint.h>     // uintptr_t
 #include <debug/assertions.h> // _GLIBCXX_DEBUG_ASSERT
@@ -75,8 +78,7 @@ align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept
     }
 }
 
-#if __cplusplus > 201703L
-#define __cpp_lib_assume_aligned 201811L
+#ifdef __cpp_lib_assume_aligned // C++ >= 20
   /** @brief Inform the compiler that a pointer is aligned.
    *
    *  @tparam _Align An alignment value (i.e. a power of two)
@@ -103,7 +105,7 @@ align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept
 	  return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Align));
 	}
     }
-#endif // C++2a
+#endif // __cpp_lib_assume_aligned
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h
index bc936ec15dd..453278e5348 100644
--- a/libstdc++-v3/include/bits/alloc_traits.h
+++ b/libstdc++-v3/include/bits/alloc_traits.h
@@ -40,13 +40,15 @@
 # endif
 #endif
 
+#define __glibcxx_want_constexpr_dynamic_alloc
+#define __glibcxx_want_allocator_traits_is_always_equal
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus >= 201103L
-#define __cpp_lib_allocator_traits_is_always_equal 201411L
-
   /// @cond undocumented
   struct __allocator_traits_base
   {
@@ -418,11 +420,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
 #if _GLIBCXX_HOSTED
-
-#if __cplusplus > 201703L
-# define __cpp_lib_constexpr_dynamic_alloc 201907L
-#endif
-
   /// Partial specialization for std::allocator.
   template<typename _Tp>
     struct allocator_traits<allocator<_Tp>>
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index abbd753d33d..41e35f876f0 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -49,7 +49,8 @@
 #include <type_traits>
 #endif
 
-#define __cpp_lib_incomplete_container_elements 201505L
+#define __glibcxx_want_incomplete_container_elements
+#include <bits/version.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index 3af61881895..4ce04a02dd0 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -46,6 +46,10 @@
 #define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
 #endif
 
+#define __glibcxx_want_atomic_value_initialization
+#define __glibcxx_want_atomic_flag_test
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -156,10 +160,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __ret;
     }
 
-#if __cplusplus >= 202002L
-# define __cpp_lib_atomic_value_initialization 201911L
-#endif
-
 /// @cond undocumented
 #if __cpp_lib_atomic_value_initialization
 # define _GLIBCXX20_INIT(I) = I
@@ -234,9 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __atomic_test_and_set (&_M_i, int(__m));
     }
 
-#if __cplusplus > 201703L
-#define __cpp_lib_atomic_flag_test 201907L
-
+#ifdef __cpp_lib_atomic_flag_test // C++ >= 20
     _GLIBCXX_ALWAYS_INLINE bool
     test(memory_order __m = memory_order_seq_cst) const noexcept
     {
@@ -252,8 +250,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __atomic_load(&_M_i, &__v, int(__m));
       return __v == __GCC_ATOMIC_TEST_AND_SET_TRUEVAL;
     }
+#endif
 
-#if __cpp_lib_atomic_wait
+#if __cpp_lib_atomic_wait // C++ >= 20 && (linux_futex || gthread)
     _GLIBCXX_ALWAYS_INLINE void
     wait(bool __old,
 	memory_order __m = memory_order_seq_cst) const noexcept
@@ -279,7 +278,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     // TODO add const volatile overload
 #endif // __cpp_lib_atomic_wait
-#endif // C++20
 
     _GLIBCXX_ALWAYS_INLINE void
     clear(memory_order __m = memory_order_seq_cst) noexcept
diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h
index 67c0e3bf56b..9cbfb99a7c2 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -32,8 +32,10 @@
 
 #pragma GCC system_header
 
-#include <bits/c++config.h>
-#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
+#define __glibcxx_want_atomic_wait
+#include <bits/version.h>
+
+#if __cpp_lib_atomic_wait
 #include <bits/functional_hash.h>
 #include <bits/gthr.h>
 #include <ext/numeric_traits.h>
@@ -48,8 +50,6 @@
 
 # include <bits/std_mutex.h>  // std::mutex, std::__condvar
 
-#define __cpp_lib_atomic_wait 201907L
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -476,5 +476,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // GTHREADS || LINUX_FUTEX
+#endif // __cpp_lib_atomic_wait
 #endif // _GLIBCXX_ATOMIC_WAIT_H
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 170a43664c9..c68e6171aba 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -47,22 +47,20 @@
 # include <string_view>
 #endif
 
+#define __glibcxx_want_constexpr_string
+#define __glibcxx_want_string_resize_and_overwrite
+#define __glibcxx_want_string_udls
+#include <bits/version.h>
+
 #if ! _GLIBCXX_USE_CXX11_ABI
 # include "cow_string.h"
 #else
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_BEGIN_NAMESPACE_CXX11
 
-#ifdef __cpp_lib_is_constant_evaluated
-// Support P0980R1 in C++20.
-# define __cpp_lib_constexpr_string 201907L
-#elif __cplusplus >= 201703L && _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-// Support P0426R1 changes to char_traits in C++17.
-# define __cpp_lib_constexpr_string 201611L
-#endif
-
   /**
    *  @class basic_string basic_string.h <string>
    *  @brief  Managing sequences of characters and character-like objects.
@@ -1118,8 +1116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 #pragma GCC diagnostic pop
 #endif
 
-#if __cplusplus > 202002L
-#define __cpp_lib_string_resize_and_overwrite 202110L
+#ifdef __cpp_lib_string_resize_and_overwrite // C++ >= 23
       /** Resize the string and call a function to fill it.
        *
        * @param __n   The maximum size requested.
@@ -4491,10 +4488,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
 #endif
 
-#if __cplusplus >= 201402L
-
-#define __cpp_lib_string_udls 201304L
-
+#ifdef __cpp_lib_string_udls // C++ >= 14
   inline namespace literals
   {
   inline namespace string_literals
@@ -4539,6 +4533,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #pragma GCC diagnostic pop
   } // inline namespace string_literals
   } // inline namespace literals
+#endif // __cpp_lib_string_udls
 
 #if __cplusplus >= 201703L
   namespace __detail::__variant
@@ -4556,7 +4551,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { };
   }  // namespace __detail::__variant
 #endif // C++17
-#endif // C++14
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index 0928137854b..e9b4e84af99 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -61,6 +61,9 @@
 # define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
 #endif
 
+#define __glibcxx_want_constexpr_char_traits
+#include <bits/version.h>
+
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -316,14 +319,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#ifdef __cpp_lib_is_constant_evaluated
-// Unofficial macro indicating P1032R1 support in C++20
-# define __cpp_lib_constexpr_char_traits 201811L
-#elif __cplusplus >= 201703L && _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-// Unofficial macro indicating P0426R1 support in C++17
-# define __cpp_lib_constexpr_char_traits 201611L
-#endif
-
   // 21.1
   /**
    *  @brief  Basis for explicit traits specializations.
diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h
index b2713d57ef1..50aca84f142 100644
--- a/libstdc++-v3/include/bits/chrono.h
+++ b/libstdc++-v3/include/bits/chrono.h
@@ -32,6 +32,10 @@
 
 #pragma GCC system_header
 
+#define __glibcxx_want_chrono
+#define __glibcxx_want_chrono_udls
+#include <bits/version.h>
+
 #if __cplusplus >= 201103L
 
 #include <ratio>
@@ -370,9 +374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { };
 #endif // C++20
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_chrono 201611L
-
+#ifdef __cpp_lib_chrono // C++ >= 17 && HOSTED
     /** Convert a `duration` to type `ToDur` and round down.
      *
      * If the duration cannot be represented exactly in the result type,
@@ -466,7 +468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     // Make chrono::ceil<D> also usable as chrono::__detail::ceil<D>.
     namespace __detail { using chrono::ceil; }
 
-#else // ! C++17
+#else // ! __cpp_lib_chrono
 
     // We want to use ceil even when compiling for earlier standards versions.
     // C++11 only allows a single statement in a constexpr function, so we
@@ -488,7 +490,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  return __detail::__ceil_impl(chrono::duration_cast<_ToDur>(__d), __d);
 	}
     }
-#endif // C++17
+#endif // __cpp_lib_chrono
 
     /// duration_values
     template<typename _Rep>
@@ -1312,9 +1314,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 #endif // C++20
   } // namespace chrono
 
-#if __cplusplus >= 201402L
-#define __cpp_lib_chrono_udls 201304L
-
+#ifdef __cpp_lib_chrono_udls // C++ >= 14 && HOSTED
   inline namespace literals
   {
   /** ISO C++ 2014  namespace for suffixes for duration literals.
@@ -1435,7 +1435,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
   {
     using namespace literals::chrono_literals;
   } // namespace chrono
-#endif // C++14
+#endif // __cpp_lib_chrono_udls
 
 #if __cplusplus >= 201703L
   namespace filesystem
diff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h
index e5f094fd13e..bf676ed40c5 100644
--- a/libstdc++-v3/include/bits/cow_string.h
+++ b/libstdc++-v3/include/bits/cow_string.h
@@ -36,13 +36,8 @@
 
 #include <ext/atomicity.h> // _Atomic_word, __is_single_threaded
 
-#ifdef __cpp_lib_is_constant_evaluated
-// Support P1032R1 in C++20 (but not P0980R1 for COW strings).
-# define __cpp_lib_constexpr_string 201811L
-#elif __cplusplus >= 201703L && _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-// Support P0426R1 changes to char_traits in C++17.
-# define __cpp_lib_constexpr_string 201611L
-#endif
+#define __glibcxx_want_constexpr_string
+#include <bits/version.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/erase_if.h b/libstdc++-v3/include/bits/erase_if.h
index bb1b53dd4f6..4ff81e0f98f 100644
--- a/libstdc++-v3/include/bits/erase_if.h
+++ b/libstdc++-v3/include/bits/erase_if.h
@@ -32,18 +32,16 @@
 
 #pragma GCC system_header
 
-#if __cplusplus >= 201402L
-
 #include <bits/c++config.h>
 
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
+#if __cplusplus >= 201402L
 namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#if __cplusplus > 201703L
-# define __cpp_lib_erase_if 202002L
-#endif
-
   namespace __detail
   {
     template<typename _Container, typename _UnsafeContainer,
@@ -70,7 +68,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-
 #endif // C++14
 
 #endif // _GLIBCXX_ERASE_IF_H
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 72b1ef46d14..c56e430b068 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -41,6 +41,9 @@
 #include <ext/alloc_traits.h>
 #include <ext/aligned_buffer.h>
 
+#define __glibcxx_want_list_remove_return_type
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1180,8 +1183,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       /// @}
 
     private:
-#if __cplusplus > 201703L
-# define __cpp_lib_list_remove_return_type 201806L
+#ifdef __cpp_lib_list_remove_return_type // C++20 && HOSTED
       using __remove_return_type = size_type;
 # define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG \
       __attribute__((__abi_tag__("__cxx20")))
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index 954a1c7a58d..4c12dc895b2 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -39,6 +39,9 @@
 # include <bits/node_handle.h>
 #endif
 
+#define __glibcxx_want_generic_unordered_lookup
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -756,9 +759,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       std::pair<const_iterator, const_iterator>
       equal_range(const key_type& __k) const;
 
-#if __cplusplus >= 202002L
-#define __cpp_lib_generic_unordered_lookup 201811L
-
+#ifdef __cpp_lib_generic_unordered_lookup // C++ >= 20 && HOSTED
       template<typename _Kt,
 	       typename = __has_is_transparent_t<_Hash, _Kt>,
 	       typename = __has_is_transparent_t<_Equal, _Kt>>
@@ -788,7 +789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       typename = __has_is_transparent_t<_Equal, _Kt>>
 	pair<const_iterator, const_iterator>
 	_M_equal_range_tr(const _Kt& __k) const;
-#endif // C++20
+#endif // __cpp_lib_generic_unordered_lookup
 
     private:
       // Bucket index computation helpers.
diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h
index addfd054e76..3253eaaa233 100644
--- a/libstdc++-v3/include/bits/ios_base.h
+++ b/libstdc++-v3/include/bits/ios_base.h
@@ -46,6 +46,9 @@
 # include <system_error>
 #endif
 
+#define __glibcxx_want_ios_noreplace
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -473,8 +476,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     static const openmode __noreplace =	_S_noreplace;
 
-#if __cplusplus >= 202100L
-#define __cpp_lib_ios_noreplace 202207L
+#ifdef __cpp_lib_ios_noreplace // C++ >= 23 && HOSTED
     /// Open a file in exclusive mode.
     static const openmode noreplace =	_S_noreplace;
 #endif
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 4a8fceff96a..00997d6f1fb 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -37,6 +37,9 @@
 # include <type_traits> // Brings in std::declval too.
 #endif
 
+#define __glibcxx_want_addressof_constexpr
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -120,11 +123,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // declval, from type_traits.
 
-#if __cplusplus > 201402L
-  // _GLIBCXX_RESOLVE_LIB_DEFECTS
-  // 2296. std::addressof should be constexpr
-# define __cpp_lib_addressof_constexpr 201603L
-#endif
   /**
    *  @brief Returns the actual address of the object or function
    *         referenced by r, even in the presence of an overloaded
diff --git a/libstdc++-v3/include/bits/move_only_function.h b/libstdc++-v3/include/bits/move_only_function.h
index 71d52074978..0aa5980324a 100644
--- a/libstdc++-v3/include/bits/move_only_function.h
+++ b/libstdc++-v3/include/bits/move_only_function.h
@@ -32,7 +32,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus > 202002L
+#define __glibcxx_want_move_only_function
+#include <bits/version.h>
+
+#ifdef __cpp_lib_move_only_function // C++ >= 23 && HOSTED
 
 #include <bits/invoke.h>
 #include <bits/utility.h>
@@ -41,8 +44,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_move_only_function 202110L
-
   template<typename... _Signature>
     class move_only_function; // not defined
 
@@ -212,5 +213,5 @@ _GLIBCXX_END_NAMESPACE_VERSION
 #define _GLIBCXX_MOF_REF &&
 #include "mofunc_impl.h"
 
-#endif // C++23
+#endif // __cpp_lib_move_only_function
 #endif // _GLIBCXX_MOVE_ONLY_FUNCTION_H
diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h
index 8904a5ac496..16471355c19 100644
--- a/libstdc++-v3/include/bits/node_handle.h
+++ b/libstdc++-v3/include/bits/node_handle.h
@@ -33,8 +33,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_node_extract 201606L
+#define __glibcxx_want_node_extract
+#include <bits/version.h>
+
+#ifdef __cpp_lib_node_extract // C++ >= 17 && HOSTED
 
 #include <new>
 #include <bits/alloc_traits.h>
@@ -390,5 +392,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // C++17
+#endif // __cpp_lib_node_extract
 #endif
diff --git a/libstdc++-v3/include/bits/ptr_traits.h b/libstdc++-v3/include/bits/ptr_traits.h
index 8a919ec1090..9e2f4f3f216 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -34,12 +34,9 @@
 
 #include <bits/move.h>
 
-/* Duplicate definition with unique_ptr.h.  */
-#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
-# define __cpp_lib_constexpr_memory 202202L
-#elif __cplusplus > 201703L
-# define __cpp_lib_constexpr_memory 201811L
-#endif
+#define __glibcxx_want_constexpr_memory
+#define __glibcxx_want_to_address
+#include <bits/version.h>
 
 #if __cplusplus > 201703L
 #include <concepts>
@@ -215,7 +212,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __ptr;
     }
 
-#if __cplusplus <= 201703L
+#ifndef __cpp_lib_to_address // C++ < 20
   template<typename _Ptr>
     constexpr typename std::pointer_traits<_Ptr>::element_type*
     __to_address(const _Ptr& __ptr)
@@ -237,8 +234,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	return std::__to_address(__ptr.operator->());
     }
 
-#define __cpp_lib_to_address 201711L
-
   /**
    * @brief Obtain address referenced by a pointer to an object
    * @param __ptr A pointer to an object
@@ -261,7 +256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr auto
     to_address(const _Ptr& __ptr) noexcept
     { return std::__to_address(__ptr); }
-#endif // C++2a
+#endif // __cpp_lib_to_address
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
index b7169c616f9..9751b8e88d5 100644
--- a/libstdc++-v3/include/bits/range_access.h
+++ b/libstdc++-v3/include/bits/range_access.h
@@ -32,6 +32,10 @@
 
 #pragma GCC system_header
 
+#define __glibcxx_want_nonmember_container_access
+#define __glibcxx_want_ssize
+#include <bits/version.h>
+
 #if __cplusplus >= 201103L
 #include <initializer_list>
 #include <type_traits>	    // common_type_t, make_signed_t
@@ -251,9 +255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #endif // C++14
 
-#if __cplusplus >= 201703L
-#define __cpp_lib_nonmember_container_access 201411L
-
+#ifdef __cpp_lib_nonmember_container_access // C++ >= 17
   /**
    *  @brief  Return the size of a container.
    *  @param  __cont  Container.
@@ -345,9 +347,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr const _Tp*
     data(initializer_list<_Tp> __il) noexcept
     { return __il.begin(); }
+#endif // __cpp_lib_nonmember_container_access
 
-#if __cplusplus > 201703L
-#define __cpp_lib_ssize 201902L
+#ifdef __cpp_lib_ssize // C++ >= 20
   template<typename _Container>
     [[nodiscard, __gnu__::__always_inline__]]
     constexpr auto
@@ -364,9 +366,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr ptrdiff_t
     ssize(const _Tp (&)[_Num]) noexcept
     { return _Num; }
-#endif // C++20
-
-#endif // C++17
+#endif // __cpp_lib_ssize
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h
index da66ff8045d..a06794c02c9 100644
--- a/libstdc++-v3/include/bits/ranges_algo.h
+++ b/libstdc++-v3/include/bits/ranges_algo.h
@@ -39,6 +39,13 @@
 #include <bits/ranges_util.h>
 #include <bits/uniform_int_dist.h> // concept uniform_random_bit_generator
 
+#define __glibcxx_want_ranges_contains
+#define __glibcxx_want_ranges_find_last
+#define __glibcxx_want_ranges_fold
+#define __glibcxx_want_ranges_iota
+#define __glibcxx_want_shift
+#include <bits/version.h>
+
 #if __cpp_lib_concepts
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -3465,10 +3472,7 @@ namespace ranges
 
   inline constexpr __prev_permutation_fn prev_permutation{};
 
-#if __cplusplus > 202002L
-
-#define __cpp_lib_ranges_contains 202207L
-
+#if __cpp_lib_ranges_contains >= 202207L // C++ >= 23
   struct __contains_fn
   {
     template<input_iterator _Iter, sentinel_for<_Iter> _Sent,
@@ -3522,7 +3526,9 @@ namespace ranges
 
   inline constexpr __contains_subrange_fn contains_subrange{};
 
-#define __cpp_lib_ranges_iota 202202L
+#endif // __cpp_lib_ranges_contains
+
+#if __cpp_lib_ranges_iota >= 202202L // C++ >= 23
 
   template<typename _Out, typename _Tp>
     struct out_value_result
@@ -3572,7 +3578,9 @@ namespace ranges
 
   inline constexpr __iota_fn iota{};
 
-#define __cpp_lib_ranges_find_last 202207L
+#endif // __cpp_lib_ranges_iota
+
+#if __cpp_lib_ranges_find_last >= 202207L // C++ >= 23
 
   struct __find_last_fn
   {
@@ -3700,7 +3708,9 @@ namespace ranges
 
   inline constexpr __find_last_if_not_fn find_last_if_not{};
 
-#define __cpp_lib_ranges_fold 202207L
+#endif // __cpp_lib_ranges_find_last
+
+#if __cpp_lib_ranges_fold >= 202207L // C++ >= 23
 
   template<typename _Iter, typename _Tp>
     struct in_value_result
@@ -3947,10 +3957,9 @@ namespace ranges
   };
 
   inline constexpr __fold_right_last_fn fold_right_last{};
-#endif // C++23
+#endif // __cpp_lib_ranges_fold
 } // namespace ranges
 
-#define __cpp_lib_shift 201806L
   template<typename _ForwardIterator>
     constexpr _ForwardIterator
     shift_left(_ForwardIterator __first, _ForwardIterator __last,
diff --git a/libstdc++-v3/include/bits/ranges_cmp.h b/libstdc++-v3/include/bits/ranges_cmp.h
index 6710d829a37..96fa79667e6 100644
--- a/libstdc++-v3/include/bits/ranges_cmp.h
+++ b/libstdc++-v3/include/bits/ranges_cmp.h
@@ -30,6 +30,9 @@
 #ifndef _RANGES_CMP_H
 #define _RANGES_CMP_H 1
 
+#define __glibcxx_want_ranges
+#include <bits/version.h>
+
 #if __cplusplus > 201703L
 # include <bits/move.h>
 # include <concepts>
@@ -55,14 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     using is_transparent = __is_transparent;
   };
 
-#ifdef __cpp_lib_concepts
-// Define this here, included by all the headers that need to define it.
-#if __cplusplus > 202002L
-#define __cpp_lib_ranges 202202L
-#else
-#define __cpp_lib_ranges 202110L
-#endif
-
+#ifdef __cpp_lib_ranges // C++ >= 20
 namespace ranges
 {
   namespace __detail
@@ -179,7 +175,7 @@ namespace ranges
   };
 
 } // namespace ranges
-#endif // library concepts
+#endif // __cpp_lib_ranges
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++20
diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h
index 2c24eada950..9b5ee571c3e 100644
--- a/libstdc++-v3/include/bits/shared_ptr.h
+++ b/libstdc++-v3/include/bits/shared_ptr.h
@@ -52,6 +52,10 @@
 #include <iosfwd>           	  // std::basic_ostream
 #include <bits/shared_ptr_base.h>
 
+#define __glibcxx_want_shared_ptr_weak_type
+#define __glibcxx_want_enable_shared_from_this
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -189,8 +193,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       /// The type pointed to by the stored pointer, remove_extent_t<_Tp>
       using element_type = typename __shared_ptr<_Tp>::element_type;
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_shared_ptr_weak_type 201606L
+#ifdef __cpp_lib_shared_ptr_weak_type // C++ >= 17 && HOSTED
       /// The corresponding weak_ptr type for this shared_ptr
       /// @since C++17
       using weak_type = weak_ptr<_Tp>;
@@ -938,8 +941,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       shared_from_this() const
       { return shared_ptr<const _Tp>(this->_M_weak_this); }
 
-#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
-#define __cpp_lib_enable_shared_from_this 201603L
+#ifdef __cpp_lib_enable_shared_from_this // C++ >= 17 && HOSTED
       /** @{
        * Get a `weak_ptr` referring to the object that has `*this` as its base.
        * @since C++17
diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h b/libstdc++-v3/include/bits/shared_ptr_atomic.h
index b56b8153a89..ae2d1b7a094 100644
--- a/libstdc++-v3/include/bits/shared_ptr_atomic.h
+++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h
@@ -32,6 +32,9 @@
 
 #include <bits/atomic_base.h>
 
+#define __glibcxx_want_atomic_shared_ptr
+#include <bits/version.h>
+
 // Annotations for the custom locking in atomic<shared_ptr<T>>.
 #if defined _GLIBCXX_TSAN && __has_include(<sanitizer/tsan_interface.h>)
 #include <sanitizer/tsan_interface.h>
@@ -355,8 +358,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @} group pointer_abstractions
 
-#if __cplusplus >= 202002L
-# define __cpp_lib_atomic_shared_ptr 201711L
+#ifdef  __cpp_lib_atomic_shared_ptr // C++ >= 20 && HOSTED
   template<typename _Tp>
     struct atomic;
 
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 2c948d5b838..33282e596b2 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -67,6 +67,10 @@
 # include <bits/stl_uninitialized.h>
 #endif
 
+#define __glibcxx_want_smart_ptr_for_overwrite
+#define __glibcxx_want_shared_ptr_arrays
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -652,8 +656,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _Impl _M_impl;
     };
 
-#if __cplusplus >= 202002L
-# define __cpp_lib_smart_ptr_for_overwrite 202002L
+#ifdef __cpp_lib_smart_ptr_for_overwrite // C++ >= 20 && HOSTED
   struct _Sp_overwrite_tag { };
 
   // Partial specialization used for make_shared_for_overwrite<non-array>().
@@ -712,13 +715,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _M_get_deleter(const std::type_info&) noexcept override
       { return nullptr; }
     };
-#endif // C++20
-
-#if __cplusplus <= 201703L
-# define __cpp_lib_shared_ptr_arrays 201611L
-#else
-# define __cpp_lib_shared_ptr_arrays 201707L
+#endif // __cpp_lib_smart_ptr_for_overwrite
 
+#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED
   struct _Sp_overwrite_tag;
 
   // For make_shared<T[]>, make_shared<T[N]>, allocate_shared<T[]> etc.
@@ -880,7 +879,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _M_get_deleter(const std::type_info&) noexcept override
       { return nullptr; }
     };
-#endif // C++20
+#endif // __cpp_lib_shared_ptr_arrays >= 201707L
 
   // The default deleter for shared_ptr<T[]> and shared_ptr<T[N]>.
   struct __sp_array_delete
@@ -899,7 +898,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _Tp>
 	struct __not_alloc_shared_tag<_Sp_alloc_shared_tag<_Tp>> { };
 
-#if __cpp_lib_shared_ptr_arrays >= 201707L
+#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED
       template<typename _Alloc>
 	struct __not_alloc_shared_tag<_Sp_counted_array_base<_Alloc>> { };
 #endif
@@ -975,7 +974,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  __p = __pi->_M_ptr();
 	}
 
-#if __cpp_lib_shared_ptr_arrays >= 201707L
+#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED
       template<typename _Tp, typename _Alloc, typename _Init>
 	__shared_count(_Tp*& __p, const _Sp_counted_array_base<_Alloc>& __a,
 		       _Init __init)
@@ -1717,7 +1716,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	friend __shared_ptr<_Tp1, _Lp1>
 	__allocate_shared(const _Alloc& __a, _Args&&... __args);
 
-#if __cpp_lib_shared_ptr_arrays >= 201707L
+#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED
       // This constructor is non-standard, it is used by allocate_shared<T[]>.
       template<typename _Alloc, typename _Init = const remove_extent_t<_Tp>*>
 	__shared_ptr(const _Sp_counted_array_base<_Alloc>& __a,
diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h
index afb13857036..fdaaaf4576b 100644
--- a/libstdc++-v3/include/bits/specfun.h
+++ b/libstdc++-v3/include/bits/specfun.h
@@ -32,9 +32,9 @@
 
 #include <bits/c++config.h>
 
-#define __STDCPP_MATH_SPEC_FUNCS__ 201003L
-
-#define __cpp_lib_math_special_functions 201603L
+#define __glibcxx_want_math_spec_funcs
+#define __glibcxx_want_math_special_functions
+#include <bits/version.h>
 
 #if __cplusplus <= 201403L && __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
 # error include <cmath> and define __STDCPP_WANT_MATH_SPEC_FUNCS__
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 3abf0f69d46..637d53d6b95 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -72,6 +72,10 @@
 # endif
 #endif
 
+#define __glibcxx_want_clamp
+#define __glibcxx_want_sample
+#include <bits/version.h>
+
 // See concept_check.h for the __glibcxx_*_requires macros.
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -3598,11 +3602,9 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       return std::__is_permutation(__first1, __last1, __first2, __last2,
 				   __gnu_cxx::__ops::__iter_comp_iter(__pred));
     }
+#endif // C++14
 
-#if __cplusplus >= 201703L
-
-#define __cpp_lib_clamp 201603L
-
+#ifdef  __cpp_lib_clamp // C++ >= 17
   /**
    *  @brief  Returns the value clamped between lo and hi.
    *  @ingroup sorting_algorithms
@@ -3641,8 +3643,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       __glibcxx_assert(!__comp(__hi, __lo));
       return std::min(std::max(__val, __lo, __comp), __hi, __comp);
     }
-#endif // C++17
-#endif // C++14
+#endif // __cpp_lib_clamp
 
   /**
    *  @brief Generate two uniformly distributed integers using a
@@ -5812,9 +5813,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 	  }
       return __out;
     }
+#endif // C++14
 
-#if __cplusplus > 201402L
-#define __cpp_lib_sample 201603L
+#ifdef __cpp_lib_sample // C++ >= 17
   /// Take a random sample from a population.
   template<typename _PopulationIterator, typename _SampleIterator,
            typename _Distance, typename _UniformRandomBitGenerator>
@@ -5842,8 +5843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 	__sample(__first, __last, __pop_cat{}, __out, __samp_cat{}, __d,
 		 std::forward<_UniformRandomBitGenerator>(__g));
     }
-#endif // C++17
-#endif // C++14
+#endif // __cpp_lib_sample
 
 _GLIBCXX_END_NAMESPACE_ALGO
 _GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 2037d6c0443..2f5a4bd4fd4 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -79,6 +79,9 @@
 # include <compare>
 #endif
 
+#define __glibcxx_want_robust_nonmodifying_seq_ops
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1645,10 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     }
 #endif // C++11
 
-#if __cplusplus > 201103L
-
-#define __cpp_lib_robust_nonmodifying_seq_ops 201304L
-
+#ifdef __cpp_lib_robust_nonmodifying_seq_ops // C++ >= 14
   /**
    *  @brief Tests a range for element-wise equality.
    *  @ingroup non_mutating_algorithms
@@ -1710,7 +1710,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
       return _GLIBCXX_STD_A::__equal4(__first1, __last1, __first2, __last2,
 				      __binary_pred);
     }
-#endif // C++14
+#endif // __cpp_lib_robust_nonmodifying_seq_ops
 
   /**
    *  @brief Performs @b dictionary comparison on ranges.
@@ -1952,8 +1952,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 	__gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
     }
 
-#if __cplusplus > 201103L
-
+#if __cpp_lib_robust_nonmodifying_seq_ops // C++ >= 14
   template<typename _InputIterator1, typename _InputIterator2,
 	   typename _BinaryPredicate>
     _GLIBCXX20_CONSTEXPR
diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h
index fa03f32b1b8..608d4e96fb2 100644
--- a/libstdc++-v3/include/bits/stl_function.h
+++ b/libstdc++-v3/include/bits/stl_function.h
@@ -60,6 +60,9 @@
 #include <bits/move.h>
 #endif
 
+#define __glibcxx_want_transparent_operators
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -153,7 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @{
    */
 
-#if __cplusplus > 201103L
+#if __cpp_lib_transparent_operators // C++ >= 14
   struct __is_transparent;  // undefined
 
   template<typename _Tp = void>
@@ -241,10 +244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 #pragma GCC diagnostic pop
 
-#if __cplusplus > 201103L
-
-#define __cpp_lib_transparent_operators 201510L
-
+#ifdef __cpp_lib_transparent_operators // C++ >= 14
   template<>
     struct plus<void>
     {
@@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *
    *  @{
    */
-#if __cplusplus > 201103L
+#if __cpp_lib_transparent_operators // C++ >= 14
   template<typename _Tp = void>
     struct equal_to;
 
@@ -489,7 +489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 #pragma GCC diagnostic pop
 
-#if __cplusplus >= 201402L
+#ifdef __cpp_lib_transparent_operators // C++ >= 14
   /// One of the @link comparison_functors comparison functors@endlink.
   template<>
     struct equal_to<void>
@@ -765,7 +765,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	      is_convertible<_Tp, const volatile void*>,
 	      is_convertible<_Up, const volatile void*>>;
     };
-#endif // C++14
+#endif // __cpp_lib_transparent_operators
   /** @}  */
 
   // 20.3.4 logical operations
@@ -777,7 +777,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *
    *  @{
    */
-#if __cplusplus > 201103L
+#ifdef __cpp_lib_transparent_operators // C++ >= 14
   template<typename _Tp = void>
     struct logical_and;
 
@@ -822,7 +822,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 #pragma GCC diagnostic pop
 
-#if __cplusplus > 201103L
+#ifdef __cpp_lib_transparent_operators // C++ >= 14
   /// One of the @link logical_functors Boolean operations functors@endlink.
   template<>
     struct logical_and<void>
@@ -867,10 +867,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       typedef __is_transparent is_transparent;
     };
-#endif
+#endif // __cpp_lib_transparent_operators
   /** @}  */
 
-#if __cplusplus > 201103L
+#ifdef __cpp_lib_transparent_operators // C++ >= 14
   template<typename _Tp = void>
     struct bit_and;
 
@@ -926,7 +926,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 #pragma GCC diagnostic pop
 
-#if __cplusplus > 201103L
+#ifdef __cpp_lib_transparent_operators // C++ >= 14
   template <>
     struct bit_and<void>
     {
@@ -1416,7 +1416,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /** @}  */
 
-#if __cplusplus >= 201402L
+#ifdef __cpp_lib_transparent_operators // C++ >= 14
   template<typename _Func, typename _SfinaeType, typename = __void_t<>>
     struct __has_is_transparent
     { };
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index b13f4f8ddbf..b75f87e056d 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -70,12 +70,11 @@
 # include <type_traits>
 #endif
 
-#if __cplusplus > 201703L
-# define __cpp_lib_array_constexpr 201811L
-# define __cpp_lib_constexpr_iterator 201811L
-#elif __cplusplus == 201703L
-# define __cpp_lib_array_constexpr 201803L
-#endif
+#define __glibcxx_want_constexpr_iterator
+#define __glibcxx_want_array_constexpr
+#define __glibcxx_want_make_reverse_iterator
+#define __glibcxx_want_move_iterator_concept
+#include <bits/version.h>
 
 #if __cplusplus >= 202002L
 # include <compare>
@@ -642,9 +641,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __make_reverse_iterator(_Iterator __i)
     { return reverse_iterator<_Iterator>(__i); }
 
-# if __cplusplus >= 201402L
-#  define __cpp_lib_make_reverse_iterator 201402L
-
+# ifdef __cpp_lib_make_reverse_iterator // C++ >= 14
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // DR 2285. make_reverse_iterator
   /// Generator function for reverse_iterator.
@@ -661,7 +658,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     disable_sized_sentinel_for<reverse_iterator<_Iterator1>,
 			       reverse_iterator<_Iterator2>> = true;
 #  endif // C++20
-# endif // C++14
+# endif // __cpp_lib_make_reverse_iterator
 
   template<typename _Iterator>
     _GLIBCXX20_CONSTEXPR
@@ -1461,7 +1458,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _Iter2>
 	friend class move_iterator;
 
-#if __cpp_lib_concepts
+#if __cpp_lib_concepts // C++20 && concepts
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // 3435. three_way_comparable_with<reverse_iterator<int*>, [...]>
       template<typename _Iter2>
@@ -1487,9 +1484,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     public:
       using iterator_type = _Iterator;
 
-#if __cplusplus > 201703L && __cpp_lib_concepts
-      // This is P2520R0, a C++23 change, but we treat it as a DR against C++20.
-# define __cpp_lib_move_iterator_concept 202207L
+#ifdef __cpp_lib_move_iterator_concept // C++ >= 20 && lib_concepts
       using iterator_concept = decltype(_S_iter_concept());
 
       // iterator_category defined in __move_iter_cat
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index bf1f1b37ab4..82256b7f1c5 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -65,6 +65,9 @@
 #include <ext/aligned_buffer.h>
 #endif
 
+#define __glibcxx_want_list_remove_return_type
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1761,8 +1764,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 #endif
 
     private:
-#if __cplusplus > 201703L
-# define __cpp_lib_list_remove_return_type 201806L
+#ifdef __cpp_lib_list_remove_return_type // C++ >= 20 && HOSTED
       typedef size_type __remove_return_type;
 # define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \
       __attribute__((__abi_tag__("__cxx20")))
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 059916d0a7f..02cce9b37d8 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -63,6 +63,9 @@
 #include <tuple>
 #endif
 
+#define __glibcxx_want_map_try_emplace
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -696,8 +699,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	{ merge(__source); }
 #endif // C++17
 
-#if __cplusplus > 201402L
-#define __cpp_lib_map_try_emplace 201411L
+#ifdef __cpp_lib_map_try_emplace // C++ >= 17 && HOSTED
       /**
        *  @brief Attempts to build and insert a std::pair into the %map.
        *
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 3f1624f40b4..197a90987e6 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -63,9 +63,12 @@
 #endif
 #if __cplusplus >= 202002L
 # include <compare>
-# define __cpp_lib_constexpr_utility 201811L
 #endif
 
+#define __glibcxx_want_constexpr_utility
+#define __glibcxx_want_tuples_by_type
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1050,10 +1053,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     get(const pair<_Tp1, _Tp2>&& __in) noexcept
     { return __pair_get<_Int>::__const_move_get(std::move(__in)); }
 
-#if __cplusplus >= 201402L
-
-#define __cpp_lib_tuples_by_type 201304L
 
+#ifdef __cpp_lib_tuples_by_type // C++ >= 14
   template <typename _Tp, typename _Up>
     constexpr _Tp&
     get(pair<_Tp, _Up>& __p) noexcept
@@ -1093,6 +1094,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr const _Tp&&
     get(const pair<_Up, _Tp>&& __p) noexcept
     { return std::move(__p.second); }
+#endif // __cpp_lib_tuples_by_type
+
 
 #if __cplusplus > 202002L
   template<typename _T1, typename _T2, typename _U1, typename _U2,
@@ -1111,7 +1114,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   { using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; };
 #endif // C++23
 
-#endif // C++14
   /// @}
 #endif // C++11
 
diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h
index 8a8dc95f889..1d22578eb1e 100644
--- a/libstdc++-v3/include/bits/stl_queue.h
+++ b/libstdc++-v3/include/bits/stl_queue.h
@@ -62,6 +62,9 @@
 # include <bits/uses_allocator.h>
 #endif
 
+#define __glibcxx_want_adaptor_iterator_pair_constructor
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -194,10 +197,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
 	queue(queue&& __q, const _Alloc& __a)
 	: c(std::move(__q.c), __a) { }
+#endif
 
-#if __cplusplus > 202002L
-#define __cpp_lib_adaptor_iterator_pair_constructor 202106L
-
+#ifdef __cpp_lib_adaptor_iterator_pair_constructor // C++ >= 23 && HOSTED
       template<typename _InputIterator,
 	       typename = _RequireInputIter<_InputIterator>>
 	queue(_InputIterator __first, _InputIterator __last)
@@ -208,7 +210,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	       typename = _Uses<_Alloc>>
 	queue(_InputIterator __first, _InputIterator __last, const _Alloc& __a)
 	: c(__first, __last, __a) { }
-#endif
 #endif
 
       /**
diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h
index 006b18c9683..2d09098ca86 100644
--- a/libstdc++-v3/include/bits/stl_stack.h
+++ b/libstdc++-v3/include/bits/stl_stack.h
@@ -62,6 +62,9 @@
 # include <bits/uses_allocator.h>
 #endif
 
+#define __glibcxx_want_adaptor_iterator_pair_constructor
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -170,9 +173,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       stack(_Sequence&& __c)
       : c(std::move(__c)) { }
 
-#if __cplusplus > 202002L
-#define __cpp_lib_adaptor_iterator_pair_constructor 202106L
-
+#ifdef __cpp_lib_adaptor_iterator_pair_constructor // C++ >= 23 && HOSTED
       template<typename _InputIterator,
 	       typename = _RequireInputIter<_InputIterator>>
 	stack(_InputIterator __first, _InputIterator __last)
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index f870f3dfa53..1cf887b028e 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -72,14 +72,13 @@
 # include <bits/node_handle.h>
 #endif
 
+#define __glibcxx_want_generic_associative_lookup
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#if __cplusplus > 201103L
-# define __cpp_lib_generic_associative_lookup 201304L
-#endif
-
   // Red-black tree class, designed for use in implementing STL
   // associative containers (set, multiset, map, and multimap). The
   // insertion and deletion algorithms are based on those in Cormen,
diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h
index 474a9a11297..5174cfbcbe2 100644
--- a/libstdc++-v3/include/bits/stl_uninitialized.h
+++ b/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -67,6 +67,9 @@
 #include <bits/stl_pair.h>
 #endif
 
+#define __glibcxx_want_raw_memory_algorithms
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -963,9 +966,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// @endcond
 #endif
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_raw_memory_algorithms 201606L
-
+#ifdef __cpp_lib_raw_memory_algorithms // C++ >= 17
   /**
    *  @brief Default-initializes objects in the range [first,last).
    *  @param  __first  A forward iterator.
@@ -1058,7 +1059,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	 __count, __result);
       return {__res.first.base(), __res.second};
     }
-#endif // C++17
+#endif // __cpp_lib_raw_memory_algorithms
 
 #if __cplusplus >= 201103L
   /// @cond undocumented
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index 70ced3d101f..1a353397e07 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -64,9 +64,11 @@
 #endif
 #if __cplusplus >= 202002L
 # include <compare>
-#define __cpp_lib_constexpr_vector 201907L
 #endif
 
+#define __glibcxx_want_constexpr_vector
+#include <bits/version.h>
+
 #include <debug/assertions.h>
 
 #if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR
diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h
index f0c6d2383b4..d92fe79e2f2 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -1,3 +1,4 @@
+
 // unique_ptr implementation -*- C++ -*-
 
 // Copyright (C) 2008-2023 Free Software Foundation, Inc.
@@ -43,12 +44,9 @@
 # endif
 #endif
 
-/* Duplicate definition with ptr_traits.h.  */
-#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
-# define __cpp_lib_constexpr_memory 202202L
-#elif __cplusplus > 201703L
-# define __cpp_lib_constexpr_memory 201811L
-#endif
+#define __glibcxx_want_constexpr_memory
+#define __glibcxx_want_make_unique
+#include <bits/version.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -1029,9 +1027,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       public __uniq_ptr_hash<unique_ptr<_Tp, _Dp>>
     { };
 
-#if __cplusplus >= 201402L && _GLIBCXX_HOSTED
-#define __cpp_lib_make_unique 201304L
-
+#ifdef __cpp_lib_make_unique // C++ >= 14 && HOSTED
   /// @cond undocumented
 namespace __detail
 {
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 2f63bc5f1fa..4c9a6bae2fd 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -35,6 +35,9 @@
 #include <bits/functional_hash.h> // hash
 #include <bits/stl_function.h>    // equal_to
 
+#define __glibcxx_want_unordered_map_try_emplace
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -449,8 +452,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       iterator
       insert(const_iterator, node_type&& __nh)
       { return _M_h._M_reinsert_node(std::move(__nh)).position; }
+#endif // C++17
 
-#define __cpp_lib_unordered_map_try_emplace 201411L
+#ifdef __cpp_lib_unordered_map_try_emplace // C++ >= 17 && HOSTED
       /**
        *  @brief Attempts to build and insert a std::pair into the
        *  %unordered_map.
@@ -534,7 +538,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	  return _M_h.try_emplace(__hint, std::move(__k),
 				  std::forward<_Args>(__args)...).first;
 	}
-#endif // C++17
+#endif // __cpp_lib_unordered_map_try_emplace
 
       ///@{
       /**
diff --git a/libstdc++-v3/include/bits/uses_allocator_args.h b/libstdc++-v3/include/bits/uses_allocator_args.h
index bc038f03458..a4eae74d5e9 100644
--- a/libstdc++-v3/include/bits/uses_allocator_args.h
+++ b/libstdc++-v3/include/bits/uses_allocator_args.h
@@ -32,8 +32,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus > 201703L && __cpp_concepts
+#define __glibcxx_want_make_obj_using_allocator
+#include <bits/version.h>
 
+#ifdef __cpp_lib_make_obj_using_allocator // C++ >= 20 && concepts
 #include <new>			// for placement operator new
 #include <tuple>		// for tuple, make_tuple, make_from_tuple
 #include <bits/stl_construct.h> // construct_at
@@ -49,10 +51,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 /** @addtogroup allocators
  *  @{
  */
-
-// Not specified by C++20, used internally
-#define __cpp_lib_make_obj_using_allocator 201811L
-
   template<typename _Tp, typename _Alloc, typename... _Args>
     constexpr auto
     uses_allocator_construction_args(const _Alloc& __a,
@@ -247,5 +245,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 /// @}
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20
+#endif // __cpp_lib_make_obj_using_allocator
 #endif // _USES_ALLOCATOR_ARGS
diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h
index 4692aa0c9b0..bed94525642 100644
--- a/libstdc++-v3/include/bits/utility.h
+++ b/libstdc++-v3/include/bits/utility.h
@@ -35,6 +35,11 @@
 
 #pragma GCC system_header
 
+#define __glibcxx_want_tuple_element_t
+#define __glibcxx_want_integer_sequence
+#define __glibcxx_want_ranges_zip
+#include <bits/version.h>
+
 #if __cplusplus >= 201103L
 
 #include <type_traits>
@@ -123,17 +128,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
       return __n;
     }
+#endif // C++14
 
 // The standard says this macro and alias template should be in <tuple> but we
 // define them here, to be available in <array>, <utility> and <ranges> too.
 // _GLIBCXX_RESOLVE_LIB_DEFECTS
 // 3378. tuple_size_v/tuple_element_t should be available when
 //       tuple_size/tuple_element are
-#define __cpp_lib_tuple_element_t 201402L
-
+#ifdef __cpp_lib_tuple_element_t // C++ >= 14
   template<size_t __i, typename _Tp>
     using tuple_element_t = typename tuple_element<__i, _Tp>::type;
-#endif // C++14
+#endif
 
   // Stores a tuple of indices.  Used by tuple and pair, and by bind() to
   // extract the elements in a tuple.
@@ -155,9 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
     };
 
-#if __cplusplus >= 201402L
-
-#define __cpp_lib_integer_sequence 201304L
+#ifdef __cpp_lib_integer_sequence // C++ >= 14
 
   /// Class template integer_sequence
   template<typename _Tp, _Tp... _Idx>
@@ -187,6 +190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// Alias template index_sequence_for
   template<typename... _Types>
     using index_sequence_for = make_index_sequence<sizeof...(_Types)>;
+#endif // __cpp_lib_integer_sequence
 
 #if __cplusplus >= 201703L
 
@@ -222,7 +226,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     using __is_in_place_type = bool_constant<__is_in_place_type_v<_Tp>>;
 
 #endif // C++17
-#endif // C++14
 
 #if __has_builtin(__type_pack_element)
   template<size_t _Np, typename... _Types>
@@ -269,10 +272,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 #endif
 
-#if __cplusplus > 202002L
-#define __cpp_lib_ranges_zip 202110L // for <tuple> and <utility>
-#endif
-
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h
index 0b633262d08..52daa16c9b1 100644
--- a/libstdc++-v3/include/c_compatibility/stdatomic.h
+++ b/libstdc++-v3/include/c_compatibility/stdatomic.h
@@ -29,11 +29,12 @@
 #ifndef _GLIBCXX_STDATOMIC_H
 #define _GLIBCXX_STDATOMIC_H
 
-#if __cplusplus > 202002L
+#define __glibcxx_want_stdatomic_h
+#include <bits/version.h>
+
+#ifdef __cpp_lib_stdatomic_h // C++ >= 23
 #include <atomic>
 
-#define __cpp_lib_stdatomic_h 202011L
-
 #define _Atomic(_Tp) std::atomic<_Tp>
 
 using std::memory_order;
@@ -126,5 +127,5 @@ using std::atomic_signal_fence;
 
 #elif defined __clang__
 # include_next <stdatomic.h>
-#endif // C++23
+#endif // __cpp_lib_stdatomic_h
 #endif // _GLIBCXX_STDATOMIC_H
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index caa95e340c8..6461c92ebfe 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -51,6 +51,10 @@
 #ifndef _GLIBCXX_CMATH
 #define _GLIBCXX_CMATH 1
 
+#define __glibcxx_want_hypot
+#define __glibcxx_want_interpolate
+#include <bits/version.h>
+
 // Get rid of those macros defined in <math.h> in lieu of real functions.
 #undef div
 #undef acos
@@ -3544,11 +3548,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif // _GLIBCXX_USE_C99_MATH_FUNCS
 #endif // C++11
 
-#if __cplusplus >= 201703L
-
+#ifdef __cpp_lib_hypot // C++ >= 17 && HOSTED
   // [c.math.hypot3], three-dimensional hypotenuse
-#define __cpp_lib_hypot 201603L
-
   template<typename _Tp>
     inline _Tp
     __hypot3(_Tp __x, _Tp __y, _Tp __z)
@@ -3616,12 +3617,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   { return std::__hypot3<__gnu_cxx::__bfloat16_t>(__x, __y, __z); }
 #endif
 
-#endif // C++17
+#endif // __cpp_lib_hypot
 
-#if __cplusplus >= 202002L
+#ifdef __cpp_lib_interpolate // C++ >= 20
   // linear interpolation
-# define __cpp_lib_interpolate 201902L
-
   template<typename _Fp>
     constexpr _Fp
     __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept
@@ -3691,8 +3690,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   lerp(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __z) noexcept
   { return std::__lerp<__gnu_cxx::__bfloat16_t>(__x, __y, __z); }
 #endif
-
-#endif // C++20
+#endif // __cpp_lib_interpolate
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef
index 728ac796542..3cdd551d3ae 100644
--- a/libstdc++-v3/include/c_global/cstddef
+++ b/libstdc++-v3/include/c_global/cstddef
@@ -49,6 +49,9 @@
 #include <bits/c++config.h>
 #include <stddef.h>
 
+#define __glibcxx_want_byte
+#include <bits/version.h>
+
 extern "C++"
 {
 #if __cplusplus >= 201103L
@@ -59,12 +62,10 @@ namespace std
 }
 #endif // C++11
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_byte // C++ >= 17
 namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_byte 201603L
-
   /// std::byte
   enum class byte : unsigned char {};
 
@@ -185,7 +186,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++17
+#endif // __cpp_lib_byte
 } // extern "C++"
 
 #endif // _GLIBCXX_CSTDDEF
diff --git a/libstdc++-v3/include/std/algorithm b/libstdc++-v3/include/std/algorithm
index fc393eeacf7..c6ebb86e6a9 100644
--- a/libstdc++-v3/include/std/algorithm
+++ b/libstdc++-v3/include/std/algorithm
@@ -63,7 +63,10 @@
 # include <bits/ranges_algo.h>
 #endif
 
-#if __cplusplus > 201402L && _GLIBCXX_HOSTED
+#define __glibcxx_want_parallel_algorithm
+#include <bits/version.h>
+
+#if __cpp_lib_parallel_algorithm // C++ >= 17 && HOSTED
 // Parallel STL algorithms
 # if _PSTL_EXECUTION_POLICIES_DEFINED
 // If <execution> has already been included, pull in implementations
@@ -73,10 +76,7 @@
 #    include <pstl/glue_algorithm_defs.h>
 #    define _PSTL_ALGORITHM_FORWARD_DECLARED 1
 #  endif
-
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
-#endif // C++17 && HOSTED
+#endif
 
 #ifdef _GLIBCXX_PARALLEL
 # include <parallel/algorithm>
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index a221445df27..b2afdc0a1cb 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -31,7 +31,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus >= 201703L
+#define __glibcxx_want_any
+#include <bits/version.h>
+
+#ifdef __cpp_lib_any // C++ >= 17
 
 #include <initializer_list>
 #include <typeinfo>
@@ -67,8 +70,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
   }
 
-#define __cpp_lib_any 201606L
-
   /**
    *  @brief A type-safe container of any type.
    *
@@ -652,5 +653,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // C++17
+#endif // defined(__glibcxx_any)
 #endif // _GLIBCXX_ANY
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index ad36cdad6d2..0e32d7b52d0 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -45,6 +45,9 @@
 #include <bits/utility.h>      // std::index_sequence, std::tuple_size
 #include <debug/assertions.h>
 
+#define __glibcxx_want_to_array
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -297,7 +300,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
     { return std::equal(__one.begin(), __one.end(), __two.begin()); }
 
-#if __cpp_lib_three_way_comparison && __cpp_lib_concepts
+#if __cpp_lib_three_way_comparison // C++ >= 20 && lib_concepts
   template<typename _Tp, size_t _Nm>
     [[nodiscard]]
     constexpr __detail::__synth3way_t<_Tp>
@@ -414,8 +417,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return std::move(std::get<_Int>(__arr));
     }
 
-#if __cplusplus >= 202002L && __cpp_generic_lambdas >= 201707L
-#define __cpp_lib_to_array 201907L
+#ifdef __cpp_lib_to_array // C++ >= 20 && __cpp_generic_lambdas >= 201707L
   template<typename _Tp, size_t _Nm>
     [[nodiscard]]
     constexpr array<remove_cv_t<_Tp>, _Nm>
@@ -473,7 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       else
 	__builtin_unreachable(); // FIXME: see PR c++/91388
     }
-#endif // C++20
+#endif // __cpp_lib_to_array
 
   // Tuple interface to class template array.
 
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 111df2a978b..d259239c683 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -38,6 +38,12 @@
 # include <bits/c++0x_warning.h>
 #else
 
+#define __glibcxx_want_atomic_is_always_lock_free
+#define __glibcxx_want_atomic_float
+#define __glibcxx_want_atomic_ref
+#define __glibcxx_want_atomic_lock_free_type_aliases
+#include <bits/version.h>
+
 #include <bits/atomic_base.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -49,10 +55,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    * @{
    */
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_atomic_is_always_lock_free 201603L
-#endif
-
   template<typename _Tp>
     struct atomic;
 
@@ -95,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     bool
     is_lock_free() const volatile noexcept { return _M_base.is_lock_free(); }
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
     static constexpr bool is_always_lock_free = ATOMIC_BOOL_LOCK_FREE == 2;
 #endif
 
@@ -268,7 +270,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	    reinterpret_cast<void *>(-_S_alignment));
       }
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free
 	= __atomic_always_lock_free(sizeof(_M_i), 0);
 #endif
@@ -557,7 +559,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       is_lock_free() const volatile noexcept
       { return _M_b.is_lock_free(); }
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free
 	= ATOMIC_POINTER_LOCK_FREE == 2;
 #endif
@@ -720,7 +722,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
 #endif
     };
@@ -743,7 +745,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
 #endif
     };
@@ -766,7 +768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
 #endif
     };
@@ -789,7 +791,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_SHORT_LOCK_FREE == 2;
 #endif
     };
@@ -812,7 +814,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_SHORT_LOCK_FREE == 2;
 #endif
     };
@@ -835,7 +837,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_INT_LOCK_FREE == 2;
 #endif
     };
@@ -858,7 +860,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_INT_LOCK_FREE == 2;
 #endif
     };
@@ -881,7 +883,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_LONG_LOCK_FREE == 2;
 #endif
     };
@@ -904,7 +906,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_LONG_LOCK_FREE == 2;
 #endif
     };
@@ -927,7 +929,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_LLONG_LOCK_FREE == 2;
 #endif
     };
@@ -950,7 +952,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_LLONG_LOCK_FREE == 2;
 #endif
     };
@@ -973,7 +975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free = ATOMIC_WCHAR_T_LOCK_FREE == 2;
 #endif
     };
@@ -997,7 +999,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus > 201402L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free
 	= ATOMIC_CHAR8_T_LOCK_FREE == 2;
 #endif
@@ -1022,7 +1024,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free
 	= ATOMIC_CHAR16_T_LOCK_FREE == 2;
 #endif
@@ -1046,7 +1048,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::operator __integral_type;
       using __base_type::operator=;
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
       static constexpr bool is_always_lock_free
 	= ATOMIC_CHAR32_T_LOCK_FREE == 2;
 #endif
@@ -1614,8 +1616,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		     __atomic_val_t<_ITp> __i) noexcept
     { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
 
-#if __cplusplus > 201703L
-#define __cpp_lib_atomic_float 201711L
+#if __cpp_lib_atomic_float
   template<>
     struct atomic<float> : __atomic_float<float>
     {
@@ -1745,9 +1746,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __atomic_float<__gnu_cxx::__bfloat16_t>::operator=;
     };
 #endif
+#endif // defined(__cpp_lib_atomic_float)
 
-#define __cpp_lib_atomic_ref 201806L
-
+#ifdef __cpp_lib_atomic_ref
   /// Class template to provide atomic operations on a non-atomic variable.
   template<typename _Tp>
     struct atomic_ref : __atomic_ref<_Tp>
@@ -1762,26 +1763,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       using __atomic_ref<_Tp>::operator=;
     };
+#endif // defined(__cpp_lib_atomic_ref)
 
-#define __cpp_lib_atomic_lock_free_type_aliases 201907L
-#ifdef _GLIBCXX_HAVE_PLATFORM_WAIT
+#ifdef __cpp_lib_atomic_lock_free_type_aliases
+# ifdef _GLIBCXX_HAVE_PLATFORM_WAIT
   using atomic_signed_lock_free
     = atomic<make_signed_t<__detail::__platform_wait_t>>;
   using atomic_unsigned_lock_free
     = atomic<make_unsigned_t<__detail::__platform_wait_t>>;
-#elif ATOMIC_INT_LOCK_FREE || !(ATOMIC_LONG_LOCK_FREE || ATOMIC_CHAR_LOCK_FREE)
+# elif ATOMIC_INT_LOCK_FREE || !(ATOMIC_LONG_LOCK_FREE || ATOMIC_CHAR_LOCK_FREE)
   using atomic_signed_lock_free = atomic<signed int>;
   using atomic_unsigned_lock_free = atomic<unsigned int>;
-#elif ATOMIC_LONG_LOCK_FREE
+# elif ATOMIC_LONG_LOCK_FREE
   using atomic_signed_lock_free = atomic<signed long>;
   using atomic_unsigned_lock_free = atomic<unsigned long>;
-#elif ATOMIC_CHAR_LOCK_FREE
+# elif ATOMIC_CHAR_LOCK_FREE
   using atomic_signed_lock_free = atomic<signed char>;
   using atomic_unsigned_lock_free = atomic<unsigned char>;
+# else
+# error "libstdc++ bug: no lock-free atomics but they were emitted in version?"
+# endif
 #endif
 
-#endif // C++2a
-
   /// @} group atomics
 
 _GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/barrier b/libstdc++-v3/include/std/barrier
index 6070ad5cd27..f25f47823a2 100644
--- a/libstdc++-v3/include/std/barrier
+++ b/libstdc++-v3/include/std/barrier
@@ -42,16 +42,16 @@
 
 #include <bits/requires_hosted.h> // threading primitive
 
-#if __cplusplus > 201703L
+#define __glibcxx_want_barrier
+#include <bits/version.h>
+
+#ifdef __cpp_lib_barrier // C++ >= 20 && __cpp_aligned_new && lib_atomic_wait
 #include <bits/atomic_base.h>
-#if __cpp_lib_atomic_wait && __cpp_aligned_new
 #include <bits/std_thread.h>
 #include <bits/unique_ptr.h>
 
 #include <array>
 
-#define __cpp_lib_barrier 201907L
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -261,6 +261,5 @@ It looks different from literature pseudocode for two main reasons:
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
-#endif // __cpp_lib_atomic_wait && __cpp_aligned_new
-#endif // __cplusplus > 201703L
+#endif // defined(__cpp_lib_barrier)
 #endif // _GLIBCXX_BARRIER
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index 5eb40218be9..ff66ee51bf4 100644
--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -52,6 +52,13 @@ namespace __gnu_cxx
 /// @endcond
 #endif
 
+#define __glibcxx_want_bit_cast
+#define __glibcxx_want_byteswap
+#define __glibcxx_want_bitops
+#define __glibcxx_want_int_pow2
+#define __glibcxx_want_endian
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -65,8 +72,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    * @{
    */
 
-#if __cplusplus > 201703l && __has_builtin(__builtin_bit_cast)
-#define __cpp_lib_bit_cast 201806L
+#ifdef __cpp_lib_bit_cast // C++ >= 20
 
   /// Create a value of type `To` from the bits of `from`.
   /**
@@ -86,10 +92,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       return __builtin_bit_cast(_To, __from);
     }
-#endif
+#endif // defined(__cpp_lib_bit_cast)
 
-#if __cplusplus > 202002L
-#define __cpp_lib_byteswap 202110L
+#ifdef __cpp_lib_byteswap // C++ >= 23
 
   /// Reverse order of bytes in the object representation of `value`.
   /**
@@ -142,7 +147,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
       return __val;
     }
-#endif
+#endif // defined(__cpp_lib_byteswap)
 
   /// @cond undocumented
 
@@ -370,9 +375,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @endcond
 
-#if __cplusplus > 201703L
-
-#define __cpp_lib_bitops 201907L
+#ifdef __cpp_lib_bitops // C++ >= 20
 
   /// @cond undocumented
   template<typename _Tp, typename _Up = _Tp>
@@ -425,11 +428,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr _If_is_unsigned_integer<_Tp, int>
     popcount(_Tp __x) noexcept
     { return std::__popcount(__x); }
+#endif // defined(__cpp_lib_bitops)
 
+#ifdef __cpp_lib_int_pow2 // C++ >= 20
   // [bit.pow.two], integral powers of 2
 
-#define __cpp_lib_int_pow2 202002L
-
   /// True if `x` is a power of two, false otherwise.
   template<typename _Tp>
     constexpr _If_is_unsigned_integer<_Tp, bool>
@@ -455,8 +458,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr _If_is_unsigned_integer<_Tp, int>
     bit_width(_Tp __x) noexcept
     { return std::__bit_width(__x); }
+#endif // defined (__cpp_lib_int_pow2)
 
-#define __cpp_lib_endian 201907L
+#ifdef __cpp_lib_endian // C++ >= 20
 
   /// Byte order constants
   /**
@@ -471,7 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     big    = __ORDER_BIG_ENDIAN__,
     native = __BYTE_ORDER__
   };
-#endif // C++2a
+#endif // defined(__cpp_lib_endian)
 
   /// @}
 
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index acd5768d6f6..a0379ed101a 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -58,6 +58,9 @@
 # include <bits/functional_hash.h>
 #endif
 
+#define __glibcxx_want_constexpr_bitset
+#include <bits/version.h>
+
 #define _GLIBCXX_BITSET_BITS_PER_WORD  (__CHAR_BIT__ * __SIZEOF_LONG__)
 #define _GLIBCXX_BITSET_WORDS(__n) \
   ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
@@ -69,10 +72,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
-#if __cplusplus > 202002L && _GLIBCXX_HOSTED
-# define __cpp_lib_constexpr_bitset 202202L
-#endif
-
   /**
    *  Base class, general case.  It is a class invariant that _Nw will be
    *  nonnegative.
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index cf2b1161014..01711d38576 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -45,14 +45,9 @@
 #include <bits/error_constants.h> // for std::errc
 #include <ext/numeric_traits.h>
 
-#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \
-    && __SIZE_WIDTH__ >= 32 && _GLIBCXX_HOSTED
-# define __cpp_lib_to_chars 201611L
-#endif
-
-#if __cplusplus > 202002L
-# define __cpp_lib_constexpr_charconv 202207L
-#endif
+#define __glibcxx_want_to_chars
+#define __glibcxx_want_constexpr_charconv
+#include <bits/version.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 6fdc0c86a27..10e868e5a03 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -50,11 +50,6 @@
 # include <bits/unique_ptr.h>
 #endif
 
-#if __cplusplus >= 202002L
-# undef __cpp_lib_chrono
-# define __cpp_lib_chrono 201907L
-#endif
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index a4abe9aa96a..b9e54199eaf 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -52,9 +52,9 @@
 #pragma clang diagnostic ignored "-Wc99-extensions"
 #endif
 
-#if __cplusplus > 201703L
-# define __cpp_lib_constexpr_complex 201711L
-#endif
+#define __glibcxx_want_constexpr_complex
+#define __glibcxx_want_complex_udls
+#include <bits/version.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -2604,13 +2604,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return std::complex<__type>(__x, -__type());
     }
 
-#if __cplusplus > 201103L
+#ifdef __cpp_lib_complex_udls // C++ >= 14
 
 inline namespace literals {
 inline namespace complex_literals {
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wliteral-suffix"
-#define __cpp_lib_complex_udls 201309L
 
   constexpr std::complex<float>
   operator""if(long double __num)
@@ -2640,7 +2639,7 @@ inline namespace complex_literals {
 } // inline namespace complex_literals
 } // inline namespace literals
 
-#endif // C++14
+#endif // defined(__cpp_lib_complex_udls)
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
diff --git a/libstdc++-v3/include/std/concepts b/libstdc++-v3/include/std/concepts
index d77f7e5647a..7ca3e94635d 100644
--- a/libstdc++-v3/include/std/concepts
+++ b/libstdc++-v3/include/std/concepts
@@ -30,10 +30,12 @@
 #ifndef _GLIBCXX_CONCEPTS
 #define _GLIBCXX_CONCEPTS 1
 
-#if __cplusplus > 201703L && __cpp_concepts >= 201907L
-
 #pragma GCC system_header
 
+#define __glibcxx_want_concepts
+#include <bits/version.h>
+
+#ifdef __cpp_lib_concepts // C++ >= 20 && concepts
 /**
  * @defgroup concepts Concepts
  * @ingroup utilities
@@ -47,8 +49,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_concepts 202002L
-
   // [concepts.lang], language-related concepts
 
   namespace __detail
@@ -376,6 +376,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
-#endif // C++2a
+#endif // defined(__cpp_lib_concepts)
 
 #endif /* _GLIBCXX_CONCEPTS */
diff --git a/libstdc++-v3/include/std/coroutine b/libstdc++-v3/include/std/coroutine
index b0ca18949db..14d0ea28b91 100644
--- a/libstdc++-v3/include/std/coroutine
+++ b/libstdc++-v3/include/std/coroutine
@@ -31,8 +31,14 @@
 
 #pragma GCC system_header
 
-// It is very likely that earlier versions would work, but they are untested.
-#if __cplusplus >= 201402L
+#define __glibcxx_want_coroutine
+#include <bits/version.h>
+
+#if !__cpp_impl_coroutine
+# error "the <coroutine> header requires -fcoroutines"
+#endif
+
+#ifdef __cpp_lib_coroutine // C++ >= 14 && impl_coroutine
 
 #include <type_traits>
 #if __cplusplus > 201703L
@@ -55,10 +61,6 @@ namespace std _GLIBCXX_VISIBILITY (default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#if __cpp_impl_coroutine
-
-#define __cpp_lib_coroutine 201902L
-
   inline namespace __n4861 {
 
   // C++20 17.12.2 coroutine traits
@@ -351,13 +353,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
     };
 
-#else
-#error "the <coroutine> header requires -fcoroutines"
-#endif
-
   _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // C++14 (we are allowing use from at least this)
+#endif // __cpp_lib_coroutine
 
 #endif // _GLIBCXX_COROUTINE
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index e3d50d2cf8b..259f2633453 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -68,6 +68,9 @@
 #include <bits/range_access.h>
 #include <bits/deque.tcc>
 
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
 #ifdef _GLIBCXX_DEBUG
 # include <debug/deque>
 #endif
@@ -86,13 +89,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++17
 
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && erase_if
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_erase_if 202002L
-
   template<typename _Tp, typename _Alloc, typename _Predicate>
     inline typename deque<_Tp, _Alloc>::size_type
     erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
@@ -134,6 +135,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20
+#endif // defined(__cpp_lib_erase_if)
 
 #endif /* _GLIBCXX_DEQUE */
diff --git a/libstdc++-v3/include/std/execution b/libstdc++-v3/include/std/execution
index 14c8bbeef4f..4349e2b9dd5 100644
--- a/libstdc++-v3/include/std/execution
+++ b/libstdc++-v3/include/std/execution
@@ -29,7 +29,12 @@
 
 #include <bits/requires_hosted.h> // execution policies are hosted only
 
-#if __cplusplus >= 201703L
+#define __glibcxx_want_parallel_algorithm
+#define __glibcxx_want_execution
+#include <bits/version.h>
+
+// C++ >= 17 && HOSTED
+#if defined(__cpp_lib_parallel_algorithm) || defined(__cpp_lib_execution)
 # include <bits/c++config.h>
 # include <pstl/glue_execution_defs.h>
 
@@ -50,10 +55,6 @@
 #  include <pstl/glue_memory_impl.h>
 # endif
 
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
-# define __cpp_lib_execution 201902L
-
 #endif // C++17
 
 #endif /* _GLIBCXX_EXECUTION */
diff --git a/libstdc++-v3/include/std/expected b/libstdc++-v3/include/std/expected
index a63557448f7..d9a1298f625 100644
--- a/libstdc++-v3/include/std/expected
+++ b/libstdc++-v3/include/std/expected
@@ -31,8 +31,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus > 202002L && __cpp_concepts >= 202002L
+#define __glibcxx_want_expected
+#include <bits/version.h>
 
+#ifdef __cpp_lib_expected // C++ >= 23 && __cpp_concepts >= 202002L
 #include <initializer_list>
 #include <bits/exception.h>	// exception
 #include <bits/invoke.h>	// __invoke
@@ -50,8 +52,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    * @{
    */
 
-#define __cpp_lib_expected 202211L
-
   /// Discriminated union that holds an expected value or an error value.
   /**
    * @since C++23
@@ -1815,5 +1815,5 @@ namespace __expected
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // C++23
+#endif // defined(__cpp_lib_expected)
 #endif // _GLIBCXX_EXPECTED
diff --git a/libstdc++-v3/include/std/filesystem b/libstdc++-v3/include/std/filesystem
index d46e842826d..69b5a9cae28 100644
--- a/libstdc++-v3/include/std/filesystem
+++ b/libstdc++-v3/include/std/filesystem
@@ -34,7 +34,10 @@
 
 #include <bits/requires_hosted.h>
 
-#if __cplusplus >= 201703L
+#define __glibcxx_want_filesystem
+#include <bits/version.h>
+
+#ifdef __cpp_lib_filesystem // C++ >= 17 && HOSTED
 
 /**
  * @defgroup filesystem File System
@@ -50,8 +53,6 @@
 #include <bits/fs_dir.h>
 #include <bits/fs_ops.h>
 
-#define __cpp_lib_filesystem 201703L
-
-#endif // C++17
+#endif // __cpp_lib_filesystem
 
 #endif // _GLIBCXX_FILESYSTEM
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index f4520ff3f74..1e0926ee660 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -33,7 +33,10 @@
 
 #include <bits/requires_hosted.h> // for std::string
 
-#if __cplusplus >= 202002L
+#define __glibcxx_want_format
+#include <bits/version.h>
+
+#ifdef __cpp_lib_format // C++ >= 20 && HOSTED
 
 #include <array>
 #include <charconv>
@@ -60,18 +63,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-// 201907 Text Formatting, Integration of chrono, printf corner cases.
-// 202106 std::format improvements.
-// 202110 Fixing locale handling in chrono formatters, generator-like types.
-// 202207 Encodings in localized formatting of chrono, basic-format-string.
-#define __cpp_lib_format 202106L
-
-#if __cplusplus > 202002L
-// 202207 P2286R8 Formatting Ranges
-// 202207 P2585R1 Improving default container formatting
-// TODO: #define __cpp_lib_format_ranges 202207L
-#endif
-
   // [format.context], class template basic_format_context
   template<typename _Out, typename _CharT> class basic_format_context;
 
@@ -4039,5 +4030,5 @@ namespace __format
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20
+#endif // __cpp_lib_format
 #endif // _GLIBCXX_FORMAT
diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list
index 1c110df971b..61c2c38d712 100644
--- a/libstdc++-v3/include/std/forward_list
+++ b/libstdc++-v3/include/std/forward_list
@@ -45,6 +45,9 @@
 # include <debug/forward_list>
 #endif
 
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
 #if __cplusplus >= 201703L
 #include <bits/memory_resource.h>
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -59,13 +62,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++17
 
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-#define __cpp_lib_erase_if 202002L
-
   template<typename _Tp, typename _Alloc, typename _Predicate>
     inline typename forward_list<_Tp, _Alloc>::size_type 
     erase_if(forward_list<_Tp, _Alloc>& __cont, _Predicate __pred)
@@ -82,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20
+#endif // defined(__cpp_lib_erase_if)
 
 #endif // C++11
 
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 4a4b8b2b2e6..07cf884f3dd 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -48,6 +48,14 @@
 #include <bits/c++config.h>
 #include <bits/stl_function.h> // std::equal_to, std::unary_function etc.
 
+#define __glibcxx_want_invoke
+#define __glibcxx_want_constexpr_functional
+#define __glibcxx_want_invoke_r
+#define __glibcxx_want_bind_front
+#define __glibcxx_want_not_fn
+#define __glibcxx_want_boyer_moore_searcher
+#include <bits/version.h>
+
 #if __cplusplus >= 201103L
 
 #include <tuple>
@@ -86,13 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    */
   template<int _Num> struct _Placeholder { };
 
-#if __cplusplus >= 201103L
-
-#if __cplusplus >= 201703L
-# define __cpp_lib_invoke 201411L
-# if __cplusplus > 201703L
-#  define __cpp_lib_constexpr_functional 201907L
-# endif
+#ifdef __cpp_lib_invoke // C++ >= 17
 
   /** Invoke a callable object.
    *
@@ -113,9 +115,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return std::__invoke(std::forward<_Callable>(__fn),
 			   std::forward<_Args>(__args)...);
     }
+#endif
 
-#if __cplusplus > 202002L
-# define __cpp_lib_invoke_r 202106L
+#ifdef __cpp_lib_invoke_r // C++ >= 23
 
   /** Invoke a callable object and convert the result to `_Res`.
    *
@@ -133,11 +135,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return std::__invoke_r<_Res>(std::forward<_Callable>(__fn),
 				   std::forward<_Args>(__args)...);
     }
-#endif // C++23
-#endif // C++17
+#endif // defined(__cpp_lib_invoke_r)
 
   /// @cond undocumented
 
+#if __cplusplus >= 201103L
   template<typename _MemFunPtr,
 	   bool __is_mem_fn = is_member_function_pointer<_MemFunPtr>::value>
     class _Mem_fn_base
@@ -910,8 +912,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 					  std::forward<_BoundArgs>(__args)...);
     }
 
-#if __cplusplus > 201703L
-#define __cpp_lib_bind_front 201907L
+#ifdef __cpp_lib_bind_front // C++ >= 20
 
   template<typename _Fd, typename... _BoundArgs>
     struct _Bind_front
@@ -1077,7 +1078,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return _Bind_front_t<_Fn, _Args...>(0, std::forward<_Fn>(__fn),
 					  std::forward<_Args>(__args)...);
     }
-#endif // C++20
+#endif // defined(__cpp_lib_bind_front)
 
 #if __cplusplus >= 201402L
   /// Generalized negator.
@@ -1147,9 +1148,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<>
     struct __is_byte_like<byte, equal_to<void>>
     : true_type { };
+#endif
 
   // [func.not_fn] Function template not_fn
-#define __cpp_lib_not_fn 201603L
+#ifdef __cpp_lib_not_fn // C++ >= 17
   /** Wrap a function object to create one that negates its result.
    *
    * The function template `std::not_fn` creates a "forwarding call wrapper",
@@ -1170,7 +1172,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       return _Not_fn<std::decay_t<_Fn>>{std::forward<_Fn>(__fn), 0};
     }
+#endif
 
+#if __cplusplus >= 201703L
   // Searchers
 
   template<typename _ForwardIterator1, typename _BinaryPredicate = equal_to<>>
@@ -1203,8 +1207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m;
     };
 
-#if _GLIBCXX_HOSTED
-#define __cpp_lib_boyer_moore_searcher 201603L
+#ifdef __cpp_lib_boyer_moore_searcher // C++ >= 17 && HOSTED
 
   template<typename _Key, typename _Tp, typename _Hash, typename _Pred>
     struct __boyer_moore_map_base
@@ -1448,7 +1451,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
       return std::make_pair(__last, __last);
     }
-#endif // HOSTED
+#endif // defined(__cpp_lib_boyer_moore_searcher)
 
 #endif // C++17
 #endif // C++14
diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index eb82fc584b6..58c3951c372 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -41,6 +41,9 @@
 #include <iosfwd>
 #include <bits/ios_base.h>
 
+#define __glibcxx_want_quoted_string_io
+#include <bits/version.h>
+
 #if __cplusplus >= 201103L
 #include <locale>
 #if __cplusplus > 201103L
@@ -450,9 +453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __is;
     }
 
-#if __cplusplus >= 201402L
-
-#define __cpp_lib_quoted_string_io 201304L
+#ifdef __cpp_lib_quoted_string_io // C++ >= 14 && HOSTED
 
   /**
    * @brief Manipulator for quoted strings.
@@ -502,7 +503,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	basic_string_view<_CharT, _Traits>, _CharT>(__sv, __delim, __escape);
     }
 #endif // C++17
-#endif // C++14
+#endif // defined(__cpp_lib_quoted_string_io)
 
 #endif // __cplusplus >= 201103L
 
diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator
index 695e18e2c47..8c8670fbdf0 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -67,9 +67,8 @@
 #endif
 #include <bits/range_access.h>
 
-#if __cplusplus >= 201402L && ! defined _GLIBCXX_DEBUG // PR libstdc++/70303
-# define __cpp_lib_null_iterators 201304L
-#endif
+#define __glibcxx_want_null_iterators
+#include <bits/version.h>
 
 #if __cplusplus >= 202002L
 #include <bits/ranges_base.h> // ranges::distance, ranges::next, ranges::prev
diff --git a/libstdc++-v3/include/std/latch b/libstdc++-v3/include/std/latch
index a5a92fad919..e6847e3417e 100644
--- a/libstdc++-v3/include/std/latch
+++ b/libstdc++-v3/include/std/latch
@@ -33,18 +33,17 @@
 
 #include <bits/requires_hosted.h> // concurrency
 
-#if __cplusplus > 201703L
+#define __glibcxx_want_latch
+#include <bits/version.h>
 
+#ifdef __cpp_lib_latch // C++ >= 20 && atomic_wait
 #include <bits/atomic_base.h>
 #include <ext/numeric_traits.h>
 
-#if __cpp_lib_atomic_wait
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_latch 201907L
-
   class latch
   {
   public:
@@ -91,6 +90,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   };
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
-#endif // __cpp_lib_atomic_wait
-#endif // __cplusplus > 201703L
+#endif // defined(__cpp_lib_latch)
 #endif // _GLIBCXX_LATCH
diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list
index 48861b9a340..1f94c5a22ed 100644
--- a/libstdc++-v3/include/std/list
+++ b/libstdc++-v3/include/std/list
@@ -69,6 +69,9 @@
 # include <debug/list>
 #endif
 
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
 #if __cplusplus >= 201703L
 #include <bits/memory_resource.h>
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -83,13 +86,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++17
 
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-#define __cpp_lib_erase_if 202002L
-
   template<typename _Tp, typename _Alloc, typename _Predicate>
     inline typename list<_Tp, _Alloc>::size_type
     erase_if(list<_Tp, _Alloc>& __cont, _Predicate __pred)
@@ -106,6 +106,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20
+#endif // defined(__cpp_lib_erase_if)
 
 #endif /* _GLIBCXX_LIST */
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 85c36d67ee1..3cce72cc036 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -91,11 +91,9 @@
 #  include <bits/uses_allocator_args.h>
 #endif
 
-/* As a hack, we declare __cpp_lib_atomic_value_initialization here even though
-   we don't include the bit that actually declares it, for consistency.  */
-#if !defined(__cpp_lib_atomic_value_initialization) && __cplusplus >= 202002L
-# define __cpp_lib_atomic_value_initialization 201911L
-#endif
+#define __glibcxx_want_atomic_value_initialization
+#define __glibcxx_want_parallel_algorithm
+#include <bits/version.h>
 
 #if __cplusplus >= 201103L && __cplusplus <= 202002L && _GLIBCXX_HOSTED
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -144,7 +142,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 #endif // C++11 to C++20
 
-#if __cplusplus >= 201703L && _GLIBCXX_HOSTED
+#ifdef __cpp_lib_parallel_algorithm // C++ >= 17 && HOSTED
 // Parallel STL algorithms
 # if _PSTL_EXECUTION_POLICIES_DEFINED
 // If <execution> has already been included, pull in implementations
@@ -153,9 +151,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
 // Otherwise just pull in forward declarations
 #  include <pstl/glue_memory_defs.h>
 # endif
-
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
-#endif // C++17
+#endif // __cpp_lib_parallel_algorithm
 
 #endif /* _GLIBCXX_MEMORY */
diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource
index fdfc23c95ed..229c6a8b140 100644
--- a/libstdc++-v3/include/std/memory_resource
+++ b/libstdc++-v3/include/std/memory_resource
@@ -36,6 +36,10 @@
 
 #include <bits/requires_hosted.h> // polymorphic allocation
 
+#define __glibcxx_want_polymorphic_allocator
+#define __glibcxx_want_memory_resource
+#include <bits/version.h>
+
 #if __cplusplus >= 201703L
 
 /**
@@ -68,16 +72,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace pmr
 {
-#ifdef _GLIBCXX_HAS_GTHREADS
-  // Header and all contents are present.
-# define __cpp_lib_memory_resource 201603L
-#else
-  // The pmr::synchronized_pool_resource type is missing.
-# define __cpp_lib_memory_resource 1
-#endif
 
-#if __cplusplus >= 202002L
-# define __cpp_lib_polymorphic_allocator 201902L
+#ifdef __cpp_lib_polymorphic_allocator // C++ >= 20 && HOSTED
   template<typename _Tp = std::byte>
     class polymorphic_allocator;
 #endif
@@ -111,7 +107,7 @@ namespace pmr
 
   // Pool resource classes
   struct pool_options;
-#ifdef _GLIBCXX_HAS_GTHREADS
+#if __cpp_lib_memory_resource >= 201603L // C++ >= 17 && hosted && gthread
   class synchronized_pool_resource;
 #endif
   class unsynchronized_pool_resource;
@@ -182,7 +178,7 @@ namespace pmr
     const int _M_npools;
   };
 
-#ifdef _GLIBCXX_HAS_GTHREADS
+#if __cpp_lib_memory_resource >= 201603L // C++ >= 17 && hosted && gthread
   /// A thread-safe memory resource that manages pools of fixed-size blocks.
   /**
    * @ingroup pmr
@@ -252,7 +248,7 @@ namespace pmr
     _TPools* _M_tpools = nullptr;
     mutable shared_mutex _M_mx;
   };
-#endif
+#endif // __cpp_lib_memory_resource >= 201603L
 
   /// A non-thread-safe memory resource that manages pools of fixed-size blocks.
   /**
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 2b0059fcfe8..430e9425fe1 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -56,6 +56,9 @@
 # include <bits/std_function.h>  // std::function
 #endif
 
+#define __glibcxx_want_scoped_lock
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -728,8 +731,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
     }
 
-#if __cplusplus >= 201703L
-#define __cpp_lib_scoped_lock 201703L
+#ifdef __cpp_lib_scoped_lock // C++ >= 17 && hosted && gthread
   /** @brief A scoped lock type for multiple lockable objects.
    *
    * A scoped_lock controls mutex ownership within a scope, releasing
@@ -793,7 +795,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     private:
       mutex_type&  _M_device;
     };
-#endif // C++17
+#endif // defined(__cpp_lib_scoped_lock)
 
 #ifdef _GLIBCXX_HAS_GTHREADS
   /// Flag type used by std::call_once
diff --git a/libstdc++-v3/include/std/numbers b/libstdc++-v3/include/std/numbers
index d7d9e81e540..ee717cccf5a 100644
--- a/libstdc++-v3/include/std/numbers
+++ b/libstdc++-v3/include/std/numbers
@@ -31,7 +31,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus > 201703L
+#define __glibcxx_want_math_constants
+#include <bits/version.h>
+
+#ifdef __cpp_lib_math_constants // C++ >= 20
 
 #include <type_traits>
 
@@ -47,7 +50,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 /// Namespace for mathematical constants
 namespace numbers
 {
-#define __cpp_lib_math_constants 201907L
 
   /// @cond undocumented
   template<typename _Tp>
@@ -230,5 +232,5 @@ __glibcxx_numbers (__float128, Q);
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // C++20
+#endif // __cpp_lib_math_constants
 #endif // _GLIBCXX_NUMBERS
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric
index 514db936623..8c8d200021f 100644
--- a/libstdc++-v3/include/std/numeric
+++ b/libstdc++-v3/include/std/numeric
@@ -79,6 +79,14 @@
 # include <limits>
 #endif
 
+#define __glibcxx_want_constexpr_numeric
+#define __glibcxx_want_gcd
+#define __glibcxx_want_gcd_lcm
+#define __glibcxx_want_interpolate
+#define __glibcxx_want_lcm
+#define __glibcxx_want_parallel_algorithm
+#include <bits/version.h>
+
 /**
  * @defgroup numerics Numerics
  *
@@ -150,14 +158,9 @@ namespace __detail
 	}
     }
 } // namespace __detail
+#endif // C++14
 
-#if __cplusplus >= 201703L
-
-#define __cpp_lib_gcd_lcm 201606L
-// These were used in drafts of SD-6:
-#define __cpp_lib_gcd 201606L
-#define __cpp_lib_lcm 201606L
-
+#ifdef __cpp_lib_gcd_lcm // C++ >= 17
   /// Greatest common divisor
   template<typename _Mn, typename _Nn>
     constexpr common_type_t<_Mn, _Nn>
@@ -198,14 +201,10 @@ namespace __detail
       return __r;
     }
 
-#endif // C++17
-#endif // C++14
-
-#if __cplusplus > 201703L
+#endif // __cpp_lib_gcd_lcm
 
   // midpoint
-# define __cpp_lib_interpolate 201902L
-
+#ifdef __cpp_lib_interpolate // C++ >= 20
   template<typename _Tp>
     constexpr
     enable_if_t<__and_v<is_arithmetic<_Tp>, is_same<remove_cv_t<_Tp>, _Tp>,
@@ -251,14 +250,9 @@ namespace __detail
       static_assert( sizeof(_Tp) != 0, "type must be complete" );
       return __a  + (__b - __a) / 2;
     }
-#endif // C++20
+#endif // __cpp_lib_interpolate
 
 #if __cplusplus >= 201703L
-
-#if __cplusplus > 201703L
-#define __cpp_lib_constexpr_numeric 201911L
-#endif
-
   /// @addtogroup numeric_ops
   /// @{
 
@@ -739,9 +733,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
 #  include <pstl/glue_numeric_defs.h>
 #  define _PSTL_NUMERIC_FORWARD_DECLARED 1
 # endif
-
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
 #endif // C++17
 
 #endif /* _GLIBCXX_NUMERIC */
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index 85e814c3fb8..4f75eb96f97 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -32,7 +32,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus >= 201703L
+#define __glibcxx_want_optional
+#include <bits/version.h>
+
+#ifdef __cpp_lib_optional // C++ >= 17
 
 #include <type_traits>
 #include <exception>
@@ -60,14 +63,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @{
    */
 
-#if __cplusplus > 202002L && __cpp_lib_concepts
-# define __cpp_lib_optional 202110L
-#elif __cplusplus >= 202002L
-# define __cpp_lib_optional 202106L
-#else
-# define __cpp_lib_optional 201606L
-#endif
-
   template<typename _Tp>
     class optional;
 
@@ -1507,6 +1502,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // C++17
+#endif // __cpp_lib_optional
 
 #endif // _GLIBCXX_OPTIONAL
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index c4d4d85bf90..64981cc873c 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -51,6 +51,21 @@
 #include <bits/ranges_util.h>
 #include <bits/refwrap.h>
 
+#define __glibcxx_want_ranges_as_const
+#define __glibcxx_want_ranges_as_rvalue
+#define __glibcxx_want_ranges_cartesian_product
+#define __glibcxx_want_ranges_chunk
+#define __glibcxx_want_ranges_chunk_by
+#define __glibcxx_want_ranges_enumerate
+#define __glibcxx_want_ranges_iota
+#define __glibcxx_want_ranges_iota
+#define __glibcxx_want_ranges_join_with
+#define __glibcxx_want_ranges_repeat
+#define __glibcxx_want_ranges_slide
+#define __glibcxx_want_ranges_stride
+#define __glibcxx_want_ranges_zip
+#include <bits/version.h>
+
 /**
  * @defgroup ranges Ranges
  *
@@ -4390,10 +4405,7 @@ namespace views::__adaptor
     inline constexpr auto values = elements<1>;
   } // namespace views
 
-#if __cplusplus > 202002L
-
-#define __cpp_lib_ranges_zip 202110L
-
+#ifdef __cpp_lib_ranges_zip // C++ >= 23
   namespace __detail
   {
     template<typename... _Rs>
@@ -5831,9 +5843,9 @@ namespace views::__adaptor
 
     inline constexpr auto pairwise_transform = adjacent_transform<2>;
   }
+#endif // defined(__cpp_lib_ranges_zip)
 
-#define __cpp_lib_ranges_chunk 202202L
-
+#ifdef __cpp_lib_ranges_chunk // C++ >= 23
   namespace __detail
   {
     template<typename _Tp>
@@ -6370,9 +6382,9 @@ namespace views::__adaptor
 
     inline constexpr _Chunk chunk;
   }
+#endif // defined(__cpp_lib_ranges_chunk)
 
-#define __cpp_lib_ranges_slide 202202L
-
+#ifdef __cpp_lib_ranges_slide // C++ >= 23
   namespace __detail
   {
     template<typename _Vp>
@@ -6735,9 +6747,9 @@ namespace views::__adaptor
 
     inline constexpr _Slide slide;
   }
+#endif // defined(__cpp_lib_ranges_slide)
 
-#define __cpp_lib_ranges_chunk_by 202202L
-
+#ifdef __cpp_lib_ranges_chunk_by // C++ >= 23
   template<forward_range _Vp,
 	   indirect_binary_predicate<iterator_t<_Vp>, iterator_t<_Vp>> _Pred>
     requires view<_Vp> && is_object_v<_Pred>
@@ -6930,9 +6942,9 @@ namespace views::__adaptor
 
     inline constexpr _ChunkBy chunk_by;
   }
+#endif // defined(__cpp_lib_ranges_chunk_by)
 
-#define __cpp_lib_ranges_join_with 202202L
-
+#ifdef __cpp_lib_ranges_join_with // C++ >= 23
   namespace __detail
   {
     template<typename _Range, typename _Pattern>
@@ -7412,9 +7424,9 @@ namespace views::__adaptor
 
     inline constexpr _JoinWith join_with;
   } // namespace views
+#endif // defined(__cpp_lib_ranges_join_with)
 
-#define __cpp_lib_ranges_repeat 202207L
-
+#ifdef __cpp_lib_ranges_repeat // C++ >= 32
   template<copy_constructible _Tp, semiregular _Bound = unreachable_sentinel_t>
     requires is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
       && (__detail::__is_integer_like<_Bound> || same_as<_Bound, unreachable_sentinel_t>)
@@ -7666,9 +7678,9 @@ namespace views::__adaptor
 	}
     }
   }
+#endif // defined(__cpp_lib_ranges_repeat)
 
-#define __cpp_lib_ranges_stride 202207L
-
+#ifdef __cpp_lib_ranges_stride // C++ >= 23
   template<input_range _Vp>
     requires view<_Vp>
   class stride_view : public view_interface<stride_view<_Vp>>
@@ -8019,9 +8031,9 @@ namespace views::__adaptor
 
     inline constexpr _Stride stride;
   }
+#endif // defined(__cpp_lib_ranges_stride)
 
-#define __cpp_lib_ranges_cartesian_product 202207L
-
+#ifdef __cpp_lib_ranges_cartesian_product // C++ >= 23
   namespace __detail
   {
     template<bool _Const, typename _First, typename... _Vs>
@@ -8542,9 +8554,9 @@ namespace views::__adaptor
 
     inline constexpr _CartesianProduct cartesian_product;
   }
+#endif // defined(__cpp_lib_ranges_cartesian_product)
 
-#define __cpp_lib_ranges_as_rvalue 202207L
-
+#ifdef __cpp_lib_ranges_as_rvalue // C++ >= 23
   template<input_range _Vp>
     requires view<_Vp>
   class as_rvalue_view : public view_interface<as_rvalue_view<_Vp>>
@@ -8634,9 +8646,9 @@ namespace views::__adaptor
 
     inline constexpr _AsRvalue as_rvalue;
   }
+#endif // defined(__cpp_lib_as_rvalue)
 
-#define __cpp_lib_ranges_enumerate 202302L
-
+#ifdef __cpp_lib_ranges_enumerate // C++ >= 23
   namespace __detail
   {
     template<typename _Range>
@@ -8937,9 +8949,9 @@ namespace views::__adaptor
 
     inline constexpr _Enumerate enumerate;
   }
+#endif // defined(__cpp_lib_ranges_enumerate)
 
-#define __cpp_lib_ranges_as_const 202207L
-
+#ifdef __cpp_lib_ranges_as_const // C++ >= 23
   template<view _Vp>
     requires input_range<_Vp>
   class as_const_view : public view_interface<as_const_view<_Vp>>
@@ -9043,7 +9055,7 @@ namespace views::__adaptor
 
     inline constexpr _AsConst as_const;
   }
-#endif // C++23
+#endif // defined(__cpp_lib_as_const)
 } // namespace ranges
 
   namespace views = ranges::views;
diff --git a/libstdc++-v3/include/std/semaphore b/libstdc++-v3/include/std/semaphore
index dfc272f6d35..7340ab663ad 100644
--- a/libstdc++-v3/include/std/semaphore
+++ b/libstdc++-v3/include/std/semaphore
@@ -36,13 +36,14 @@
 #if __cplusplus > 201703L
 #include <bits/semaphore_base.h>
 
-#if __cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE
+#define __glibcxx_want_semaphore
+#include <bits/version.h>
+
+#ifdef __cpp_lib_semaphore // C++ >= 20 && hosted && (atomic_wait || posix_sem)
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_semaphore 201907L
-
   template<ptrdiff_t __least_max_value = __semaphore_impl::_S_max>
     class counting_semaphore
     {
@@ -93,5 +94,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 #endif // cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE
-#endif // C++20
+#endif // defined(__cpp_lib_semaphore)
 #endif // _GLIBCXX_SEMAPHORE
diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index 124da614061..cf69062a00c 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -41,6 +41,10 @@
 #include <bits/move.h>        // move, __exchange
 #include <bits/std_mutex.h>   // defer_lock_t
 
+#define __glibcxx_want_shared_mutex
+#define __glibcxx_want_shared_timed_mutex
+#include <bits/version.h>
+
 #if ! (_GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK)
 # include <condition_variable>
 #endif
@@ -56,12 +60,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #ifdef _GLIBCXX_HAS_GTHREADS
 
-#if __cplusplus >= 201703L
-#define __cpp_lib_shared_mutex 201505L
+#ifdef __cpp_lib_shared_mutex // C++ >= 17 && hosted && gthread
   class shared_mutex;
 #endif
 
-#define __cpp_lib_shared_timed_mutex 201402L
   class shared_timed_mutex;
 
   /// @cond undocumented
@@ -407,7 +409,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
   /// @endcond
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_shared_mutex
   /// The standard shared mutex type.
   class shared_mutex
   {
@@ -441,7 +443,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __shared_mutex_cv _M_impl;
 #endif
   };
-#endif // C++17
+#endif // defined(__cpp_lib_shared_mutex)
 
   /// @cond undocumented
 #if _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK
diff --git a/libstdc++-v3/include/std/source_location b/libstdc++-v3/include/std/source_location
index 9f492826268..873ee60383c 100644
--- a/libstdc++-v3/include/std/source_location
+++ b/libstdc++-v3/include/std/source_location
@@ -29,15 +29,16 @@
 #ifndef _GLIBCXX_SRCLOC
 #define _GLIBCXX_SRCLOC 1
 
-#if __cplusplus > 201703L && __has_builtin(__builtin_source_location)
+#define __glibcxx_want_source_location
+#include <bits/version.h>
+
+#if __cpp_lib_source_location // C++ >= 20 && builtin_source_location
 #include <bits/c++config.h>
 
 namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_source_location 201907L
-
   /// A class that describes a location in source code.
   struct source_location
   {
@@ -88,5 +89,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20 && __builtin_source_location
+#endif // defined(__cpp_lib_source_location)
 #endif // _GLIBCXX_SRCLOC
diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span
index 67633899665..4ab5b54d252 100644
--- a/libstdc++-v3/include/std/span
+++ b/libstdc++-v3/include/std/span
@@ -36,20 +36,18 @@
 
 #pragma GCC system_header
 
-#if __cplusplus > 201703L
+#define __glibcxx_want_span
+#include <bits/version.h>
 
+#ifdef __cpp_lib_span // C++ >= 20 && concepts
 #include <array>
 #include <cstddef>
 #include <bits/stl_iterator.h>
 #include <bits/ranges_base.h>
-
-#if __cpp_lib_concepts
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_span 202002L
-
   inline constexpr size_t dynamic_extent = static_cast<size_t>(-1);
 
   template<typename _Type, size_t _Extent>
@@ -476,6 +474,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // concepts
-#endif // C++20
+#endif // defined(__cpp_lib_span)
 #endif // _GLIBCXX_SPAN
diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream
index 483996b274f..e259318fbfa 100644
--- a/libstdc++-v3/include/std/spanstream
+++ b/libstdc++-v3/include/std/spanstream
@@ -33,20 +33,20 @@
 
 #include <bits/requires_hosted.h> // iostreams
 
-#if __cplusplus > 202002L
+#define __glibcxx_want_spanstream
+#include <bits/version.h>
+
+#ifdef __cpp_lib_spanstream // C++ >= 23 && hosted && lib_span
 #include <span>
 #include <streambuf>
 #include <istream>
 #include <ostream>
 #include <bits/ranges_base.h>
 
-#if __cpp_lib_span
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_spanstream 202106L
-
 template<typename _CharT, typename _Traits>
   class basic_spanbuf
   : public basic_streambuf<_CharT, _Traits>
@@ -451,6 +451,5 @@ using wspanstream = basic_spanstream<wchar_t>;
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // __cpp_lib_span
-#endif // C++23
+#endif // defined(__cpp_lib_spanstream)
 #endif // _GLIBCXX_SPANSTREAM
diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace
index 346c7b14142..07949e70861 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -30,7 +30,10 @@
 
 #include <bits/c++config.h>
 
-#if __cplusplus > 202002L && _GLIBCXX_HAVE_STACKTRACE
+#define __glibcxx_want_stacktrace
+#include <bits/version.h>
+
+#ifdef __cpp_lib_stacktrace // C++ >= 23 && hosted && HAVE_STACKTRACE
 #include <compare>
 #include <new>
 #include <string>
@@ -83,8 +86,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_stacktrace 202011L
-
   // [stacktrace.entry], class stacktrace_entry
   class stacktrace_entry
   {
@@ -800,6 +801,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++23
-
+#endif // __cpp_lib_stacktrace
 #endif /* _GLIBCXX_STACKTRACE */
diff --git a/libstdc++-v3/include/std/stop_token b/libstdc++-v3/include/std/stop_token
index c90fc786b63..3be0f5a3ac4 100644
--- a/libstdc++-v3/include/std/stop_token
+++ b/libstdc++-v3/include/std/stop_token
@@ -31,6 +31,9 @@
 
 #include <bits/requires_hosted.h> // concurrency
 
+#define __glibcxx_want_jthread
+#include <bits/version.h>
+
 #if __cplusplus > 201703L
 
 #include <atomic>
@@ -38,8 +41,6 @@
 
 #include <semaphore>
 
-#define __cpp_lib_jthread 201911L
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string
index dd4ece12801..06da5b2d44c 100644
--- a/libstdc++-v3/include/std/string
+++ b/libstdc++-v3/include/std/string
@@ -54,6 +54,9 @@
 #include <bits/basic_string.h>
 #include <bits/basic_string.tcc>
 
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
 #if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
 #include <bits/memory_resource.h>
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -75,13 +78,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++17
 
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_erase_if 202002L
-
   template<typename _CharT, typename _Traits, typename _Alloc,
 	   typename _Predicate>
     _GLIBCXX20_CONSTEXPR
@@ -112,6 +113,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20
+#endif // defined(__cpp_lib_erase_if)
 
 #endif /* _GLIBCXX_STRING */
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index be9036a20a3..abe36ec91b6 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -35,6 +35,12 @@
 
 #pragma GCC system_header
 
+#define __glibcxx_want_string_view
+#define __glibcxx_want_constexpr_string_view
+#define __glibcxx_want_starts_ends_with
+#define __glibcxx_want_string_contains
+#include <bits/version.h>
+
 #if __cplusplus >= 201703L
 
 #include <bits/char_traits.h>
@@ -57,14 +63,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#if _GLIBCXX_HOSTED
-# define __cpp_lib_string_view 201803L
-#endif
-
-#if __cplusplus > 201703L
-# define __cpp_lib_constexpr_string_view 201811L
-#endif
-
   // Helper for basic_string and basic_string_view members.
   constexpr size_t
   __sv_check(size_t __size, size_t __pos, const char* __s)
@@ -380,8 +378,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		   .compare(basic_string_view(__str, __n2));
       }
 
-#if __cplusplus > 201703L
-#define __cpp_lib_starts_ends_with 201711L
+#ifdef __cpp_lib_starts_ends_with // C++ >= 20
       [[nodiscard]]
       constexpr bool
       starts_with(basic_string_view __x) const noexcept
@@ -416,13 +413,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       constexpr bool
       ends_with(const _CharT* __x) const noexcept
       { return this->ends_with(basic_string_view(__x)); }
-#endif // C++20
+#endif // defined(__cpp_lib_starts_ends_with)
 
 #if __cplusplus > 202002L
-#if _GLIBCXX_HOSTED
+#if _GLIBCXX_HOSTED && !defined(__cpp_lib_string_contains)
       // This FTM is not freestanding as it also implies matching <string>
       // support, and <string> is omitted from the freestanding subset.
-# define __cpp_lib_string_contains 202011L
+# error "libstdc++ bug: string_contents not defined when it should be"
 #endif // HOSTED
       [[nodiscard]]
       constexpr bool
diff --git a/libstdc++-v3/include/std/syncstream b/libstdc++-v3/include/std/syncstream
index 3788b71ecdd..799cee21892 100644
--- a/libstdc++-v3/include/std/syncstream
+++ b/libstdc++-v3/include/std/syncstream
@@ -29,17 +29,16 @@
 #ifndef _GLIBCXX_SYNCSTREAM
 #define _GLIBCXX_SYNCSTREAM 1
 
-#if __cplusplus > 201703L
-
-#include <bits/c++config.h>
-#if _GLIBCXX_USE_CXX11_ABI
-
-#define __cpp_lib_syncbuf 201803L
-
 #pragma GCC system_header
 
 #include <bits/requires_hosted.h> // iostreams
 
+#include <bits/c++config.h>
+
+#define __glibcxx_want_syncbuf
+#include <bits/version.h>
+
+#ifdef __cpp_lib_syncbuf // C++ >= 20 && HOSTED && CXX11ABI
 #include <sstream>
 
 #include <bits/alloc_traits.h>
@@ -314,6 +313,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   using wosyncstream = basic_osyncstream<wchar_t>;
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // _GLIBCXX_USE_CXX11_ABI
-#endif // C++2a
+#endif // defined(__cpp_lib_syncbuf)
+
 #endif	/* _GLIBCXX_SYNCSTREAM */
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index ee2dc36158b..2c049edcbd6 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -45,6 +45,9 @@
 #include <bits/std_thread.h> // std::thread, get_id, yield
 #include <bits/this_thread_sleep.h> // std::this_thread::sleep_for, sleep_until
 
+#define __glibcxx_want_jthread
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index c9ea2a892b4..797d8c03112 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -42,9 +42,14 @@
 #if __cplusplus > 201703L
 # include <compare>
 # include <bits/ranges_util.h>		// for std::ranges::subrange
-# define __cpp_lib_constexpr_tuple 201811L
 #endif
 
+#define __glibcxx_want_constexpr_tuple
+#define __glibcxx_want_tuples_by_type
+#define __glibcxx_want_apply
+#define __glibcxx_want_make_from_tuple
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1820,10 +1825,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     get(const tuple<_Elements...>&) = delete;
   /// @endcond
 
-#if __cplusplus >= 201402L
-
-#define __cpp_lib_tuples_by_type 201304L
-
+#ifdef __cpp_lib_tuples_by_type // C++ >= 14
   /// Return a reference to the unique element of type _Tp of a tuple.
   template <typename _Tp, typename... _Types>
     constexpr _Tp&
@@ -2254,8 +2256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
       { }
 
-#if __cplusplus >= 201703L
-
+#if defined(__cpp_lib_apply) || defined(__cpp_lib_make_from_tuple) // C++ >= 17
   // Unpack a std::tuple into a type trait and use its value.
   // For cv std::tuple<_Up> the result is _Trait<_Tp, cv _Up...>::value.
   // For cv std::tuple<_Up>& the result is _Trait<_Tp, cv _Up&...>::value.
@@ -2278,9 +2279,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<template<typename...> class _Trait, typename _Tp, typename... _Up>
     inline constexpr bool __unpack_std_tuple<_Trait, _Tp, const tuple<_Up...>&>
       = _Trait<_Tp, const _Up&...>::value;
+#endif
 
-# define __cpp_lib_apply 201603L
-
+#ifdef __cpp_lib_apply // C++ >= 17
   template <typename _Fn, typename _Tuple, size_t... _Idx>
     constexpr decltype(auto)
     __apply_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Idx...>)
@@ -2300,9 +2301,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 			       std::forward<_Tuple>(__t),
 			       _Indices{});
     }
+#endif
 
-#define __cpp_lib_make_from_tuple  201606L
-
+#ifdef __cpp_lib_make_from_tuple // C++ >= 17
   template <typename _Tp, typename _Tuple, size_t... _Idx>
     constexpr _Tp
     __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>)
@@ -2324,7 +2325,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t),
 					 make_index_sequence<__n>{});
     }
-#endif // C++17
+#endif
 
 #if __cplusplus > 202002L
   template<typename... _TTypes, typename... _UTypes,
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 7dc5791a7c5..a1fe70aafc0 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -37,6 +37,31 @@
 
 #include <bits/c++config.h>
 
+#define __glibcxx_want_bool_constant
+#define __glibcxx_want_bounded_array_traits
+#define __glibcxx_want_has_unique_object_representations
+#define __glibcxx_want_integral_constant_callable
+#define __glibcxx_want_is_aggregate
+#define __glibcxx_want_is_constant_evaluated
+#define __glibcxx_want_is_final
+#define __glibcxx_want_is_invocable
+#define __glibcxx_want_is_layout_compatible
+#define __glibcxx_want_is_nothrow_convertible
+#define __glibcxx_want_is_null_pointer
+#define __glibcxx_want_is_pointer_interconvertible
+#define __glibcxx_want_is_scoped_enum
+#define __glibcxx_want_is_swappable
+#define __glibcxx_want_logical_traits
+#define __glibcxx_want_reference_from_temporary
+#define __glibcxx_want_remove_cvref
+#define __glibcxx_want_result_of_sfinae
+#define __glibcxx_want_transformation_trait_aliases
+#define __glibcxx_want_type_identity
+#define __glibcxx_want_type_trait_variable_templates
+#define __glibcxx_want_unwrap_ref
+#define __glibcxx_want_void_t
+#include <bits/version.h>
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -65,10 +90,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using value_type = _Tp;
       using type = integral_constant<_Tp, __v>;
       constexpr operator value_type() const noexcept { return value; }
-#if __cplusplus > 201103L
-
-#define __cpp_lib_integral_constant_callable 201304L
 
+#ifdef __cpp_lib_integral_constant_callable // C++ >= 14
       constexpr value_type operator()() const noexcept { return value; }
 #endif
     };
@@ -90,8 +113,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// The type used as a compile-time boolean with false value.
   using false_type = __bool_constant<false>;
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_bool_constant 201505L
+#ifdef __cpp_lib_bool_constant // C++ >= 17
   /// Alias template for compile-time boolean constant types.
   /// @since C++17
   template<bool __v>
@@ -183,7 +205,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
   /// @endcond
 
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_logical_traits // C++ >= 17
 
   /// @cond undocumented
   template<typename... _Bn>
@@ -211,8 +233,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   } // namespace __detail
   /// @endcond
 
-#define __cpp_lib_logical_traits 201510L
-
   template<typename... _Bn>
     struct conjunction
     : __detail::__conjunction_impl<void, _Bn...>::type
@@ -251,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     inline constexpr bool negation_v = negation<_Pp>::value;
   /// @}
 
-#endif // C++17
+#endif // defined(__cpp_lib_logical_traits)
 
   // Forward declarations
   template<typename>
@@ -606,8 +626,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct is_function<_Tp&&>
     : public false_type { };
 
-#define __cpp_lib_is_null_pointer 201309L
-
+#ifdef __cpp_lib_is_null_pointer // C++ >= 11
   /// is_null_pointer (LWG 2247).
   template<typename _Tp>
     struct is_null_pointer
@@ -635,6 +654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct __is_nullptr_t
     : public is_null_pointer<_Tp>
     { } _GLIBCXX_DEPRECATED_SUGGEST("std::is_null_pointer");
+#endif // defined(__cpp_lib_is_null_pointer)
 
   // Composite type categories.
 
@@ -849,8 +869,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     : public __bool_constant<__is_polymorphic(_Tp)>
     { };
 
-#if __cplusplus >= 201402L
-#define __cpp_lib_is_final 201402L
+#ifdef __cpp_lib_is_final // C++ >= 14
   /// is_final
   /// @since C++14
   template<typename _Tp>
@@ -1459,8 +1478,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     using __is_array_convertible
       = is_convertible<_FromElementType(*)[], _ToElementType(*)[]>;
 
-#if __cplusplus >= 202002L
-#define __cpp_lib_is_nothrow_convertible 201806L
+#ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
 
 #if __has_builtin(__is_nothrow_convertible)
   /// is_nothrow_convertible_v
@@ -1514,7 +1532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     inline constexpr bool is_nothrow_convertible_v
       = is_nothrow_convertible<_From, _To>::value;
 #endif
-#endif // C++2a
+#endif // defined(__cpp_lib_is_nothrow_convertible)
 
   // Const-volatile modifications.
 
@@ -1574,10 +1592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct add_cv
     { using type = _Tp const volatile; };
 
-#if __cplusplus > 201103L
-
-#define __cpp_lib_transformation_trait_aliases 201304L
-
+#ifdef __cpp_lib_transformation_trait_aliases // C++ >= 14
   /// Alias template for remove_const
   template<typename _Tp>
     using remove_const_t = typename remove_const<_Tp>::type;
@@ -2396,8 +2411,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // Sfinae-friendly result_of implementation:
 
-#define __cpp_lib_result_of_sfinae 201210L
-
   /// @cond undocumented
   struct __invoke_memfun_ref { };
   struct __invoke_memfun_deref { };
@@ -2626,8 +2639,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     using result_of_t = typename result_of<_Tp>::type;
 #endif // C++14
 
-#if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++11
-#define __cpp_lib_void_t 201411L
+#ifdef __cpp_lib_void_t // C++ >= 17 || GNU++ >= 11
   /// A metafunction that always yields void, used for detecting valid types.
   template<typename...> using void_t = void;
 #endif
@@ -2784,8 +2796,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
   /// @endcond
 
-#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
-#define __cpp_lib_is_swappable 201603L
+#ifdef __cpp_lib_is_swappable // C++ >= 17 || GNU++ >= 11
   /// Metafunctions used for detecting swappable types: p0185r1
 
   /// is_swappable
@@ -2914,7 +2925,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       is_nothrow_swappable_with<_Tp, _Up>::value;
 #endif // __cplusplus >= 201402L
 
-#endif// c++1z or gnu++11
+#endif // defined(__cpp_lib_is_swappable)
 
   /// @cond undocumented
 
@@ -3053,9 +3064,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #pragma GCC diagnostic pop
   /// @endcond
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_is_invocable 201703L
-
+#ifdef __cpp_lib_is_invocable // C++ >= 17
   /// std::invoke_result
   template<typename _Functor, typename... _ArgTypes>
     struct invoke_result
@@ -3134,10 +3143,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
 	"_Ret must be a complete class or an unbounded array");
     };
-#endif // C++17
+#endif // defined(__cpp_lib_is_invocable)
 
-#if __cplusplus >= 201703L
-# define __cpp_lib_type_trait_variable_templates 201510L
+#if __cpp_lib_type_trait_variable_templates // C++ >= 17
   /**
    * @defgroup variable_templates Variable templates for type traits
    * @ingroup metaprogramming
@@ -3373,9 +3381,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
   inline constexpr bool is_nothrow_invocable_r_v
     = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
 /// @}
+#endif // defined(__cpp_lib_type_trait_variable_templates)
 
-#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
-# define __cpp_lib_has_unique_object_representations 201606L
+#ifdef __cpp_lib_has_unique_object_representations // C++ >= 17 && HAS_UNIQ_OBJ_REP
   /// has_unique_object_representations
   /// @since C++17
   template<typename _Tp>
@@ -3388,14 +3396,15 @@ template<typename _Ret, typename _Fn, typename... _Args>
 	"template argument must be a complete class or an unbounded array");
     };
 
+# if __cpp_lib_type_trait_variable_templates // C++ >= 17
   /// @ingroup variable_templates
   template<typename _Tp>
     inline constexpr bool has_unique_object_representations_v
       = has_unique_object_representations<_Tp>::value;
+# endif
 #endif
 
-#ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
-# define __cpp_lib_is_aggregate 201703L
+#ifdef __cpp_lib_is_aggregate // C++ >= 17 && builtin_is_aggregate
   /// is_aggregate - true if the type is an aggregate.
   /// @since C++17
   template<typename _Tp>
@@ -3403,28 +3412,26 @@ template<typename _Ret, typename _Fn, typename... _Args>
     : bool_constant<__is_aggregate(remove_cv_t<_Tp>)>
     { };
 
+# if __cpp_lib_type_trait_variable_templates // C++ >= 17
   /** is_aggregate_v - true if the type is an aggregate.
    *  @ingroup variable_templates
    *  @since C++17
    */
   template<typename _Tp>
     inline constexpr bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>);
+# endif
 #endif
-#endif // C++17
-
-#if __cplusplus >= 202002L
 
   /** * Remove references and cv-qualifiers.
    * @since C++20
    * @{
    */
-#define __cpp_lib_remove_cvref 201711L
-
-#if __has_builtin(__remove_cvref)
+#ifdef __cpp_lib_remove_cvref // C++ >= 20
+# if __has_builtin(__remove_cvref)
   template<typename _Tp>
     struct remove_cvref
     { using type = __remove_cvref(_Tp); };
-#else
+# else
   template<typename _Tp>
     struct remove_cvref
     { using type = typename remove_cv<_Tp>::type; };
@@ -3436,26 +3443,27 @@ template<typename _Ret, typename _Fn, typename... _Args>
   template<typename _Tp>
     struct remove_cvref<_Tp&&>
     { using type = typename remove_cv<_Tp>::type; };
-#endif
+# endif
 
   template<typename _Tp>
     using remove_cvref_t = typename remove_cvref<_Tp>::type;
   /// @}
+#endif // defined(__cpp_lib_remove_cvref)
 
+#ifdef __cpp_lib_type_identity // C++ >= 20
   /** * Identity metafunction.
    * @since C++20
    * @{
    */
-#define __cpp_lib_type_identity 201806L
   template<typename _Tp>
     struct type_identity { using type = _Tp; };
 
   template<typename _Tp>
     using type_identity_t = typename type_identity<_Tp>::type;
   /// @}
+#endif
 
-#define __cpp_lib_unwrap_ref 201811L
-
+#ifdef __cpp_lib_unwrap_ref // C++ >= 20
   /** Unwrap a reference_wrapper
    * @since C++20
    * @{
@@ -3480,9 +3488,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
   template<typename _Tp>
     using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
   /// @}
+#endif // defined(__cpp_lib_unwrap_ref)
 
-#define __cpp_lib_bounded_array_traits 201902L
-
+#ifdef __cpp_lib_bounded_array_traits // C++ >= 20
   /// True for a type that is an array of known bound.
   /// @ingroup variable_templates
   /// @since C++20
@@ -3514,8 +3522,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
     struct is_unbounded_array
     : public bool_constant<is_unbounded_array_v<_Tp>>
     { };
+#endif // __cpp_lib_bounded_array_traits
 
-#if __has_builtin(__is_layout_compatible)
+#if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L
 
   /// @since C++20
   template<typename _Tp, typename _Up>
@@ -3530,7 +3539,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
       = __is_layout_compatible(_Tp, _Up);
 
 #if __has_builtin(__builtin_is_corresponding_member)
-#define __cpp_lib_is_layout_compatible 201907L
+# ifndef __cpp_lib_is_layout_compatible
+#  error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set?"
+# endif
 
   /// @since C++20
   template<typename _S1, typename _S2, typename _M1, typename _M2>
@@ -3540,7 +3551,8 @@ template<typename _Ret, typename _Fn, typename... _Args>
 #endif
 #endif
 
-#if __has_builtin(__is_pointer_interconvertible_base_of)
+#if __has_builtin(__is_pointer_interconvertible_base_of) \
+  && __cplusplus >= 202002L
   /// True if `_Derived` is standard-layout and has a base class of type `_Base`
   /// @since C++20
   template<typename _Base, typename _Derived>
@@ -3555,7 +3567,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
       = __is_pointer_interconvertible_base_of(_Base, _Derived);
 
 #if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
-#define __cpp_lib_is_pointer_interconvertible 201907L
+# ifndef __cpp_lib_is_pointer_interconvertible
+#  error "libstdc++ bug: is_pointer_interconvertible available but FTM unset?"
+# endif
 
   /// True if `__mp` points to the first member of a standard-layout type
   /// @returns true if `s.*__mp` is pointer-interconvertible with `s`
@@ -3567,9 +3581,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
 #endif
 #endif
 
-#if __cplusplus > 202002L
-#define __cpp_lib_is_scoped_enum 202011L
-
+#ifdef __cpp_lib_is_scoped_enum // C++ >= 23
   /// True if the type is a scoped enumeration type.
   /// @since C++23
 
@@ -3589,12 +3601,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
   /// @since C++23
   template<typename _Tp>
     inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
+#endif
 
-#if __has_builtin(__reference_constructs_from_temporary) \
-  && __has_builtin(__reference_converts_from_temporary)
-
-#define __cpp_lib_reference_from_temporary 202202L
-
+#ifdef __cpp_lib_reference_from_temporary // C++ >= 23 && ref_{converts,constructs}_from_temp
   /// True if _Tp is a reference type, a _Up value can be bound to _Tp in
   /// direct-initialization, and a temporary object would be bound to
   /// the reference, false otherwise.
@@ -3632,12 +3641,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
   template<typename _Tp, typename _Up>
     inline constexpr bool reference_converts_from_temporary_v
       = reference_converts_from_temporary<_Tp, _Up>::value;
-#endif // __has_builtin for reference_from_temporary
-#endif // C++23
-
-#if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-#define __cpp_lib_is_constant_evaluated 201811L
+#endif // define(__cpp_lib_reference_from_temporary)
 
+#ifdef __cpp_lib_is_constant_evaluated // C++ >= 20 && HAVE_IS_CONST_EVAL
   /// Returns true only when called during constant evaluation.
   /// @since C++20
   constexpr inline bool
@@ -3651,6 +3657,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
   }
 #endif
 
+#if __cplusplus >= 202002L
   /// @cond undocumented
   template<typename _From, typename _To>
     using __copy_cv = typename __match_cv_qualifiers<_From, _To>::__type;
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 006b19c00fc..f30e802a88d 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -68,6 +68,14 @@
 #include <bits/stl_relops.h>
 #include <bits/stl_pair.h>
 
+#define __glibcxx_want_exchange_function
+#define __glibcxx_want_constexpr_algorithms
+#define __glibcxx_want_as_const
+#define __glibcxx_want_integer_comparison_functions
+#define __glibcxx_want_to_underlying
+#define __glibcxx_want_unreachable
+#include <bits/version.h>
+
 #if __cplusplus >= 201103L
 
 #include <initializer_list>
@@ -83,13 +91,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#if __cplusplus >= 201402L
-#define __cpp_lib_exchange_function 201304L
-
-#if __cplusplus > 201703L
-# define __cpp_lib_constexpr_algorithms 201806L
-#endif
-
+#ifdef __cpp_lib_exchange_function // C++ >= 14
   /// Assign @p __new_val to @p __obj and return its previous value.
   template <typename _Tp, typename _Up = _Tp>
     _GLIBCXX20_CONSTEXPR
@@ -98,10 +100,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     noexcept(__and_<is_nothrow_move_constructible<_Tp>,
 		    is_nothrow_assignable<_Tp&, _Up>>::value)
     { return std::__exchange(__obj, std::forward<_Up>(__new_val)); }
+#endif
 
-#if __cplusplus >= 201703L
-
-#define  __cpp_lib_as_const 201510L
+#ifdef  __cpp_lib_as_const // C++ >= 17
   template<typename _Tp>
     [[nodiscard]]
     constexpr add_const_t<_Tp>&
@@ -110,10 +111,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _Tp>
     void as_const(const _Tp&&) = delete;
+#endif
 
-#if __cplusplus > 201703L
-#define __cpp_lib_integer_comparison_functions 202002L
-
+#ifdef __cpp_lib_integer_comparison_functions // C++ >= 20
   template<typename _Tp, typename _Up>
     constexpr bool
     cmp_equal(_Tp __t, _Up __u) noexcept
@@ -181,17 +181,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       else
 	return __t <= make_unsigned_t<_Up>(__int_traits<_Up>::__max);
     }
+#endif // __cpp_lib_integer_comparison_functions
 
-#if __cplusplus > 202002L
-#define __cpp_lib_to_underlying 202102L
+#ifdef __cpp_lib_to_underlying // C++ >= 23
   /// Convert an object of enumeration type to its underlying type.
   template<typename _Tp>
     [[nodiscard]]
     constexpr underlying_type_t<_Tp>
     to_underlying(_Tp __value) noexcept
     { return static_cast<underlying_type_t<_Tp>>(__value); }
+#endif
 
-#define __cpp_lib_unreachable 202202L
+#ifdef __cpp_lib_unreachable // C++ >= 23
   /// Informs the compiler that program control flow never reaches this point.
   /**
    * Evaluating a call to this function results in undefined behaviour.
@@ -216,10 +217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __builtin_unreachable();
 #endif
   }
-#endif // C++23
-#endif // C++20
-#endif // C++17
-#endif // C++14
+#endif
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 5155124522f..7cb7c3b1d4d 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -31,8 +31,10 @@
 
 #pragma GCC system_header
 
-#if __cplusplus >= 201703L
+#define __glibcxx_want_variant
+#include <bits/version.h>
 
+#ifdef __cpp_lib_variant // C++ >= 17
 #include <initializer_list>
 #include <type_traits>
 #include <bits/enable_special_members.h>
@@ -47,14 +49,12 @@
 # include <compare>
 #endif
 
-#if __cpp_concepts >= 202002L && __cpp_constexpr >= 201811L
-// P2231R1 constexpr needs constexpr unions and constrained destructors.
-# define __cpp_lib_variant 202106L
-#else
+// C++ < 20 || __cpp_concepts < 202002L || __cpp_constexpr < 201811L
+#if __cpp_lib_variant < 202106L
 # include <ext/aligned_buffer.h> // Use __aligned_membuf instead of union.
-# define __cpp_lib_variant 202102L
 #endif
 
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1941,6 +1941,5 @@ namespace __variant
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#endif // C++17
-
+#endif // __cpp_lib_variant
 #endif // _GLIBCXX_VARIANT
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index 712087f1bdd..bd2b4b02cb1 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -76,6 +76,9 @@
 # include <debug/vector>
 #endif
 
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
 #if __cplusplus >= 201703L
 #include <bits/memory_resource.h>
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -96,13 +99,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++17
 
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-#define __cpp_lib_erase_if 202002L
-
   template<typename _Tp, typename _Alloc, typename _Predicate>
     _GLIBCXX20_CONSTEXPR
     inline typename vector<_Tp, _Alloc>::size_type
@@ -146,6 +147,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
-#endif // C++20
+#endif // defined(__cpp_lib_erase_if)
 
 #endif /* _GLIBCXX_VECTOR */
diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index 8fa960eff47..b133fdbcf1e 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -32,14 +32,13 @@
 
 #pragma GCC system_header
 
+#define __glibcxx_want_three_way_comparison
+#include <bits/version.h>
+
 #if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L
 
 #include <concepts>
 
-#if __cpp_lib_concepts
-# define __cpp_lib_three_way_comparison 201907L
-#endif
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
   // [cmp.categories], comparison category types
@@ -448,7 +447,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
     using common_comparison_category_t
       = typename common_comparison_category<_Ts...>::type;
 
-#if __cpp_lib_concepts
+#if __cpp_lib_three_way_comparison >= 201907L
+  // C++ >= 20 && impl_3way_comparison >= 201907 && lib_concepts
   namespace __detail
   {
     template<typename _Tp, typename _Cat>
@@ -1239,7 +1239,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 	= decltype(__detail::__synth3way(std::declval<_Tp&>(),
 					 std::declval<_Up&>()));
   } // namespace __detail
-#endif // concepts
+#endif // __cpp_lib_three_way_comparison >= 201907L
 } // namespace std
 
 #endif // C++20
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index 00a6347ebe5..9f5adae13f6 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -35,6 +35,9 @@
 #include <bits/c++config.h>
 #include <bits/exception.h>
 
+#define __glibcxx_want_uncaught_exceptions
+#include <bits/version.h>
+
 extern "C++" {
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -121,8 +124,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
   _GLIBCXX17_DEPRECATED_SUGGEST("std::uncaught_exceptions()")
   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 
-#if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++98
-#define __cpp_lib_uncaught_exceptions 201411L
+#ifdef __cpp_lib_uncaught_exceptions // C++ >= 17 || GNU++ >= 03
   /** The number of uncaught exceptions.
    *  @since C++17, or any non-strict mode, e.g. `-std=gnu++98`
    *  @see uncaught_exception()
diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new
index 082053fc4d9..e937e5bbe0e 100644
--- a/libstdc++-v3/libsupc++/new
+++ b/libstdc++-v3/libsupc++/new
@@ -40,6 +40,11 @@
 #include <bits/c++config.h>
 #include <bits/exception.h>
 
+#define __glibcxx_want_launder
+#define __glibcxx_want_hardware_interference_size
+#define __glibcxx_want_destroying_delete
+#include <bits/version.h>
+
 #pragma GCC visibility push(default)
 
 extern "C++" {
@@ -185,8 +190,7 @@ inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
 #if __cplusplus >= 201703L
 namespace std
 {
-#ifdef _GLIBCXX_HAVE_BUILTIN_LAUNDER
-#define __cpp_lib_launder 201606L
+#ifdef __cpp_lib_launder // C++ >= 17 && HAVE_BUILTIN_LAUNDER
   /// Pointer optimization barrier [ptr.launder]
   template<typename _Tp>
     [[nodiscard]] constexpr _Tp*
@@ -205,16 +209,16 @@ namespace std
   void launder(const void*) = delete;
   void launder(volatile void*) = delete;
   void launder(const volatile void*) = delete;
-#endif // _GLIBCXX_HAVE_BUILTIN_LAUNDER
+#endif // __cpp_lib_launder
 
-#ifdef __GCC_DESTRUCTIVE_SIZE
-# define __cpp_lib_hardware_interference_size 201703L
+#ifdef __cpp_lib_hardware_interference_size // C++ >= 17 && defined(gcc_dest_sz)
   inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE;
   inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUCTIVE_SIZE;
-#endif // __GCC_DESTRUCTIVE_SIZE
+#endif // __cpp_lib_hardware_interference_size
 }
 #endif // C++17
 
+// Emitted despite the FTM potentially being undefined.
 #if __cplusplus > 201703L
 namespace std
 {
@@ -227,10 +231,6 @@ namespace std
   /// Tag variable of type destroying_delete_t.
   inline constexpr destroying_delete_t destroying_delete{};
 }
-// Only define the feature test macro if the compiler supports the feature:
-#if __cpp_impl_destroying_delete
-# define __cpp_lib_destroying_delete 201806L
-#endif
 #endif // C++20
 
 #pragma GCC visibility pop
diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo
index 4cce6cb414b..bb4ed438dd6 100644
--- a/libstdc++-v3/libsupc++/typeinfo
+++ b/libstdc++-v3/libsupc++/typeinfo
@@ -36,12 +36,11 @@
 #include <bits/hash_bytes.h>
 #endif
 
+#define __glibcxx_want_constexpr_typeinfo
+#include <bits/version.h>
+
 #pragma GCC visibility push(default)
 
-#if __cplusplus >= 202100L
-# define __cpp_lib_constexpr_typeinfo 202106L
-#endif
-
 extern "C++" {
 
 namespace __cxxabiv1
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
index 7d99b331fde..889d4aa2e0b 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
@@ -26,6 +26,6 @@ int n1 = std::get<1>(a);
 int n2 = std::get<1>(std::move(a));
 int n3 = std::get<1>(ca);
 
-// { dg-error "static assertion failed" "" { target *-*-* } 386 }
-// { dg-error "static assertion failed" "" { target *-*-* } 395 }
-// { dg-error "static assertion failed" "" { target *-*-* } 404 }
+// { dg-error "static assertion failed" "" { target *-*-* } 389 }
+// { dg-error "static assertion failed" "" { target *-*-* } 398 }
+// { dg-error "static assertion failed" "" { target *-*-* } 407 }
-- 
2.41.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header
  2023-08-13 19:35 [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
  2023-08-13 19:35 ` [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use Arsen Arsenović
@ 2023-08-14 15:18 ` Arsen Arsenović
  2023-08-16 11:15 ` Jonathan Wakely
  2 siblings, 0 replies; 6+ messages in thread
From: Arsen Arsenović @ 2023-08-14 15:18 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gcc-patches, libstdc++

[-- Attachment #1: Type: text/plain, Size: 2017 bytes --]


Arsen Arsenović <arsen@aarsen.me> writes:

> This commit replaces the ad-hoc logic in <version> with an AutoGen
> database that (mostly) declaratively generates a version.h bit which
> combines all of the FTM logic across all headers together.
>
> This generated header defines macros of the form __glibcxx_foo,
> equivalent to their __cpp_lib_foo variants, according to rules specified
> in version.def and, optionally, if __glibcxx_want_foo or
> __glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
> the same definition.
>
> libstdc++-v3/ChangeLog:
>
> 	* include/Makefile.am (bits_freestanding): Add version.h.
> 	(allcreated): Add version.h.
> 	(${bits_srcdir}/version.h): New rule.  Regenerates
> 	version.h out of version.{def,tpl}.
> 	* include/Makefile.in: Regenerate.
> 	* include/bits/version.def: New file.  Declares a list of
> 	all feature test macros, their values and their preconditions.
> 	* include/bits/version.tpl: New file.  Turns version.def
> 	into a sequence of #if blocks.
> 	* include/bits/version.h: New file.  Generated from
> 	version.def.
> 	* include/std/version: Replace with a __glibcxx_want_all define
> 	and bits/version.h include.
> ---
> This patchset is a rebase of
> https://inbox.sourceware.org/libstdc++/20230429101640.1697750-1-arsen@aarsen.me/
>
> ... passing the same two checks (difall / vercmp) I wrote for the first
> pass.  Testsuite runs are still pending.
>
> Changes in this revision:
> - Replace the ${bits_srcdir}/version.h rule with a update-version phony,
> - Add the new __cpp_lib_chrono value,
> - Add __cpp_lib_{ranges_{contains,find_last,fold,iota}},
> - Add comments to various replaced conditions which summarize their
>   condition,
> - Correct a few minor errors spotted in review
>
> OK for trunk (if those testsuite runs end up clean)?

Same tests as the first time around passed on x86_64-pc-linux-gnu (that
is, regression testing + a large libstdc++ harness).
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header
  2023-08-13 19:35 [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
  2023-08-13 19:35 ` [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use Arsen Arsenović
  2023-08-14 15:18 ` [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
@ 2023-08-16 11:15 ` Jonathan Wakely
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2023-08-16 11:15 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gcc-patches, libstdc++

On Sun, 13 Aug 2023 at 21:15, Arsen Arsenović via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> This commit replaces the ad-hoc logic in <version> with an AutoGen
> database that (mostly) declaratively generates a version.h bit which
> combines all of the FTM logic across all headers together.
>
> This generated header defines macros of the form __glibcxx_foo,
> equivalent to their __cpp_lib_foo variants, according to rules specified
> in version.def and, optionally, if __glibcxx_want_foo or
> __glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
> the same definition.
>
> libstdc++-v3/ChangeLog:
>
>         * include/Makefile.am (bits_freestanding): Add version.h.
>         (allcreated): Add version.h.
>         (${bits_srcdir}/version.h): New rule.  Regenerates
>         version.h out of version.{def,tpl}.
>         * include/Makefile.in: Regenerate.
>         * include/bits/version.def: New file.  Declares a list of
>         all feature test macros, their values and their preconditions.
>         * include/bits/version.tpl: New file.  Turns version.def
>         into a sequence of #if blocks.
>         * include/bits/version.h: New file.  Generated from
>         version.def.
>         * include/std/version: Replace with a __glibcxx_want_all define
>         and bits/version.h include.


I still don't love this change, due to the added overhead in
preprocessing time. I also don't understand the Guile code in the
autogen template, but that's OK too.

But defining them all in one place, in a consistent form, is
definitely an improvement, so that the macros in <version> are always
consistent with other headers.  And not having the definitions
scattered around various headers is probably much easier for most
maintainers to follow.

I think it's a net improvement, so OK for trunk. Thanks for working on this.

I wonder why we only define __cpp_lib_null_iterators for >= C++14. It
was a C++14 change, but in practice it Just Works even in C++98 mode.
We don't have any code pre-C++14 that makes it *not* work (except
debug mode). We should revisit that.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use
  2023-08-13 19:35 ` [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use Arsen Arsenović
@ 2023-08-16 11:15   ` Jonathan Wakely
  2023-08-16 12:47     ` Arsen Arsenović
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2023-08-16 11:15 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gcc-patches, libstdc++

On Sun, 13 Aug 2023 at 21:16, Arsen Arsenović via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> libstdc++-v3/ChangeLog:
>
>         * libsupc++/typeinfo: Switch to bits/version.h for
>         __cpp_lib_constexpr_typeinfo.
>         * libsupc++/new: Switch to bits/version.h for
>         __cpp_lib_{launder,hardware_interference_size,destroying_delete}.
>         (launder): Guard behind __cpp_lib_launder.
>         (hardware_destructive_interference_size)
>         (hardware_constructive_interference_size): Guard behind
>         __cpp_lib_hardware_interference_size.
>         * libsupc++/exception: Switch to bits/version.h for
>         __cpp_lib_uncaught_exceptions.
>         (uncaught_exceptions): Guard behind __cpp_lib_uncaught_exceptions.
>         * libsupc++/compare: Switch to bits/version.h for
>         __cpp_lib_three_way_comparison.
>         (three_way_comparable, three_way_comparable_with)
>         (compare_three_way, weak_order, strong_order, partial_order):
>         Guard behind __cpp_lib_three_way_comparison >= 201907L.
>         * include/std/chrono: Drop __cpp_lib_chrono definition.
>         * include/std/vector: Switch to bits/version.h for
>         __cpp_lib_erase_if.
>         (erase, erase_if): Guard behind __cpp_lib_erase_if.
>         * include/std/variant: Switch to bits/version.h for
>         __cpp_lib_variant.  Guard whole header behind that FTM.
>         * include/std/utility: Switch to bits/version.h for
>         __cpp_lib_{exchange_function,constexpr_algorithms,as_const},
>         __cpp_lib_{integer_comparison_functions,to_underlying}, and
>         __cpp_lib_unreachable.
>         (exchange): Guard behind __cpp_lib_exchange_function.
>         (cmp_equal, cmp_not_equal, cmp_less, cmp_greater, cmp_less_equal)
>         (cmp_greater_equal, in_range): Guard behind
>         __cpp_lib_integer_comparison_functions.
>         (to_underlying): Guard behind __cpp_lib_to_underlying.
>         (unreachable): Guard behind __cpp_lib_unreachable.
>         * include/std/type_traits: Switch to bits/version.h for
>         __cpp_lib_is_{null_pointer,final,nothrow_convertible,aggregate},
>         __cpp_lib_is_{constant_evaluated,invocable,layout_compatible},
>         __cpp_lib_is_{pointer_interconvertible,scoped_enum,swappable},
>         __cpp_lib_{logical_traits,reference_from_temporary,remove_cvref},
>         __cpp_lib_{result_of_sfinae,transformation_trait_aliases},
>         __cpp_lib_{type_identity,type_trait_variable_templates},
>         __cpp_lib_{unwrap_ref,void_t,integral_constant_callable},
>         __cpp_lib_{bool_constant,bounded_array_traits}, and
>         __cpp_lib_has_unique_object_representations.
>         (integral_constant::operator()): Guard behind
>         __cpp_lib_integral_constant_callable.
>         (bool_constant): Guard behind __cpp_lib_bool_constant.
>         (conjunction, disjunction, negation, conjunction_v, disjunction_v)
>         (negation_v): Guard behind __cpp_lib_logical_traits.
>         (is_null_pointer): Guard behind __cpp_lib_is_null_pointer.
>         (is_final): Guard behind __cpp_lib_is_final.
>         (is_nothrow_convertible, is_nothrow_convertible_v): Guard behind
>         __cpp_lib_is_nothrow_convertible.
>         (remove_const_t, remove_volatile_t, remove_cv_t)
>         (add_const_t, add_volatile_t, add_cv_t): Guard behind
>         __cpp_lib_transformation_trait_aliases.
>         (void_t): Guard behind __cpp_lib_void_t.
>         (is_swappable_with_v, is_nothrow_swappable_with_v)
>         (is_swappable_with, is_nothrow_swappable_with): Guard behind
>         __cpp_lib_is_swappable.
>         (is_nothrow_invocable_r, is_invocable_r, invoke_result)
>         (is_invocable, invoke_result_t): Guard behind
>         __cpp_lib_is_invocable.
>         (alignment_of_v, extent_v, has_virtual_destructor_v)
>         (is_abstract_v, is_arithmetic_v, is_array_v)
>         (is_assignable_v, is_base_of_v, is_class_v, is_compound_v)
>         (is_constructible_v, is_const_v, is_convertible_v)
>         (is_copy_assignable_v, is_copy_constructible_v)
>         (is_default_constructible_v, is_destructible_v)
>         (is_empty_v, is_enum_v, is_final_v, is_floating_point_v)
>         (is_function_v, is_fundamental_v, is_integral_v)
>         (is_invocable_r_v, is_invocable_v, is_literal_type_v)
>         (is_lvalue_reference_v, is_member_function_pointer_v)
>         (is_member_object_pointer_v, is_member_pointer_v)
>         (is_move_assignable_v, is_move_constructible_v)
>         (is_nothrow_assignable_v, is_nothrow_constructible_v)
>         (is_nothrow_copy_assignable_v, is_nothrow_copy_constructible_v)
>         (is_nothrow_default_constructible_v, is_nothrow_destructible_v)
>         (is_nothrow_invocable_r_v, is_nothrow_invocable_v)
>         (is_nothrow_move_assignable_v, is_nothrow_move_constructible_v)
>         (is_null_pointer_v, is_object_v, is_pod_v, is_pointer_v)
>         (is_polymorphic_v, is_reference_v, is_rvalue_reference_v)
>         (is_same_v, is_scalar_v, is_signed_v, is_standard_layout_v)
>         (is_trivially_assignable_v, is_trivially_constructible_v)
>         (is_trivially_copyable_v, is_trivially_copy_assignable_v)
>         (is_trivially_copy_constructible_v)
>         (is_trivially_default_constructible_v)
>         (is_trivially_destructible_v, is_trivially_move_assignable_v)
>         (is_trivially_move_constructible_v, is_trivial_v, is_union_v)
>         (is_unsigned_v, is_void_v, is_volatile_v, rank_v, as variadic):
>         Guard behind __cpp_lib_type_trait_variable_templates.
>         (has_unique_object_representations)
>         (has_unique_object_representations_v): Guard behind
>         __cpp_lib_has_unique_object_representation.
>         (is_aggregate): Guard behind __cpp_lib_is_aggregate.
>         (remove_cvref, remove_cvref_t): Guard behind
>         __cpp_lib_remove_cvref.
>         (type_identity, type_identity_t): Guard behind
>         __cpp_lib_type_identity.
>         (unwrap_reference, unwrap_reference_t, unwrap_ref_decay)
>         (unwrap_ref_decay_t): Guard behind __cpp_lib_unwrap_ref.
>         (is_bounded_array_v, is_unbounded_array_v, is_bounded_array)
>         (is_unbounded_array): Guard behind __cpp_lib_bounded_array_traits.
>         (is_scoped_enum, is_scoped_enum_v): Guard behind
>         __cpp_lib_is_scoped_enum.
>         (reference_constructs_from_temporary)
>         (reference_constructs_from_temporary_v): Guard behind
>         __cpp_lib_reference_from_temporary.
>         * include/std/tuple: Switch to bits/version.h for
>         __cpp_lib_{constexpr_tuple,tuple_by_type,apply_make_from_tuple}.
>         (get<T>): Guard behind __cpp_lib_tuple_by_type.
>         (apply): Guard behind __cpp_lib_apply.
>         (make_from_tuple): Guard behind __cpp_lib_make_from_tuple.
>         * include/std/syncstream: Switch to bits/version.h for
>         __cpp_lib_syncbuf.  Guard header behind that FTM.
>         * include/std/string_view: Switch to bits/version.h for
>         __cpp_lib_{string_{view,contains},constexpr_string_view} and
>         __cpp_lib_starts_ends_with.
>         (basic_string_view::starts_with, basic_string_view::ends_with):
>         Guard behind __cpp_lib_starts_ends_with.
>         [C++23 && _GLIBCXX_HOSTED && !defined(__cpp_lib_string_contains)]:
>         Assert as impossible ithout a bug in C++23.
>         * include/std/string: Switch to bits/version.h for
>         __cpp_lib_erase_if.
>         (erase, erase_if): Guard behind __cpp_lib_erase_if.
>         * include/std/thread: Switch to bits/version.h for
>         __cpp_lib_jthread.
>         * include/std/stop_token: Switch to bits/version.h for
>         __cpp_lib_jthread.
>         * include/std/spanstream: Switch to bits/version.h for
>         __cpp_lib_spanstream.  Guard header behind that FTM.
>         * include/std/span: Switch to bits/version.h for __cpp_lib_span.
>         Guard header behind that FTM.
>         * include/std/source_location: Switch to bits/version.h for
>         __cpp_lib_source_location.  Guard header with that FTM.
>         * include/std/shared_mutex: Switch to bits/version.h for
>         __cpp_lib_shared{,_timed}_mutex.
>         (shared_mutex): Guard behind __cpp_lib_shared_mutex.
>         * include/std/semaphore: Switch to bits/version.h for
>         __cpp_lib_semaphore.  Guard header behind that FTM.
>         * include/std/ranges: Switch to bits/version.h for
>         __cpp_lib_ranges_{zip,chunk{,_by},slide,join_with},
>         __cpp_lib_ranges_{repeat_stride,cartesian_product,as_rvalue},
>         and __cpp_lib_ranges_{as_const,enumerate,iota}.
>         (ranges::zip et al, ranges::chunk et al, ranges::slide et al)
>         (ranges::chunk_by et al, ranges::join_with et al)
>         (ranges::stride et al, ranges::cartesian_product et al)
>         (ranges::as_rvalue et al, ranges::as_const et al)
>         (ranges::enumerate et al): Guard behind appropriate FTM.
>         * include/std/optional: Switch to bits/version.h for
>         __cpp_lib_optional.  Guard header behind that FTM.
>         * include/std/numeric: Switch to bits/version.h for
>         __cpp_lib_{gcd{,_lcm},lcm,constexpr_numeric,interpolate}
>         and __cpp_lib_parallel_algorithm.
>         (gcd, lcm): Guard behind __cpp_lib_gcd_lcm.
>         (midpoint): Guard behind __cpp_lib_interpolate.
>         * include/std/numbers: Switch to bits/version.h for
>         __cpp_lib_math_constants.  Guard header behind that FTM.
>         * include/std/mutex: Switch to bits/version.h for
>         __cpp_lib_scoped_lock.
>         (scoped_Lock): Guard behind __cpp_lib_scoped_lock.
>         * include/std/memory_resource: Switch to bits/version.h for
>         __cpp_lib_{polymorphic_allocator,memory_resource}.
>         (synchronized_pool_resource): Guard behind
>         __cpp_lib_memory_resource >= 201603L.
>         (polymorphic_allocator): Guard behind
>         __cpp_lib_polymorphic_allocator.
>         * include/std/memory: Switch to bits/version.h for
>         __cpp_lib_{parallel_algorithm,atomic_value_initialization}.
>         * include/std/list: Switch to bits/version.h for
>         __cpp_lib_erase_if.
>         (erase, erase_if): Guard behind __cpp_lib_erase_if.
>         * include/std/latch: Switch to bits/version.h for __cpp_lib_latch.
>         Guard header behind that FTM.
>         * include/std/iterator: Switch to bits/version.h for
>         __cpp_lib_null_iterators.
>         * include/std/iomanip: Switch to bits/version.h for
>         __cpp_lib_quoted_string_io.
>         (quoted): Guard behind __cpp_lib_quoted_string_io.
>         * include/std/functional: Switch to bits/version.h for
>         __cpp_lib_{invoke{,_r},constexpr_functional,bind_front} and
>         __cpp_lib_{not_fn,booyer_moore_searcher}.
>         (invoke): Guard behind __cpp_lib_invoke.
>         (invoke_r): Guard behind __cpp_lib_invoke_r.
>         (bind_front): Guard behind __cpp_lib_bind_front.
>         (not_fn): Guard behind __cpp_lib_not_fn.
>         (boyer_moore_searcher, boyer_moore_horspool_searcher): Guard
>         definition behind __cpp_lib_boyer_moore_searcher.
>         * include/std/forward_list: Switch to bits/version.h for
>         __cpp_lib_erase_if.
>         (erase, erase_if): Guard behind __cpp_lib_erase_if.
>         * include/std/format: Switch to bits/version.h for
>         __cpp_lib_format.  Guard header behind that FTM.
>         * include/std/filesystem: Switch to bits/version.h for
>         __cpp_lib_filesystem.  Guard header behind that FTM.
>         * include/std/expected: Switch to bits/version.h for
>         __cpp_lib_expected.  Guard header behind it.
>         * include/std/execution: Switch to bits/version.h for
>         __cpp_lib_{execution,parallel_algorithm}.  Guard header behind
>         either.
>         * include/std/deque: Switch to bits/version.h for
>         __cpp_lib_erase_if.
>         (erase, erase_if): Guard behind __cpp_lib_erase_if.
>         * include/std/coroutine: Switch to bits/version.h for
>         __cpp_lib_coroutine.  Guard header behind that FTM.
>         * include/std/concepts: Switch to bits/version.h for
>         __cpp_lib_concepts.  Guard header behind that FTM.
>         * include/std/complex: Switch to bits/version.h for
>         __cpp_lib_{complex_udls,constexpr_complex}.
>         (operator""if, operator""i, operator""il): Guard behind
>         __cpp_lib_complex_udls.
>         * include/std/charconv: Swtich to bits/version.h for
>         __cpp_lib_{to_chars,constexpr_charconv}.
>         * include/std/bitset: Switch to bits/version.h for
>         __cpp_lib_constexpr_bitset.
>         * include/std/bit: Switch to bits/version.h for
>         __cpp_lib_{bit_cast,byteswap,bitops,int_pow2,endian}.
>         (bit_cast): Guard behind __cpp_lib_bit_cast.
>         (byteswap): Guard behind __cpp_lib_byteswap.
>         (rotl, rotr, countl_zero, countl_one, countr_zero, countr_one)
>         (popcount): Guard behind __cpp_lib_bitops.
>         (has_single_bit, bit_ceil, bit_floor, bit_width): Guard behind
>         __cpp_lib_int_pow2.
>         (endian): Guard behind __cpp_lib_endian.
>         * include/std/barrier: Switch to bits/version.h for
>         __cpp_lib_barrier.  Guard header behind that FTM.
>         * include/std/atomic: Switch to bits/version.h for
>         __cpp_lib_atomic_{is_always_lock_free,float,ref}
>         and __cpp_lib_lock_free_type_aliases.
>         (*::is_always_lock_free): Guard behind
>         __cpp_lib_atomic_is_always_lock_free.
>         (atomic<float>): Guard behind __cpp_lib_atomic_float.
>         (atomic_ref): Guard behind __cpp_lib_atomic_ref.
>         (atomic_signed_lock_free, atomic_unsigned_lock_free): Guard behind
>         __cpp_lib_atomic_lock_free_type_aliases.
>         * include/std/array: Switch to bits/version.h for
>         __cpp_lib_to_array.
>         (to_array): Guard behind __cpp_lib_to_array.
>         * include/std/any: Switch to bits/version.h for __cpp_lib_any.
>         Guard header behind that FTM.
>         * include/std/algorithm: Switch to bits/version.h for
>         __cpp_lib_parallel_algorithm.
>         * include/c_global/cstddef: Switch to bits/version.h for
>         __cpp_lib_byte.
>         (byte): Guard behind __cpp_lib_byte.
>         * include/c_global/cmath: Switch to bits/version.h for
>         __cpp_lib_{hypot,interpolate}.
>         (hypot3): Guard behind __cpp_lib_hypot.
>         (lerp): Guard behind __cpp_lib_interpolate.
>         * include/c_compatibility/stdatomic.h: Switch to
>         bits/stl_version.h for __cpp_lib_atomic.  Guard header behind that
>         FTM.
>         * include/bits/utility.h: Switch to bits/version.h for
>         __cpp_lib_{tuple_element_t,integer_sequence,ranges_zip}.
>         (tuple_element_t): Guard behind __cpp_lib_tuple_element_t.
>         (integer_sequence et al): Guard behind __cpp_lib_integer_sequence.
>         * include/bits/uses_allocator_args.h: Switch to bits/version.h for
>         __cpp_lib_make_obj_using_allocator.  Guard header behind that FTM.
>         * include/bits/unordered_map.h: Switch to bits/version.h for
>         __cpp_lib_unordered_map_try_emplace.
>         (try_emplace): Guard behind __cpp_lib_unordered_map_try_emplace.
>         * include/bits/unique_ptr.h: Switch to bits/version.h for
>         __cpp_lib_{constexpr_memory,make_unique}.
>         (make_unique): Guard behind __cpp_lib_make_unique.
>         * include/bits/stl_vector.h: Switch to bits/version.h for
>         __cpp_lib_constexpr_vector.
>         * include/bits/stl_uninitialized.h: Switch to bits/version.h for
>         __cpp_lib_raw_memory_algorithms.
>         (uninitialized_default_construct)
>         (uninitialized_default_construct_n, uninitialized_move)
>         (uninitialized_move_n, uninitialized_value_construct)
>         (uninitialized_value_construct_n): Guard behind
>         __cpp_lib_raw_memory_algorithms.
>         * include/bits/stl_tree.h: Switch to bits/version.h for
>         __cpp_lib_generic_associative_lookup.
>         * include/bits/stl_stack.h: Switch to bits/version.h for
>         __cpp_lib_adaptor_iterator_pair_constructor.
>         (stack): Guard iterator-pair constructor behind
>         __cpp_lib_adaptor_iterator_pair_constructor.
>         * include/bits/stl_queue.h: Switch to bits/version.h for
>         __cpp_lib_adaptor_iterator_pair_constructor.
>         (queue): Guard iterator-pair constructor behind
>         __cpp_lib_adaptor_iterator_pair_constructor.
>         * include/bits/stl_pair.h: Switch to bits/version.h for
>         __cpp_lib_{concepts,tuples_by_type}.
>         (get): Guard type-getting overloads behind
>         __cpp_lib_tuples_by_type.
>         * include/bits/stl_map.h: Switch to bits/version.h for
>         __cpp_lib_map_try_emplace.
>         (map<>::try_emplace): Guard behind __cpp_lib_map_try_emplace.
>         * include/bits/stl_list.h: Switch to bits/version.h for
>         __cpp_lib_list_remove_return_type.
>         (__remove_return_type, _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG)
>         [C++20]: guard behind __cpp_lib_list_remove_return_type instead.
>         * include/bits/stl_iterator.h: Switch to bits/version.h for
>         __cpp_lib_{constexpr_iterator,array_constexpr} and
>         __cpp_lib_{make_reverse_iterator,move_iterator_concept}.
>         (make_reverse_iterator): Guard behind
>         __cpp_lib_make_reverse_iterator.
>         (iterator_concept et al): Guard __cpp_lib_move_iterator_concept
>         changes behind that FTM.
>         * include/bits/stl_function.h: Switch to bits/version.h for
>         __cpp_lib_transparent_operators.
>         (equal_to, not_equal_to, greater, less, greater_equal)
>         (less_equal, bit_and, bit_or, bit_xor, bit_not, logical_and)
>         (logical_or, logical_not, plus, minus, multiplies, divides)
>         (modulus, negate): Guard '= void' fwdecls behind
>         __cpp_lib_transparent_operators.
>         (plus<void>, minus<void>, multiplies<void>, divides<void>)
>         (modulus<void>, negate<void>, logical_and<void>, logical_or<void>)
>         (logical_not<void>, bit_and<void>, bit_or<void>, bit_xor<void>)
>         (equal_to<void>, not_equal_to<void>, greater<void>, less<void>)
>         (greater_equal<void>, less_equal<void>, bit_not<void>)
>         (__has_is_transparent): Guard behind
>         __cpp_lib_transparent_operators.
>         * include/bits/stl_algobase.h: Switch to bits/version.h for
>         __cpp_lib_robust_nonmodifying_seq_ops.
>         (robust equal, mismatch): Guard behind
>         __cpp_lib_nonmember_container_access.
>         * include/bits/stl_algo.h: Swtich to bits/version.h for
>         __cpp_lib_{clamp,sample}.
>         (clamp): Guard behind __cpp_lib_clamp.
>         (sample): Guard behind __cpp_lib_sample.
>         * include/bits/specfun.h: Switch to bits/version.h for
>         __cpp_lib_math_special_functions and __STDCPP_MATH_SPEC_FUNCS__.
>         * include/bits/shared_ptr_base.h: Switch to bits/version.h for
>         __cpp_lib_{smart_ptr_for_overwrite,shared_ptr_arrays}.
>         (_Sp_overwrite_tag): Guard behind
>         __cpp_lib_smart_ptr_for_overwrite.
>         * include/bits/shared_ptr_atomic.h: Switch to bits/version.h for
>         __cpp_lib_atomic_shared_ptr.
>         * include/bits/shared_ptr.h: Switch to bits/version.h for
>         __cpp_lib_{enable_shared_from_this,shared_ptr_weak_type}.
>         (shared_ptr<T>::weak_type): Guard behind
>         __cpp_lib_shared_ptr_weak_type.
>         (enable_shared_from_this<T>::weak_from_this): Guard behind
>         __cpp_lib_enable_shared_from_this.
>         * include/bits/ranges_cmp.h: Switch to bits/version.h for
>         __cpp_lib_ranges.
>         * include/bits/ranges_algo.h: Switch to bits/version.h for
>         __cpp_lib_{shift,ranges_{contains,find_last,fold,iota}}.
>         * include/bits/range_access.h: Switch to bits/version.h for
>         __cpp_lib_nonmember_container_access
>         (size, empty, data): Guard behind
>         __cpp_lib_nonmember_container_access.
>         (ssize): Guard behind __cpp_lib_ssize.
>         * include/bits/ptr_traits.h: Switch to bits/version.h. for
>         __cpp_lib_{constexpr_memory,to_address}.
>         (to_address): Guard behind __cpp_lib_to_address.
>         * include/bits/node_handle.h: Switch to bits/version.h for
>         __cpp_lib_node_extract.  Guard header behind that FTM.
>         * include/bits/move_only_function.h: Switch to bits/version.h for
>         __cpp_lib_move_only_function.  Guard header behind that FTM.
>         * include/bits/move.h: Switch to bits/version.h for
>         __cpp_lib_addressof_constexpr.
>         * include/bits/ios_base.h: Switch to bits/version.h for
>         __cpp_lib_ios_noreplace.
>         (noreplace): Guard with __cpp_lib_ios_noreplace.
>         * include/bits/hashtable.h: Switch to bits/version.h for
>         __cpp_lib_generic_unordered_lookup.
>         (_M_equal_range_tr, _M_count_tr, _M_find_tr): Guard behind
>         __cpp_lib_generic_unordered_lookup.
>         * include/bits/forward_list.h: Switch to bits/version.h for
>         __cpp_lib_list_remove_return_type.
>         (__remove_return_type): Guard behind
>         __cpp_lib_list_remove_return_type.
>         * include/bits/erase_if.h: Switch to bits/version.h for
>         __cpp_lib_erase_if.
>         * include/bits/cow_string.h: Switch to bits/version.h for
>         __cpp_lib_constexpr_string.
>         * include/bits/chrono.h: Swtich to bits/version.h for
>         __cpp_lib_chrono{,_udls}.
>         (ceil): Guard behind __cpp_lib_chrono.
>         (operator""ns et al): Guard behind __cpp_lib_chrono_udls.
>         * include/bits/char_traits.h: Switch to bits/version.h for
>         __cpp_lib_constexpr_char_traits.
>         * include/bits/basic_string.h: Switch to bits/version.h for
>         __cpp_lib_{constexpr_string,string_{resize_and_overwrite,udls}}.
>         (resize_and_overwrite): Guard behind
>         __cpp_lib_string_resize_and_overwrite.
>         (operator""s): Guard behind __cpp_lib_string_udls.
>         * include/bits/atomic_wait.h: Switch to bits/version.h for
>         __cpp_lib_atomic_wait.  Guard header behind that FTM.
>         * include/bits/atomic_base.h: Switch to bits/version.h for
>         __cpp_lib_atomic_value_initialization and
>         __cpp_lib_atomic_flag_test.
>         (atomic_flag::test): Guard behind __cpp_lib_atomic_flag_test,
>         rather than C++20.
>         * include/bits/allocator.h: Switch to bits/version.h for
>         __cpp_lib_incomplete_container_elements.
>         * include/bits/alloc_traits.h: Switch to using bits/version.h for
>         __cpp_lib_constexpr_dynamic_alloc and
>         __cpp_lib_allocator_traits_is_always_equal.
>         * include/bits/align.h: Switch to bits/version.h for defining
>         __cpp_lib_assume_aligned.
>         (assume_aligned): Guard with __cpp_lib_assume_aligned.
>         * include/bits/algorithmfwd.h: Switch to bits/version.h for
>         defining __cpp_lib_constexpr_algorithms.
>         * include/std/stacktrace: Switch to bits/version.h for
>         __cpp_lib_stacktrace.  Guard header behind that FTM.
>         * testsuite/23_containers/array/tuple_interface/get_neg.cc:
>         Update line numbers.


Thanks for adding the comments like "// C++ < 20".

I think in <any> the comment on the #endif can be just __cpp_lib_any
rather than defined(__cpp_lib_any). Similarly for
__cpp_lib_atomic_float in <atomic>. Oh, and __cpp_lib_atomic_ref. And
in <barrier>, and several others. I think I'd like those to be
consistent, and usually we just name the macro in the #endif comment,
sometimes abbreviated for clarity, without the explicit defined(...).

For this error in <atomic> please add <> around "version" and remove
the question mark:
+# error "libstdc++ bug: no lock-free atomics but they were emitted in version?"

Similarly, please remove the question marks from the two #errors in
<type_traits>:
+#  error "libstdc++ bug: is_corresponding_member and
is_layout_compatible are provided but their FTM is not set?"
+#  error "libstdc++ bug: is_pointer_interconvertible available but FTM unset?"

In <string_view> you have:
+# error "libstdc++ bug: string_contents not defined when it should be"
That should be contains, not contents.

OK for trunk with the #error changes. The #endif cleanup can be
fixed in a follow-up.

It seems like there's some inconsistency (probably some preexisting)
about whether you use:
#if __cpp_lib_xxx
or
#ifdef __cpp_lib_xxx
That can be tidied up later.

Currently we define many of the macros in the "bits" headers, e.g. in
bits/stl_iterator.h

+#define __glibcxx_want_constexpr_iterator
+#define __glibcxx_want_array_constexpr
+#define __glibcxx_want_make_reverse_iterator
+#define __glibcxx_want_move_iterator_concept
+#include <bits/version.h>

We should consider only defining those in <iterator> itself. So that
when other parts of the lib include bits/stl_iterator.h they don't
define the macros. That would mean that
__cpp_lib_make_reverse_iterator is not defined by <vector> and
<string>, for example. Even though they do actually provide the
features, the macro would only be defined by <version> and <iterator>.
This might encourage users to include the right headers, instead of
relying on transitive includes.

If we do that, our own internal checks for features would all need to use:
#if __glibcxx_make_reverse_iterator
because they wouldn't have the __cpp_lib_xxx macro, because they only
include the internal bits header not <iterator>.

That's for another day though.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use
  2023-08-16 11:15   ` Jonathan Wakely
@ 2023-08-16 12:47     ` Arsen Arsenović
  0 siblings, 0 replies; 6+ messages in thread
From: Arsen Arsenović @ 2023-08-16 12:47 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-patches, libstdc++

[-- Attachment #1: Type: text/plain, Size: 2711 bytes --]


Jonathan Wakely <jwakely@redhat.com> writes:

> [..snip..]
> Thanks for adding the comments like "// C++ < 20".
>
> I think in <any> the comment on the #endif can be just __cpp_lib_any
> rather than defined(__cpp_lib_any). Similarly for
> __cpp_lib_atomic_float in <atomic>. Oh, and __cpp_lib_atomic_ref. And
> in <barrier>, and several others. I think I'd like those to be
> consistent, and usually we just name the macro in the #endif comment,
> sometimes abbreviated for clarity, without the explicit defined(...).

ACK.  Fixed all of those.

> For this error in <atomic> please add <> around "version" and remove
> the question mark:
> +# error "libstdc++ bug: no lock-free atomics but they were emitted in version?"
>
> Similarly, please remove the question marks from the two #errors in
> <type_traits>:
> +#  error "libstdc++ bug: is_corresponding_member and
> is_layout_compatible are provided but their FTM is not set?"
> +#  error "libstdc++ bug: is_pointer_interconvertible available but FTM unset?"
>
> In <string_view> you have:
> +# error "libstdc++ bug: string_contents not defined when it should be"
> That should be contains, not contents.
>
> OK for trunk with the #error changes. The #endif cleanup can be
> fixed in a follow-up.
> 
> It seems like there's some inconsistency (probably some preexisting)
> about whether you use:
> #if __cpp_lib_xxx
> or
> #ifdef __cpp_lib_xxx
> That can be tidied up later.
>
> Currently we define many of the macros in the "bits" headers, e.g. in
> bits/stl_iterator.h
>
> +#define __glibcxx_want_constexpr_iterator
> +#define __glibcxx_want_array_constexpr
> +#define __glibcxx_want_make_reverse_iterator
> +#define __glibcxx_want_move_iterator_concept
> +#include <bits/version.h>
>
> We should consider only defining those in <iterator> itself. So that
> when other parts of the lib include bits/stl_iterator.h they don't
> define the macros. That would mean that
> __cpp_lib_make_reverse_iterator is not defined by <vector> and
> <string>, for example. Even though they do actually provide the
> features, the macro would only be defined by <version> and <iterator>.
> This might encourage users to include the right headers, instead of
> relying on transitive includes.

> If we do that, our own internal checks for features would all need to use:
> #if __glibcxx_make_reverse_iterator
> because they wouldn't have the __cpp_lib_xxx macro, because they only
> include the internal bits header not <iterator>.
>
> That's for another day though.

Yes, that sounds quite reasonable.  I like the idea that headers should
export narrower FTMs.

Pushed.  Thanks :-)
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-16 13:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-13 19:35 [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
2023-08-13 19:35 ` [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use Arsen Arsenović
2023-08-16 11:15   ` Jonathan Wakely
2023-08-16 12:47     ` Arsen Arsenović
2023-08-14 15:18 ` [PATCH v2 1/2] libstdc++: Implement more maintainable <version> header Arsen Arsenović
2023-08-16 11:15 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).