public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Arsen Arsenović" <arsen@aarsen.me>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org, "Arsen Arsenović" <arsen@aarsen.me>,
	"Jonathan Wakely" <jwakely@redhat.com>
Subject: [PATCH 04/10] libstdc++: Mark headers that must be hosted as such [PR103626]
Date: Fri, 30 Sep 2022 18:45:50 +0200	[thread overview]
Message-ID: <20220930164556.1198044-5-arsen@aarsen.me> (raw)
In-Reply-To: <20220930164556.1198044-1-arsen@aarsen.me>

PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding

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

libstdc++-v3/ChangeLog:
	PR libstdc++/103626
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/requires_hosted.h: New header.
	* include/experimental/algorithm: Include
	<bits/requires_hosted.h>.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/buffer: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/deque: Likewise.
	* include/experimental/executor: Likewise.
	* include/experimental/filesystem: Likewise.
	* include/experimental/forward_list: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/io_context: Likewise.
	* include/experimental/iterator: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/memory: Likewise.
	* include/experimental/memory_resource: Likewise.
	* include/experimental/net: Likewise.
	* include/experimental/netfwd: Likewise.
	* include/experimental/numeric: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/random: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/regex: Likewise.
	* include/experimental/scope: Likewise.
	* include/experimental/set: Likewise.
	* include/experimental/simd: Likewise.
	* include/experimental/socket: Likewise.
	* include/experimental/source_location: Likewise.
	* include/experimental/string: Likewise.
	* include/experimental/string_view: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/timer: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/unordered_map: Likewise.
	* include/experimental/unordered_set: Likewise.
	* include/experimental/utility: Likewise.
	* include/experimental/vector: Likewise.
	* include/std/barrier: Likewise.
	* include/std/chrono: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/deque: Likewise.
	* include/std/execution: Likewise.
	* include/std/filesystem: Likewise.
	* include/std/forward_list: Likewise.
	* include/std/fstream: Likewise.
	* include/std/future: Likewise.
	* include/std/iomanip: Likewise.
	* include/std/ios: Likewise.
	* include/std/iosfwd: Likewise.
	* include/std/iostream: Likewise.
	* include/std/istream: Likewise.
	* include/std/latch: Likewise.
	* include/std/list: Likewise.
	* include/std/locale: Likewise.
	* include/std/map: Likewise.
	* include/std/memory_resource: Likewise.
	* include/std/mutex: Likewise.
	* include/std/ostream: Likewise.
	* include/std/queue: Likewise.
	* include/std/random: Likewise.
	* include/std/regex: Likewise.
	* include/std/semaphore: Likewise.
	* include/std/set: Likewise.
	* include/std/shared_mutex: Likewise.
	* include/std/spanstream: Likewise.
	* include/std/sstream: Likewise.
	* include/std/stack: Likewise.
	* include/std/stacktrace: Likewise.
	* include/std/stop_token: Likewise.
	* include/std/streambuf: Likewise.
	* include/std/string: Likewise.
	* include/std/syncstream: Likewise.
	* include/std/system_error: Likewise.
	* include/std/thread: Likewise.
	* include/std/unordered_map: Likewise.
	* include/std/unordered_set: Likewise.
	* include/std/valarray: Likewise.
	* include/std/vector: Likewise.
	* include/tr1/array: Likewise.
	* include/tr1/ccomplex: Likewise.
	* include/tr1/cctype: Likewise.
	* include/tr1/cfenv: Likewise.
	* include/tr1/cfloat: Likewise.
	* include/tr1/cinttypes: Likewise.
	* include/tr1/climits: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/complex: Likewise.
	* include/tr1/complex.h: Likewise.
	* include/tr1/cstdarg: Likewise.
	* include/tr1/cstdbool: Likewise.
	* include/tr1/cstdint: Likewise.
	* include/tr1/cstdio: Likewise.
	* include/tr1/cstdlib: Likewise.
	* include/tr1/ctgmath: Likewise.
	* include/tr1/ctime: Likewise.
	* include/tr1/ctype.h: Likewise.
	* include/tr1/cwchar: Likewise.
	* include/tr1/cwctype: Likewise.
	* include/tr1/fenv.h: Likewise.
	* include/tr1/float.h: Likewise.
	* include/tr1/functional: Likewise.
	* include/tr1/inttypes.h: Likewise.
	* include/tr1/limits.h: Likewise.
	* include/tr1/math.h: Likewise.
	* include/tr1/memory: Likewise.
	* include/tr1/random: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr1/stdarg.h: Likewise.
	* include/tr1/stdbool.h: Likewise.
	* include/tr1/stdint.h: Likewise.
	* include/tr1/stdio.h: Likewise.
	* include/tr1/stdlib.h: Likewise.
	* include/tr1/tgmath.h: Likewise.
	* include/tr1/tuple: Likewise.
	* include/tr1/type_traits: Likewise.
	* include/tr1/unordered_map: Likewise.
	* include/tr1/unordered_set: Likewise.
	* include/tr1/utility: Likewise.
	* include/tr1/wchar.h: Likewise.
	* include/tr1/wctype.h: Likewise.
	* include/c_global/cmath: Likewise.
	* include/ext/algorithm: Include <bits/requires_hosted.h>.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/cmath: Likewise.
	* include/ext/codecvt_specializations.h: Likewise.
	* include/ext/debug_allocator.h: Likewise.
	* include/ext/enc_filebuf.h: Likewise.
	* include/ext/extptr_allocator.h: Likewise.
	* include/ext/functional: Likewise.
	* include/ext/malloc_allocator.h: Likewise.
	* include/ext/memory: Likewise.
	* include/ext/mt_allocator.h: Likewise.
	* include/ext/new_allocator.h: Likewise.
	* include/ext/numeric: Likewise.
	* include/ext/pod_char_traits.h: Likewise.
	* include/ext/pool_allocator.h: Likewise.
	* include/ext/random: Likewise.
	* include/ext/random.tcc: Likewise.
	* include/ext/rb_tree: Likewise.
	* include/ext/rc_string_base.h: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/ropeimpl.h: Likewise.
	* include/ext/slist: Likewise.
	* include/ext/sso_string_base.h: Likewise.
	* include/ext/stdio_filebuf.h: Likewise.
	* include/ext/stdio_sync_filebuf.h: Likewise.
	* include/ext/string_conversions.h: Likewise.
	* include/ext/throw_allocator.h: Likewise.
	* include/ext/vstring.h: Likewise.
	* include/ext/vstring.tcc: Likewise.
	* include/ext/vstring_fwd.h: Likewise.
	* include/ext/vstring_util.h: Likewise.
	* include/std/charconv: Likewise.
	(__cpp_lib_to_chars): Do not define for freestanding.
	* include/std/version: Adjust which macros get defined in
	freestanding.
	* include/ext/pointer.h [!_GLIBCXX_HOSTED]: Omit iostream
	functionality from freestanding.
	* include/std/algorithm [!_GLIBCXX_HOSTED]: Omit PSTL algos.
	* include/std/memory [!_GLIBCXX_HOSTED]: Omit
	<bits/stl_tempbuf.h> in freestanding
	* include/bits/algorithmfwd.h [!_GLIBCXX_HOSTED]: Omit leftover
	random_shuffle and stable_partition definition.
	* include/bits/stl_algo.h [!_GLIBCXX_HOSTED]: Omit
	random_shuffle and stable_partition from freestanding.
	* include/bits/ranges_algo.h [!_GLIBCXX_HOSTED]: Omit
	stable_partition from freestanding.
	* include/bits/concept_check.h: Remove needless HOSTED check.
	* include/std/iterator: Include <bits/ranges_base.h>.
	* include/std/numeric (__cpp_lib_parallel_algorithms): Do not
	define for freestanding.
	* include/std/functional (__cpp_lib_boyer_moore_searcher):
	Likewise.
	* testsuite/lib/prune.exp: Match error for hosted-only libstdc++
	tests.

Signed-off-by: Arsen Arsenović <arsen@aarsen.me>
---
 libstdc++-v3/include/Makefile.am              |   1 +
 libstdc++-v3/include/Makefile.in              |   1 +
 libstdc++-v3/include/bits/algorithmfwd.h      |   4 +
 libstdc++-v3/include/bits/concept_check.h     |   2 +-
 libstdc++-v3/include/bits/ranges_algo.h       |   2 +
 libstdc++-v3/include/bits/requires_hosted.h   |  37 +++++++
 libstdc++-v3/include/bits/stl_algo.h          |   2 +-
 libstdc++-v3/include/c_global/cmath           |   2 +
 libstdc++-v3/include/experimental/algorithm   |   2 +
 libstdc++-v3/include/experimental/any         |   2 +
 libstdc++-v3/include/experimental/array       |   2 +
 libstdc++-v3/include/experimental/buffer      |   2 +
 libstdc++-v3/include/experimental/chrono      |   2 +
 libstdc++-v3/include/experimental/deque       |   2 +
 libstdc++-v3/include/experimental/executor    |   2 +
 libstdc++-v3/include/experimental/filesystem  |   2 +
 .../include/experimental/forward_list         |   2 +
 libstdc++-v3/include/experimental/functional  |   2 +
 libstdc++-v3/include/experimental/internet    |   2 +
 libstdc++-v3/include/experimental/io_context  |   2 +
 libstdc++-v3/include/experimental/iterator    |   2 +
 libstdc++-v3/include/experimental/list        |   2 +
 libstdc++-v3/include/experimental/map         |   2 +
 libstdc++-v3/include/experimental/memory      |   2 +
 .../include/experimental/memory_resource      |   2 +
 libstdc++-v3/include/experimental/net         |   2 +
 libstdc++-v3/include/experimental/netfwd      |   2 +
 libstdc++-v3/include/experimental/numeric     |   2 +
 libstdc++-v3/include/experimental/optional    |   2 +
 .../include/experimental/propagate_const      |   2 +
 libstdc++-v3/include/experimental/random      |   2 +
 libstdc++-v3/include/experimental/ratio       |   2 +
 libstdc++-v3/include/experimental/regex       |   2 +
 libstdc++-v3/include/experimental/scope       |   2 +
 libstdc++-v3/include/experimental/set         |   2 +
 libstdc++-v3/include/experimental/simd        |   2 +
 libstdc++-v3/include/experimental/socket      |   2 +
 .../include/experimental/source_location      |   2 +
 libstdc++-v3/include/experimental/string      |   2 +
 libstdc++-v3/include/experimental/string_view |   2 +
 .../include/experimental/system_error         |   2 +
 libstdc++-v3/include/experimental/timer       |   2 +
 libstdc++-v3/include/experimental/tuple       |   2 +
 .../include/experimental/unordered_map        |   2 +
 .../include/experimental/unordered_set        |   2 +
 libstdc++-v3/include/experimental/utility     |   2 +
 libstdc++-v3/include/experimental/vector      |   2 +
 libstdc++-v3/include/ext/algorithm            |   2 +
 libstdc++-v3/include/ext/bitmap_allocator.h   |   2 +
 libstdc++-v3/include/ext/cmath                |   2 +
 .../include/ext/codecvt_specializations.h     |   2 +
 libstdc++-v3/include/ext/debug_allocator.h    |   2 +
 libstdc++-v3/include/ext/enc_filebuf.h        |   2 +
 libstdc++-v3/include/ext/extptr_allocator.h   |   2 +
 libstdc++-v3/include/ext/functional           |   2 +
 libstdc++-v3/include/ext/malloc_allocator.h   |   2 +
 libstdc++-v3/include/ext/memory               |   2 +
 libstdc++-v3/include/ext/mt_allocator.h       |   2 +
 libstdc++-v3/include/ext/new_allocator.h      |   2 +
 libstdc++-v3/include/ext/numeric              |   2 +
 libstdc++-v3/include/ext/pod_char_traits.h    |   2 +
 libstdc++-v3/include/ext/pointer.h            |   7 +-
 libstdc++-v3/include/ext/pool_allocator.h     |   2 +
 libstdc++-v3/include/ext/random               |   2 +
 libstdc++-v3/include/ext/random.tcc           |   2 +
 libstdc++-v3/include/ext/rb_tree              |   2 +
 libstdc++-v3/include/ext/rc_string_base.h     |   2 +
 libstdc++-v3/include/ext/rope                 |   2 +
 libstdc++-v3/include/ext/ropeimpl.h           |   2 +
 libstdc++-v3/include/ext/slist                |   2 +
 libstdc++-v3/include/ext/sso_string_base.h    |   2 +
 libstdc++-v3/include/ext/stdio_filebuf.h      |   2 +
 libstdc++-v3/include/ext/stdio_sync_filebuf.h |   2 +
 libstdc++-v3/include/ext/string_conversions.h |   2 +
 libstdc++-v3/include/ext/throw_allocator.h    |   2 +
 libstdc++-v3/include/ext/vstring.h            |   2 +
 libstdc++-v3/include/ext/vstring.tcc          |   2 +
 libstdc++-v3/include/ext/vstring_fwd.h        |   2 +
 libstdc++-v3/include/ext/vstring_util.h       |   2 +
 libstdc++-v3/include/std/algorithm            |   4 +-
 libstdc++-v3/include/std/barrier              |   2 +
 libstdc++-v3/include/std/charconv             |   4 +-
 libstdc++-v3/include/std/chrono               |   2 +
 libstdc++-v3/include/std/condition_variable   |   2 +
 libstdc++-v3/include/std/deque                |   2 +
 libstdc++-v3/include/std/execution            |   2 +
 libstdc++-v3/include/std/filesystem           |   2 +
 libstdc++-v3/include/std/forward_list         |   2 +
 libstdc++-v3/include/std/fstream              |   2 +
 libstdc++-v3/include/std/functional           |   3 +-
 libstdc++-v3/include/std/future               |   2 +
 libstdc++-v3/include/std/iomanip              |   2 +
 libstdc++-v3/include/std/ios                  |   2 +
 libstdc++-v3/include/std/iosfwd               |   2 +
 libstdc++-v3/include/std/iostream             |   2 +
 libstdc++-v3/include/std/istream              |   2 +
 libstdc++-v3/include/std/iterator             |   4 +
 libstdc++-v3/include/std/latch                |   2 +
 libstdc++-v3/include/std/list                 |   2 +
 libstdc++-v3/include/std/locale               |   2 +
 libstdc++-v3/include/std/map                  |   2 +
 libstdc++-v3/include/std/memory               |   2 +-
 libstdc++-v3/include/std/memory_resource      |   2 +
 libstdc++-v3/include/std/mutex                |   2 +
 libstdc++-v3/include/std/numeric              |   2 +-
 libstdc++-v3/include/std/ostream              |   2 +
 libstdc++-v3/include/std/queue                |   2 +
 libstdc++-v3/include/std/random               |   2 +
 libstdc++-v3/include/std/regex                |   2 +
 libstdc++-v3/include/std/semaphore            |   2 +
 libstdc++-v3/include/std/set                  |   2 +
 libstdc++-v3/include/std/shared_mutex         |   2 +
 libstdc++-v3/include/std/spanstream           |   2 +
 libstdc++-v3/include/std/sstream              |   2 +
 libstdc++-v3/include/std/stack                |   2 +
 libstdc++-v3/include/std/stacktrace           |   2 +
 libstdc++-v3/include/std/stop_token           |   2 +
 libstdc++-v3/include/std/streambuf            |   2 +
 libstdc++-v3/include/std/string               |   2 +
 libstdc++-v3/include/std/syncstream           |   2 +
 libstdc++-v3/include/std/system_error         |   2 +
 libstdc++-v3/include/std/thread               |   2 +
 libstdc++-v3/include/std/unordered_map        |   2 +
 libstdc++-v3/include/std/unordered_set        |   2 +
 libstdc++-v3/include/std/valarray             |   2 +
 libstdc++-v3/include/std/vector               |   2 +
 libstdc++-v3/include/std/version              | 100 +++++++++---------
 libstdc++-v3/include/tr1/array                |   2 +
 libstdc++-v3/include/tr1/ccomplex             |   2 +
 libstdc++-v3/include/tr1/cctype               |   2 +
 libstdc++-v3/include/tr1/cfenv                |   2 +
 libstdc++-v3/include/tr1/cfloat               |   2 +
 libstdc++-v3/include/tr1/cinttypes            |   2 +
 libstdc++-v3/include/tr1/climits              |   2 +
 libstdc++-v3/include/tr1/cmath                |   2 +
 libstdc++-v3/include/tr1/complex              |   2 +
 libstdc++-v3/include/tr1/complex.h            |   2 +
 libstdc++-v3/include/tr1/cstdarg              |   2 +
 libstdc++-v3/include/tr1/cstdbool             |   2 +
 libstdc++-v3/include/tr1/cstdint              |   2 +
 libstdc++-v3/include/tr1/cstdio               |   2 +
 libstdc++-v3/include/tr1/cstdlib              |   2 +
 libstdc++-v3/include/tr1/ctgmath              |   2 +
 libstdc++-v3/include/tr1/ctime                |   2 +
 libstdc++-v3/include/tr1/ctype.h              |   2 +
 libstdc++-v3/include/tr1/cwchar               |   2 +
 libstdc++-v3/include/tr1/cwctype              |   2 +
 libstdc++-v3/include/tr1/fenv.h               |   2 +
 libstdc++-v3/include/tr1/float.h              |   2 +
 libstdc++-v3/include/tr1/functional           |   2 +
 libstdc++-v3/include/tr1/inttypes.h           |   2 +
 libstdc++-v3/include/tr1/limits.h             |   2 +
 libstdc++-v3/include/tr1/math.h               |   2 +
 libstdc++-v3/include/tr1/memory               |   2 +
 libstdc++-v3/include/tr1/random               |   2 +
 libstdc++-v3/include/tr1/regex                |   2 +
 libstdc++-v3/include/tr1/stdarg.h             |   2 +
 libstdc++-v3/include/tr1/stdbool.h            |   2 +
 libstdc++-v3/include/tr1/stdint.h             |   2 +
 libstdc++-v3/include/tr1/stdio.h              |   2 +
 libstdc++-v3/include/tr1/stdlib.h             |   2 +
 libstdc++-v3/include/tr1/tgmath.h             |   2 +
 libstdc++-v3/include/tr1/tuple                |   2 +
 libstdc++-v3/include/tr1/type_traits          |   2 +
 libstdc++-v3/include/tr1/unordered_map        |   2 +
 libstdc++-v3/include/tr1/unordered_set        |   2 +
 libstdc++-v3/include/tr1/utility              |   2 +
 libstdc++-v3/include/tr1/wchar.h              |   2 +
 libstdc++-v3/include/tr1/wctype.h             |   2 +
 libstdc++-v3/testsuite/lib/prune.exp          |   4 +
 170 files changed, 428 insertions(+), 59 deletions(-)
 create mode 100644 libstdc++-v3/include/bits/requires_hosted.h

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 3472e84f75c..56227427b6d 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -193,6 +193,7 @@ bits_headers = \
 	${bits_srcdir}/regex_compiler.tcc \
 	${bits_srcdir}/regex_executor.h \
 	${bits_srcdir}/regex_executor.tcc \
+	${bits_srcdir}/requires_hosted.h \
 	${bits_srcdir}/semaphore_base.h \
 	${bits_srcdir}/shared_ptr.h \
 	${bits_srcdir}/shared_ptr_atomic.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 39ef34fc3ce..f6ed98fefcd 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -551,6 +551,7 @@ bits_headers = \
 	${bits_srcdir}/regex_compiler.tcc \
 	${bits_srcdir}/regex_executor.h \
 	${bits_srcdir}/regex_executor.tcc \
+	${bits_srcdir}/requires_hosted.h \
 	${bits_srcdir}/semaphore_base.h \
 	${bits_srcdir}/shared_ptr.h \
 	${bits_srcdir}/shared_ptr_atomic.h \
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index aacc34e09e8..08330528e8e 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -638,9 +638,11 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
     void
     sort_heap(_RAIter, _RAIter, _Compare);
 
+#if _GLIBCXX_HOSTED
   template<typename _BIter, typename _Predicate>
     _BIter
     stable_partition(_BIter, _BIter, _Predicate);
+#endif
 
 #if __cplusplus < 201103L
   // For C++11 swap() is declared in <type_traits>.
@@ -828,6 +830,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
     _BIter
     partition(_BIter, _BIter, _Predicate);
 
+#if _GLIBCXX_HOSTED
   template<typename _RAIter>
     void
     random_shuffle(_RAIter, _RAIter);
@@ -840,6 +843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 #else
 		   _Generator&);
 #endif
+#endif // HOSTED
 
   template<typename _FIter, typename _Tp>
     _GLIBCXX20_CONSTEXPR
diff --git a/libstdc++-v3/include/bits/concept_check.h b/libstdc++-v3/include/bits/concept_check.h
index 35969d27280..32b794d147e 100644
--- a/libstdc++-v3/include/bits/concept_check.h
+++ b/libstdc++-v3/include/bits/concept_check.h
@@ -43,7 +43,7 @@
 // configure options or editing c++config.h.
 // It is not supported for freestanding implementations.
 
-#if !defined(_GLIBCXX_CONCEPT_CHECKS) || !_GLIBCXX_HOSTED
+#if !defined(_GLIBCXX_CONCEPT_CHECKS)
 
 #define __glibcxx_function_requires(...)
 #define __glibcxx_class_requires(_a,_b)
diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h
index 228e10b62bf..de71bd07a2f 100644
--- a/libstdc++-v3/include/bits/ranges_algo.h
+++ b/libstdc++-v3/include/bits/ranges_algo.h
@@ -2326,6 +2326,7 @@ namespace ranges
 
   inline constexpr __partition_fn partition{};
 
+#if _GLIBCXX_HOSTED
   struct __stable_partition_fn
   {
     template<bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent,
@@ -2356,6 +2357,7 @@ namespace ranges
   };
 
   inline constexpr __stable_partition_fn stable_partition{};
+#endif
 
   template<typename _Iter, typename _Out1, typename _Out2>
     struct in_out_out_result
diff --git a/libstdc++-v3/include/bits/requires_hosted.h b/libstdc++-v3/include/bits/requires_hosted.h
new file mode 100644
index 00000000000..86916e22682
--- /dev/null
+++ b/libstdc++-v3/include/bits/requires_hosted.h
@@ -0,0 +1,37 @@
+// Copyright The GNU Toolchain Authors.
+//
+// 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/>.
+
+/** @file bits/requires_hosted.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{version}
+ */
+
+#ifndef _REQUIRES_FREESTANDING_H
+#define _REQUIRES_FREESTANDING_H 1
+
+#include <bits/c++config.h>
+
+#if !_GLIBCXX_HOSTED
+#  error "This header is not available in freestanding mode."
+#endif
+
+#endif
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index e63fe66852e..6386918fc8b 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -4594,7 +4594,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 	      std::iter_swap(__i, __j);
 	  }
     }
-#endif // HOSTED
 
   /**
    *  @brief Shuffle the elements of a sequence using a random number
@@ -4638,6 +4637,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 	    std::iter_swap(__i, __j);
 	}
     }
+#endif // HOSTED
 #endif // C++11 || USE_DEPRECATED
 
   /**
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 1b993f30330..cc14982d3bb 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -38,6 +38,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h>
+
 #include <bits/c++config.h>
 #include <bits/cpp_type_traits.h>
 #include <ext/type_traits.h>
diff --git a/libstdc++-v3/include/experimental/algorithm b/libstdc++-v3/include/experimental/algorithm
index 5a4a0221222..99348cbb799 100644
--- a/libstdc++-v3/include/experimental/algorithm
+++ b/libstdc++-v3/include/experimental/algorithm
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <algorithm>
diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index b8ff90ae204..b8ab5a81236 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <typeinfo>
diff --git a/libstdc++-v3/include/experimental/array b/libstdc++-v3/include/experimental/array
index 3a064d2181f..f2bdd650f06 100644
--- a/libstdc++-v3/include/experimental/array
+++ b/libstdc++-v3/include/experimental/array
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <array>
diff --git a/libstdc++-v3/include/experimental/buffer b/libstdc++-v3/include/experimental/buffer
index 0c103e14891..bc346180d92 100644
--- a/libstdc++-v3/include/experimental/buffer
+++ b/libstdc++-v3/include/experimental/buffer
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <array>
diff --git a/libstdc++-v3/include/experimental/chrono b/libstdc++-v3/include/experimental/chrono
index 8ec31910cd8..417f8be5562 100644
--- a/libstdc++-v3/include/experimental/chrono
+++ b/libstdc++-v3/include/experimental/chrono
@@ -36,6 +36,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <bits/chrono.h> // Only the C++14 parts of <chrono>
diff --git a/libstdc++-v3/include/experimental/deque b/libstdc++-v3/include/experimental/deque
index b64deee1990..4f3d12df832 100644
--- a/libstdc++-v3/include/experimental/deque
+++ b/libstdc++-v3/include/experimental/deque
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <deque>
diff --git a/libstdc++-v3/include/experimental/executor b/libstdc++-v3/include/experimental/executor
index bfcf2171f9b..9d0cd6edb94 100644
--- a/libstdc++-v3/include/experimental/executor
+++ b/libstdc++-v3/include/experimental/executor
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <algorithm>
diff --git a/libstdc++-v3/include/experimental/filesystem b/libstdc++-v3/include/experimental/filesystem
index 85872e61693..7c47e6b79d1 100644
--- a/libstdc++-v3/include/experimental/filesystem
+++ b/libstdc++-v3/include/experimental/filesystem
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201103L
 
 #include <experimental/bits/fs_fwd.h>
diff --git a/libstdc++-v3/include/experimental/forward_list b/libstdc++-v3/include/experimental/forward_list
index fedf2ba0c3b..679b43d8c86 100644
--- a/libstdc++-v3/include/experimental/forward_list
+++ b/libstdc++-v3/include/experimental/forward_list
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <forward_list>
diff --git a/libstdc++-v3/include/experimental/functional b/libstdc++-v3/include/experimental/functional
index 1a47b522bf4..a0e73fa46b9 100644
--- a/libstdc++-v3/include/experimental/functional
+++ b/libstdc++-v3/include/experimental/functional
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <functional>
diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet
index 4be4bfb731e..6e3c355f38e 100644
--- a/libstdc++-v3/include/experimental/internet
+++ b/libstdc++-v3/include/experimental/internet
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <experimental/netfwd>
diff --git a/libstdc++-v3/include/experimental/io_context b/libstdc++-v3/include/experimental/io_context
index 8d4fc25f2ca..cea2a864e9c 100644
--- a/libstdc++-v3/include/experimental/io_context
+++ b/libstdc++-v3/include/experimental/io_context
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <atomic>
diff --git a/libstdc++-v3/include/experimental/iterator b/libstdc++-v3/include/experimental/iterator
index e68d09cab33..35ac5a6044c 100644
--- a/libstdc++-v3/include/experimental/iterator
+++ b/libstdc++-v3/include/experimental/iterator
@@ -36,6 +36,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <iterator>
diff --git a/libstdc++-v3/include/experimental/list b/libstdc++-v3/include/experimental/list
index 7e4ef189107..7d49eefe5ec 100644
--- a/libstdc++-v3/include/experimental/list
+++ b/libstdc++-v3/include/experimental/list
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <list>
diff --git a/libstdc++-v3/include/experimental/map b/libstdc++-v3/include/experimental/map
index 4936a660189..525252b83c1 100644
--- a/libstdc++-v3/include/experimental/map
+++ b/libstdc++-v3/include/experimental/map
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <map>
diff --git a/libstdc++-v3/include/experimental/memory b/libstdc++-v3/include/experimental/memory
index 6cf11b4a14d..fabeb581161 100644
--- a/libstdc++-v3/include/experimental/memory
+++ b/libstdc++-v3/include/experimental/memory
@@ -36,6 +36,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <memory>
diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource
index d70a93219fa..aa86c042d84 100644
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <memory>			// align, uses_allocator, __uses_alloc
diff --git a/libstdc++-v3/include/experimental/net b/libstdc++-v3/include/experimental/net
index 9d1d5c7a430..1268528d76c 100644
--- a/libstdc++-v3/include/experimental/net
+++ b/libstdc++-v3/include/experimental/net
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <experimental/executor>
diff --git a/libstdc++-v3/include/experimental/netfwd b/libstdc++-v3/include/experimental/netfwd
index 2fd6ff9cf0e..e1e05336f10 100644
--- a/libstdc++-v3/include/experimental/netfwd
+++ b/libstdc++-v3/include/experimental/netfwd
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 // #define __cpp_lib_experimental_net 201803
diff --git a/libstdc++-v3/include/experimental/numeric b/libstdc++-v3/include/experimental/numeric
index 426d9430dd6..26be27a7b72 100644
--- a/libstdc++-v3/include/experimental/numeric
+++ b/libstdc++-v3/include/experimental/numeric
@@ -36,6 +36,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <numeric>
diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional
index 0d3a89404d1..c5da58aa938 100644
--- a/libstdc++-v3/include/experimental/optional
+++ b/libstdc++-v3/include/experimental/optional
@@ -30,6 +30,8 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_OPTIONAL
 #define _GLIBCXX_EXPERIMENTAL_OPTIONAL 1
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <type_traits>
diff --git a/libstdc++-v3/include/experimental/propagate_const b/libstdc++-v3/include/experimental/propagate_const
index 80fcb2c0605..258ef6fdd44 100644
--- a/libstdc++-v3/include/experimental/propagate_const
+++ b/libstdc++-v3/include/experimental/propagate_const
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <type_traits>
diff --git a/libstdc++-v3/include/experimental/random b/libstdc++-v3/include/experimental/random
index adef31fabd6..8728aa30f02 100644
--- a/libstdc++-v3/include/experimental/random
+++ b/libstdc++-v3/include/experimental/random
@@ -30,6 +30,8 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_RANDOM
 #define _GLIBCXX_EXPERIMENTAL_RANDOM 1
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 #include <random>
 #include <experimental/bits/lfts_config.h>
diff --git a/libstdc++-v3/include/experimental/ratio b/libstdc++-v3/include/experimental/ratio
index 59ce85e7f30..5d873f2d673 100644
--- a/libstdc++-v3/include/experimental/ratio
+++ b/libstdc++-v3/include/experimental/ratio
@@ -36,6 +36,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <ratio>
diff --git a/libstdc++-v3/include/experimental/regex b/libstdc++-v3/include/experimental/regex
index 9d063c6f5b4..5efb8867347 100644
--- a/libstdc++-v3/include/experimental/regex
+++ b/libstdc++-v3/include/experimental/regex
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <regex>
diff --git a/libstdc++-v3/include/experimental/scope b/libstdc++-v3/include/experimental/scope
index 208fadc513e..5dbeac14795 100644
--- a/libstdc++-v3/include/experimental/scope
+++ b/libstdc++-v3/include/experimental/scope
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 202002L
 
 #include <concepts>
diff --git a/libstdc++-v3/include/experimental/set b/libstdc++-v3/include/experimental/set
index aa43a2b2fc3..b42a3cdcf1a 100644
--- a/libstdc++-v3/include/experimental/set
+++ b/libstdc++-v3/include/experimental/set
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <set>
diff --git a/libstdc++-v3/include/experimental/simd b/libstdc++-v3/include/experimental/simd
index f526c70c728..4bd46481a25 100644
--- a/libstdc++-v3/include/experimental/simd
+++ b/libstdc++-v3/include/experimental/simd
@@ -33,6 +33,8 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SIMD
 #define _GLIBCXX_EXPERIMENTAL_SIMD
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201703L
 
 /** @defgroup par-ts Parallelism TS
diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket
index 868927afeb5..65fe2b7535b 100644
--- a/libstdc++-v3/include/experimental/socket
+++ b/libstdc++-v3/include/experimental/socket
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <experimental/netfwd>
diff --git a/libstdc++-v3/include/experimental/source_location b/libstdc++-v3/include/experimental/source_location
index afd3401117c..acd41c0c9de 100644
--- a/libstdc++-v3/include/experimental/source_location
+++ b/libstdc++-v3/include/experimental/source_location
@@ -30,6 +30,8 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SRCLOC
 #define _GLIBCXX_EXPERIMENTAL_SRCLOC 1
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 #include <cstdint>
 
diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string
index 01bd84b4df9..f326b85a0db 100644
--- a/libstdc++-v3/include/experimental/string
+++ b/libstdc++-v3/include/experimental/string
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <string>
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index ff04bb1fd0b..f5b4cf10c44 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -36,6 +36,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <string>
diff --git a/libstdc++-v3/include/experimental/system_error b/libstdc++-v3/include/experimental/system_error
index 9023d4429eb..f41cddda8f4 100644
--- a/libstdc++-v3/include/experimental/system_error
+++ b/libstdc++-v3/include/experimental/system_error
@@ -36,6 +36,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <system_error>
diff --git a/libstdc++-v3/include/experimental/timer b/libstdc++-v3/include/experimental/timer
index 745f3a465ba..02498b0aed5 100644
--- a/libstdc++-v3/include/experimental/timer
+++ b/libstdc++-v3/include/experimental/timer
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <bits/chrono.h>
diff --git a/libstdc++-v3/include/experimental/tuple b/libstdc++-v3/include/experimental/tuple
index 338f2f5efb4..906bd7b1225 100644
--- a/libstdc++-v3/include/experimental/tuple
+++ b/libstdc++-v3/include/experimental/tuple
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <tuple>
diff --git a/libstdc++-v3/include/experimental/unordered_map b/libstdc++-v3/include/experimental/unordered_map
index 1a41687d593..ce56c2afb8c 100644
--- a/libstdc++-v3/include/experimental/unordered_map
+++ b/libstdc++-v3/include/experimental/unordered_map
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <unordered_map>
diff --git a/libstdc++-v3/include/experimental/unordered_set b/libstdc++-v3/include/experimental/unordered_set
index 583c43798a7..c7075874daf 100644
--- a/libstdc++-v3/include/experimental/unordered_set
+++ b/libstdc++-v3/include/experimental/unordered_set
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <unordered_set>
diff --git a/libstdc++-v3/include/experimental/utility b/libstdc++-v3/include/experimental/utility
index 61567313cce..cc335e02ccd 100644
--- a/libstdc++-v3/include/experimental/utility
+++ b/libstdc++-v3/include/experimental/utility
@@ -30,6 +30,8 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_UTILITY
 #define _GLIBCXX_EXPERIMENTAL_UTILITY 1
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 #include <utility>
 #include <bits/uses_allocator.h>
diff --git a/libstdc++-v3/include/experimental/vector b/libstdc++-v3/include/experimental/vector
index 2b611fc1937..4e8c8461e44 100644
--- a/libstdc++-v3/include/experimental/vector
+++ b/libstdc++-v3/include/experimental/vector
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // experimental is currently omitted
+
 #if __cplusplus >= 201402L
 
 #include <vector>
diff --git a/libstdc++-v3/include/ext/algorithm b/libstdc++-v3/include/ext/algorithm
index f5eced66feb..65122dab5a3 100644
--- a/libstdc++-v3/include/ext/algorithm
+++ b/libstdc++-v3/include/ext/algorithm
@@ -58,6 +58,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <algorithm>
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h
index 033f132148a..80b8fa779bb 100644
--- a/libstdc++-v3/include/ext/bitmap_allocator.h
+++ b/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -29,6 +29,8 @@
 #ifndef _BITMAP_ALLOCATOR_H
 #define _BITMAP_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <utility> // For std::pair.
 #include <bits/functexcept.h> // For __throw_bad_alloc().
 #include <bits/stl_function.h> // For greater_equal, and less_equal.
diff --git a/libstdc++-v3/include/ext/cmath b/libstdc++-v3/include/ext/cmath
index 22919699003..2ebad8b0c85 100644
--- a/libstdc++-v3/include/ext/cmath
+++ b/libstdc++-v3/include/ext/cmath
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/ext/codecvt_specializations.h b/libstdc++-v3/include/ext/codecvt_specializations.h
index 51b638d7f29..7f733e67b0c 100644
--- a/libstdc++-v3/include/ext/codecvt_specializations.h
+++ b/libstdc++-v3/include/ext/codecvt_specializations.h
@@ -35,6 +35,8 @@
 #ifndef _EXT_CODECVT_SPECIALIZATIONS_H
 #define _EXT_CODECVT_SPECIALIZATIONS_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <bits/c++config.h>
 #include <locale>
 #include <iconv.h>
diff --git a/libstdc++-v3/include/ext/debug_allocator.h b/libstdc++-v3/include/ext/debug_allocator.h
index 3490dca8c5d..06c15fb561c 100644
--- a/libstdc++-v3/include/ext/debug_allocator.h
+++ b/libstdc++-v3/include/ext/debug_allocator.h
@@ -42,6 +42,8 @@
 #ifndef _DEBUG_ALLOCATOR_H
 #define _DEBUG_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <stdexcept>
 #include <bits/functexcept.h>
 #include <ext/alloc_traits.h>
diff --git a/libstdc++-v3/include/ext/enc_filebuf.h b/libstdc++-v3/include/ext/enc_filebuf.h
index 12869a8b02d..fc3d9a88163 100644
--- a/libstdc++-v3/include/ext/enc_filebuf.h
+++ b/libstdc++-v3/include/ext/enc_filebuf.h
@@ -29,6 +29,8 @@
 #ifndef _EXT_ENC_FILEBUF_H
 #define _EXT_ENC_FILEBUF_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <fstream>
 #include <locale>
 #include <ext/codecvt_specializations.h>
diff --git a/libstdc++-v3/include/ext/extptr_allocator.h b/libstdc++-v3/include/ext/extptr_allocator.h
index 20f746e73b6..ad538c77169 100644
--- a/libstdc++-v3/include/ext/extptr_allocator.h
+++ b/libstdc++-v3/include/ext/extptr_allocator.h
@@ -36,6 +36,8 @@
 #ifndef _EXTPTR_ALLOCATOR_H
 #define _EXTPTR_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <memory>
 #include <ext/numeric_traits.h>
 #include <ext/pointer.h>
diff --git a/libstdc++-v3/include/ext/functional b/libstdc++-v3/include/ext/functional
index 19cd8d5b563..9cf864d9290 100644
--- a/libstdc++-v3/include/ext/functional
+++ b/libstdc++-v3/include/ext/functional
@@ -58,6 +58,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <functional>
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/ext/malloc_allocator.h b/libstdc++-v3/include/ext/malloc_allocator.h
index 82b3f0a1c6f..6323ed9b60d 100644
--- a/libstdc++-v3/include/ext/malloc_allocator.h
+++ b/libstdc++-v3/include/ext/malloc_allocator.h
@@ -29,6 +29,8 @@
 #ifndef _MALLOC_ALLOCATOR_H
 #define _MALLOC_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // malloc
+
 #include <cstdlib>
 #include <cstddef>
 #include <new>
diff --git a/libstdc++-v3/include/ext/memory b/libstdc++-v3/include/ext/memory
index 105952a3517..9e0082bd20a 100644
--- a/libstdc++-v3/include/ext/memory
+++ b/libstdc++-v3/include/ext/memory
@@ -58,6 +58,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <memory>
 #include <bits/stl_tempbuf.h>
 
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 393d6eb0ae7..49743e46d0c 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -29,6 +29,8 @@
 #ifndef _MT_ALLOCATOR_H
 #define _MT_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // getenv
+
 #include <new>
 #include <cstdlib>
 #include <bits/functexcept.h>
diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h
index 96e6523977a..db8895faf8e 100644
--- a/libstdc++-v3/include/ext/new_allocator.h
+++ b/libstdc++-v3/include/ext/new_allocator.h
@@ -29,6 +29,8 @@
 #ifndef _NEW_ALLOCATOR_H
 #define _NEW_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <bits/new_allocator.h>
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/ext/numeric b/libstdc++-v3/include/ext/numeric
index 0b2c4ee0ba8..1d9f4f44747 100644
--- a/libstdc++-v3/include/ext/numeric
+++ b/libstdc++-v3/include/ext/numeric
@@ -58,6 +58,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <bits/concept_check.h>
 #include <numeric>
 
diff --git a/libstdc++-v3/include/ext/pod_char_traits.h b/libstdc++-v3/include/ext/pod_char_traits.h
index fa0f5b607f7..95d90f3e2dc 100644
--- a/libstdc++-v3/include/ext/pod_char_traits.h
+++ b/libstdc++-v3/include/ext/pod_char_traits.h
@@ -34,6 +34,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <string>
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h
index 04804f0287a..48b768499fd 100644
--- a/libstdc++-v3/include/ext/pointer.h
+++ b/libstdc++-v3/include/ext/pointer.h
@@ -38,7 +38,10 @@
 
 #pragma GCC system_header
 
-#include <iosfwd>
+#if _GLIBCXX_HOSTED
+#  include <iosfwd>
+#endif
+
 #include <bits/stl_iterator_base_types.h>
 #include <ext/cast.h>
 #include <ext/type_traits.h>
@@ -559,11 +562,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                const _Pointer_adapter<_Tp>& __rhs)
     { return !(__lhs._Tp::operator<(__rhs)); }
 
+#if _GLIBCXX_HOSTED
   template<typename _CharT, typename _Traits, typename _StoreT>
     inline std::basic_ostream<_CharT, _Traits>&
     operator<<(std::basic_ostream<_CharT, _Traits>& __os, 
                const _Pointer_adapter<_StoreT>& __p)
     { return (__os << __p.get()); }
+#endif // HOSTED
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
diff --git a/libstdc++-v3/include/ext/pool_allocator.h b/libstdc++-v3/include/ext/pool_allocator.h
index 8d0f08979f0..f04a88c8d6c 100644
--- a/libstdc++-v3/include/ext/pool_allocator.h
+++ b/libstdc++-v3/include/ext/pool_allocator.h
@@ -42,6 +42,8 @@
 #ifndef _POOL_ALLOCATOR_H
 #define _POOL_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <bits/c++config.h>
 #include <cstdlib>
 #include <new>
diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random
index 50505b876cc..4cc0e25e025 100644
--- a/libstdc++-v3/include/ext/random
+++ b/libstdc++-v3/include/ext/random
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc
index 71ceea88278..7274e0d9f1a 100644
--- a/libstdc++-v3/include/ext/random.tcc
+++ b/libstdc++-v3/include/ext/random.tcc
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/ext/rb_tree b/libstdc++-v3/include/ext/rb_tree
index b61c45b2206..dd685fb2781 100644
--- a/libstdc++-v3/include/ext/rb_tree
+++ b/libstdc++-v3/include/ext/rb_tree
@@ -58,6 +58,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <bits/stl_tree.h>
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index f196d884380..21ccfc21e57 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -30,6 +30,8 @@
 #ifndef _RC_STRING_BASE_H
 #define _RC_STRING_BASE_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <ext/atomicity.h>
 #include <ext/alloc_traits.h>
 #include <bits/stl_iterator_base_funcs.h>
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
index f8af374f042..a5a821ebf03 100644
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -45,6 +45,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <algorithm>
 #include <iosfwd>
 #include <bits/stl_construct.h>
diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
index 27cb7389d74..fe35d9162c1 100644
--- a/libstdc++-v3/include/ext/ropeimpl.h
+++ b/libstdc++-v3/include/ext/ropeimpl.h
@@ -1227,6 +1227,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		__result = _S_concat(__forest[__i], __result);
 		__forest[__i]->_M_unref_nonnil();
 #if !defined(__GC) && __cpp_exceptions
+
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
 		__forest[__i] = 0;
 #endif
 	      }
diff --git a/libstdc++-v3/include/ext/slist b/libstdc++-v3/include/ext/slist
index 7b6f8820d2a..f2b5109b065 100644
--- a/libstdc++-v3/include/ext/slist
+++ b/libstdc++-v3/include/ext/slist
@@ -44,6 +44,8 @@
 #ifndef _SLIST
 #define _SLIST 1
 
+#include <bits/requires_hosted.h> // std::allocator
+
 #include <algorithm>
 #include <bits/allocator.h>
 #include <bits/stl_construct.h>
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index f2209e704bf..db5dc437898 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -30,6 +30,8 @@
 #ifndef _SSO_STRING_BASE_H
 #define _SSO_STRING_BASE_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/ext/stdio_filebuf.h b/libstdc++-v3/include/ext/stdio_filebuf.h
index 878839bf2ac..0e83e354276 100644
--- a/libstdc++-v3/include/ext/stdio_filebuf.h
+++ b/libstdc++-v3/include/ext/stdio_filebuf.h
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <fstream>
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/ext/stdio_sync_filebuf.h b/libstdc++-v3/include/ext/stdio_sync_filebuf.h
index 49437c96976..8f51ae275b7 100644
--- a/libstdc++-v3/include/ext/stdio_sync_filebuf.h
+++ b/libstdc++-v3/include/ext/stdio_sync_filebuf.h
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <streambuf>
 #include <cstdio>
 #include <bits/c++io.h>  // For __c_file
diff --git a/libstdc++-v3/include/ext/string_conversions.h b/libstdc++-v3/include/ext/string_conversions.h
index fc03974b5a0..a4648a9852f 100644
--- a/libstdc++-v3/include/ext/string_conversions.h
+++ b/libstdc++-v3/include/ext/string_conversions.h
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index 220f5f5243f..a1b57e7e6d9 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -46,6 +46,8 @@
 #ifndef _THROW_ALLOCATOR_H
 #define _THROW_ALLOCATOR_H 1
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <cmath>
 #include <ctime>
 #include <map>
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index 47cbabf24f1..f0a12d64589 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #if __cplusplus >= 201103L
 #include <initializer_list>
 #endif
diff --git a/libstdc++-v3/include/ext/vstring.tcc b/libstdc++-v3/include/ext/vstring.tcc
index 0776fdcad1f..18e4bbb283e 100644
--- a/libstdc++-v3/include/ext/vstring.tcc
+++ b/libstdc++-v3/include/ext/vstring.tcc
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <bits/cxxabi_forced.h>
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/ext/vstring_fwd.h b/libstdc++-v3/include/ext/vstring_fwd.h
index c787e95efed..121492b0652 100644
--- a/libstdc++-v3/include/ext/vstring_fwd.h
+++ b/libstdc++-v3/include/ext/vstring_fwd.h
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <bits/c++config.h>
 #include <bits/char_traits.h>
 #include <bits/allocator.h>
diff --git a/libstdc++-v3/include/ext/vstring_util.h b/libstdc++-v3/include/ext/vstring_util.h
index 713c6976d75..4e58a710894 100644
--- a/libstdc++-v3/include/ext/vstring_util.h
+++ b/libstdc++-v3/include/ext/vstring_util.h
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // GNU extensions are currently omitted
+
 #include <ext/vstring_fwd.h>
 #include <debug/debug.h>
 #include <bits/stl_function.h>  // For less
diff --git a/libstdc++-v3/include/std/algorithm b/libstdc++-v3/include/std/algorithm
index e2cfd7ca662..4b39bfce134 100644
--- a/libstdc++-v3/include/std/algorithm
+++ b/libstdc++-v3/include/std/algorithm
@@ -63,7 +63,7 @@
 # include <bits/ranges_algo.h>
 #endif
 
-#if __cplusplus > 201402L
+#if __cplusplus > 201402L && _GLIBCXX_HOSTED
 // Parallel STL algorithms
 # if _PSTL_EXECUTION_POLICIES_DEFINED
 // If <execution> has already been included, pull in implementations
@@ -76,7 +76,7 @@
 
 // Feature test macro for parallel algorithms
 # define __cpp_lib_parallel_algorithm 201603L
-#endif // C++17
+#endif // C++17 && HOSTED
 
 #ifdef _GLIBCXX_PARALLEL
 # include <parallel/algorithm>
diff --git a/libstdc++-v3/include/std/barrier b/libstdc++-v3/include/std/barrier
index 997e0a8f7ab..ab6dd8bd83d 100644
--- a/libstdc++-v3/include/std/barrier
+++ b/libstdc++-v3/include/std/barrier
@@ -40,6 +40,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // threading primitive
+
 #if __cplusplus > 201703L
 #include <bits/atomic_base.h>
 #if __cpp_lib_atomic_wait && __cpp_aligned_new
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index 533320ea085..64d0584a55d 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // for error codes
+
 // As an extension we support <charconv> in C++14, but this header should not
 // be included by any other library headers in C++14 mode. This ensures that
 // the names defined in this header are not added to namespace std unless a
@@ -44,7 +46,7 @@
 #include <ext/numeric_traits.h>
 
 #if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \
-    && __SIZE_WIDTH__ >= 32
+    && __SIZE_WIDTH__ >= 32 && _GLIBCXX_HOSTED
 # define __cpp_lib_to_chars 201611L
 #endif
 
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 3732a40962a..c0c3a679609 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // for <ctime> and clocks
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index 06c4ff9ebdd..b885e1baa1b 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // threading primitive
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index abdc2e04cdd..0b692f165bc 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -57,6 +57,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers are hosted only
+
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
 #include <bits/stl_construct.h>
diff --git a/libstdc++-v3/include/std/execution b/libstdc++-v3/include/std/execution
index e933a1a3655..17f62a278b9 100644
--- a/libstdc++-v3/include/std/execution
+++ b/libstdc++-v3/include/std/execution
@@ -27,6 +27,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // execution policies are hosted only
+
 #if __cplusplus >= 201703L
 # include <bits/c++config.h>
 # include <pstl/glue_execution_defs.h>
diff --git a/libstdc++-v3/include/std/filesystem b/libstdc++-v3/include/std/filesystem
index dd112a254ad..36d71dd38f5 100644
--- a/libstdc++-v3/include/std/filesystem
+++ b/libstdc++-v3/include/std/filesystem
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h>
+
 #if __cplusplus >= 201703L
 
 /**
diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list
index fe99e5ed5ef..5d8052cb758 100644
--- a/libstdc++-v3/include/std/forward_list
+++ b/libstdc++-v3/include/std/forward_list
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream
index e62a1ade3c2..c43466451dd 100644
--- a/libstdc++-v3/include/std/fstream
+++ b/libstdc++-v3/include/std/fstream
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <istream>
 #include <ostream>
 #include <bits/codecvt.h>
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 5235ef20332..adf9cb1c546 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1105,7 +1105,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
   // Searchers
-#define __cpp_lib_boyer_moore_searcher 201603L
 
   template<typename _ForwardIterator1, typename _BinaryPredicate = equal_to<>>
     class default_searcher
@@ -1138,6 +1137,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
 #if _GLIBCXX_HOSTED
+#define __cpp_lib_boyer_moore_searcher 201603L
+
   template<typename _Key, typename _Tp, typename _Hash, typename _Pred>
     struct __boyer_moore_map_base
     {
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index cf08c155a24..8c968fef1ee 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // concurrency
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index 53716813993..f73519d2e0b 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <bits/c++config.h>
 #include <iosfwd>
 #include <bits/ios_base.h>
diff --git a/libstdc++-v3/include/std/ios b/libstdc++-v3/include/std/ios
index 50a66cd9886..c759986a4ae 100644
--- a/libstdc++-v3/include/std/ios
+++ b/libstdc++-v3/include/std/ios
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <iosfwd>
 #include <exception> 		// For ios_base::failure
 #include <bits/char_traits.h> 	// For char_traits, streamoff, streamsize, fpos
diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd
index ddf0c953856..7f156f85c02 100644
--- a/libstdc++-v3/include/std/iosfwd
+++ b/libstdc++-v3/include/std/iosfwd
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <bits/c++config.h>
 #include <bits/stringfwd.h> 	// For string forward declarations.
 #include <bits/postypes.h>
diff --git a/libstdc++-v3/include/std/iostream b/libstdc++-v3/include/std/iostream
index d705913f53c..685d29a32f4 100644
--- a/libstdc++-v3/include/std/iostream
+++ b/libstdc++-v3/include/std/iostream
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <bits/c++config.h>
 #include <ostream>
 #include <istream>
diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index 416ef556fa1..58716ce1d45 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <ios>
 #include <ostream>
 
diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator
index fb2a47c0dbb..8ee83272561 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -71,4 +71,8 @@
 # define __cpp_lib_null_iterators 201304L
 #endif
 
+#if __cplusplus >= 202002L
+#include <bits/ranges_base.h> // ranges::distance, ranges::next, ranges::prev
+#endif
+
 #endif /* _GLIBCXX_ITERATOR */
diff --git a/libstdc++-v3/include/std/latch b/libstdc++-v3/include/std/latch
index 7ae90228d8f..0442f095065 100644
--- a/libstdc++-v3/include/std/latch
+++ b/libstdc++-v3/include/std/latch
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // concurrency
+
 #if __cplusplus > 201703L
 
 #include <bits/atomic_base.h>
diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list
index 9151e98cb88..ec174edb976 100644
--- a/libstdc++-v3/include/std/list
+++ b/libstdc++-v3/include/std/list
@@ -57,6 +57,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
 #include <bits/range_access.h>
diff --git a/libstdc++-v3/include/std/locale b/libstdc++-v3/include/std/locale
index ae83586d668..abfed052979 100644
--- a/libstdc++-v3/include/std/locale
+++ b/libstdc++-v3/include/std/locale
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // locales
+
 #include <bits/localefwd.h>
 #include <bits/locale_classes.h>
 #include <bits/locale_facets.h>
diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map
index ce07f29ee09..c973a8e6eca 100644
--- a/libstdc++-v3/include/std/map
+++ b/libstdc++-v3/include/std/map
@@ -57,6 +57,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #include <bits/stl_tree.h>
 #include <bits/stl_map.h>
 #include <bits/stl_multimap.h>
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 3eff12108f1..4336724c928 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -63,10 +63,10 @@
 #include <bits/memoryfwd.h>
 #if _GLIBCXX_HOSTED
 # include <bits/allocator.h>
+# include <bits/stl_tempbuf.h>
 #endif
 #include <bits/stl_construct.h>
 #include <bits/stl_uninitialized.h>
-#include <bits/stl_tempbuf.h>
 #include <bits/stl_raw_storage_iter.h>
 
 #if __cplusplus >= 201103L
diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource
index 19c922516d5..323956eb7bf 100644
--- a/libstdc++-v3/include/std/memory_resource
+++ b/libstdc++-v3/include/std/memory_resource
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // polymorphic allocation
+
 #if __cplusplus >= 201703L
 
 #include <bits/memory_resource.h>
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index b9590bbf276..b310c15687d 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // concurrency
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric
index 60a99d18ffd..0f1f26cd0c4 100644
--- a/libstdc++-v3/include/std/numeric
+++ b/libstdc++-v3/include/std/numeric
@@ -729,7 +729,7 @@ namespace __detail
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
-#if __cplusplus >= 201703L
+#if __cplusplus >= 201703L && _GLIBCXX_HOSTED
 // Parallel STL algorithms
 # if _PSTL_EXECUTION_POLICIES_DEFINED
 // If <execution> has already been included, pull in implementations
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 291ea40b355..674decf73cf 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <ios>
 #include <bits/ostream_insert.h>
 
diff --git a/libstdc++-v3/include/std/queue b/libstdc++-v3/include/std/queue
index db81ef1e6c7..7c4952ff281 100644
--- a/libstdc++-v3/include/std/queue
+++ b/libstdc++-v3/include/std/queue
@@ -57,6 +57,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #include <deque>
 #include <vector>
 #include <bits/stl_heap.h>
diff --git a/libstdc++-v3/include/std/random b/libstdc++-v3/include/std/random
index 89a2f16c921..66757f78be3 100644
--- a/libstdc++-v3/include/std/random
+++ b/libstdc++-v3/include/std/random
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // OS-dependent random
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex
index 491bced23b5..aa50c7e1165 100644
--- a/libstdc++-v3/include/std/regex
+++ b/libstdc++-v3/include/std/regex
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // string and container heavy
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/semaphore b/libstdc++-v3/include/std/semaphore
index 8a31c6d1f70..72d68dd33a1 100644
--- a/libstdc++-v3/include/std/semaphore
+++ b/libstdc++-v3/include/std/semaphore
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // concurrency
+
 #if __cplusplus > 201703L
 #include <bits/semaphore_base.h>
 
diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set
index 551c77727f1..4cbcba1dc2f 100644
--- a/libstdc++-v3/include/std/set
+++ b/libstdc++-v3/include/std/set
@@ -57,6 +57,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #include <bits/stl_tree.h>
 #include <bits/stl_set.h>
 #include <bits/stl_multiset.h>
diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index 817a9587d87..cf74b32f185 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // concurrency
+
 #if __cplusplus >= 201402L
 
 #include <bits/chrono.h>
diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream
index 5855b286efe..6abf013d41b 100644
--- a/libstdc++-v3/include/std/spanstream
+++ b/libstdc++-v3/include/std/spanstream
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #if __cplusplus > 202002L
 #include <span>
 #include <streambuf>
diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index bc7d636e702..7305bdbecf4 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostream
+
 #include <istream>
 #include <ostream>
 #include <bits/alloc_traits.h> // allocator_traits, __allocator_like
diff --git a/libstdc++-v3/include/std/stack b/libstdc++-v3/include/std/stack
index fc14e2edc2e..98d21236dc1 100644
--- a/libstdc++-v3/include/std/stack
+++ b/libstdc++-v3/include/std/stack
@@ -57,6 +57,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #include <deque>
 #include <bits/stl_stack.h>
 
diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace
index 39472d7236a..e7cbbee5638 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -26,6 +26,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // std::string bound
+
 #include <bits/c++config.h>
 
 #if __cplusplus > 202002L && _GLIBCXX_HAVE_STACKTRACE
diff --git a/libstdc++-v3/include/std/stop_token b/libstdc++-v3/include/std/stop_token
index 07d4fdafeb4..f1968343a1e 100644
--- a/libstdc++-v3/include/std/stop_token
+++ b/libstdc++-v3/include/std/stop_token
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_STOP_TOKEN
 #define _GLIBCXX_STOP_TOKEN
 
+#include <bits/requires_hosted.h> // concurrency
+
 #if __cplusplus > 201703L
 
 #include <atomic>
diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf
index 888611d12aa..d8893df580f 100644
--- a/libstdc++-v3/include/std/streambuf
+++ b/libstdc++-v3/include/std/streambuf
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <bits/c++config.h>
 #include <iosfwd>
 #include <bits/localefwd.h>
diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string
index 62ecdb3af45..41e6e2cb92b 100644
--- a/libstdc++-v3/include/std/string
+++ b/libstdc++-v3/include/std/string
@@ -35,6 +35,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #include <bits/c++config.h>
 #include <bits/stringfwd.h>
 #include <bits/char_traits.h>
diff --git a/libstdc++-v3/include/std/syncstream b/libstdc++-v3/include/std/syncstream
index 7a4f731ddd9..838cec591b7 100644
--- a/libstdc++-v3/include/std/syncstream
+++ b/libstdc++-v3/include/std/syncstream
@@ -38,6 +38,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // iostreams
+
 #include <sstream>
 
 #include <bits/alloc_traits.h>
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index e12bb2f0e1e..6dad75d26bc 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // OS-dependent
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 82f191afe2d..a314b9eb9bf 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // concurrency
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map
index b50ec2a8de2..323edcd722d 100644
--- a/libstdc++-v3/include/std/unordered_map
+++ b/libstdc++-v3/include/std/unordered_map
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // container
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set
index edaa517635b..998417f5d14 100644
--- a/libstdc++-v3/include/std/unordered_set
+++ b/libstdc++-v3/include/std/unordered_set
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // containers
+
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
 #else
diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray
index 87fec2b6df3..90bbed77696 100644
--- a/libstdc++-v3/include/std/valarray
+++ b/libstdc++-v3/include/std/valarray
@@ -33,6 +33,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // <cmath> dependant
+
 #include <bits/c++config.h>
 #include <cmath>
 #include <algorithm>
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index d7f69fd7a48..75377d5c7cc 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -57,6 +57,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // container
+
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
 #include <bits/stl_construct.h>
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 3fd5182d51d..397a4aa7b0a 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -46,11 +46,11 @@
 
 #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
-# define __cpp_lib_allocator_traits_is_always_equal 201411L
 #if __cplusplus <= 201703L // N.B. updated value in C++20
 # define __cpp_lib_shared_ptr_arrays 201611L
 #endif
@@ -73,35 +73,38 @@
 #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_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_HOSTED
 # define __cpp_lib_chrono_udls 201304L
 # define __cpp_lib_complex_udls 201309L
-# define __cpp_lib_exchange_function 201304L
 # define __cpp_lib_generic_associative_lookup 201304L
-# define __cpp_lib_integer_sequence 201304L
-# define __cpp_lib_make_reverse_iterator 201402L
 # define __cpp_lib_make_unique 201304L
-# ifndef _GLIBCXX_DEBUG // PR libstdc++/70303
-#  define __cpp_lib_null_iterators 201304L
-# endif
 # define __cpp_lib_quoted_string_io 201304L
 # define __cpp_lib_robust_nonmodifying_seq_ops 201304L
 # ifdef _GLIBCXX_HAS_GTHREADS
 #  define __cpp_lib_shared_timed_mutex 201402L
 # endif
 # define __cpp_lib_string_udls 201304L
-# define __cpp_lib_transparent_operators 201510L
-# define __cpp_lib_tuple_element_t 201402L
-# define __cpp_lib_tuples_by_type 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
@@ -111,6 +114,7 @@
 #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
@@ -120,17 +124,23 @@
 # define __cpp_lib_launder 201606L
 #endif
 #define __cpp_lib_logical_traits 201510L
+#define __cpp_lib_make_from_tuple 201606L
+#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_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 _GLIBCXX_HOSTED
-#define __cpp_lib_any 201606L
-#define __cpp_lib_apply 201603L
 #if __cplusplus == 201703L // N.B. updated value in C++20
 # define __cpp_lib_array_constexpr 201803L
 #endif
-#define __cpp_lib_as_const 201510L
 #define __cpp_lib_boyer_moore_searcher 201603L
 #define __cpp_lib_chrono 201611L
 #define __cpp_lib_clamp 201603L
@@ -146,9 +156,7 @@
 #define __cpp_lib_gcd 201606L
 #define __cpp_lib_gcd_lcm 201606L
 #define __cpp_lib_hypot 201603L
-#define __cpp_lib_invoke 201411L
 #define __cpp_lib_lcm 201606L
-#define __cpp_lib_make_from_tuple 201606L
 #define __cpp_lib_map_try_emplace 201411L
 #define __cpp_lib_math_special_functions 201603L
 #ifdef _GLIBCXX_HAS_GTHREADS
@@ -158,10 +166,6 @@
 #endif
 #define __cpp_lib_node_extract 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_parallel_algorithm 201603L
 #define __cpp_lib_raw_memory_algorithms 201606L
 #define __cpp_lib_sample 201603L
@@ -176,18 +180,16 @@
 # define __cpp_lib_to_chars 201611L
 #endif
 #define __cpp_lib_unordered_map_try_emplace 201411L
-#if !(__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L)
-// N.B. updated value in C++20
-# define __cpp_lib_variant 202102L
-#endif
 #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_ref 201806L
 #define __cpp_lib_atomic_value_initialization 201911L
+#define __cpp_lib_bind_front 201907L
 #if __has_builtin(__builtin_bit_cast)
 # define __cpp_lib_bit_cast 201806L
 #endif
@@ -202,6 +204,7 @@
 #endif
 #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
@@ -214,19 +217,32 @@
  && __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
+#define __cpp_lib_optional 202106L
 #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
 
 #if _GLIBCXX_HOSTED
 #define __cpp_lib_array_constexpr 201811L
-#define __cpp_lib_assume_aligned 201811L
 #define __cpp_lib_atomic_shared_ptr 201711L
 #if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
 # define __cpp_lib_atomic_wait 201907L
@@ -234,9 +250,7 @@
 #  define __cpp_lib_barrier 201907L
 # endif
 #endif
-#define __cpp_lib_bind_front 201907L
 // FIXME: #define __cpp_lib_execution 201902L
-#define __cpp_lib_integer_comparison_functions 202002L
 #define __cpp_lib_constexpr_algorithms 201806L
 #ifdef __cpp_lib_is_constant_evaluated
 # define __cpp_lib_constexpr_char_traits 201811L
@@ -268,11 +282,6 @@
 # define __cpp_lib_latch 201907L
 #endif
 #define __cpp_lib_list_remove_return_type 201806L
-#if __cpp_lib_concepts
-# define __cpp_lib_make_obj_using_allocator 201811L
-#endif
-#define __cpp_lib_math_constants 201907L
-#define __cpp_lib_optional 202106L
 #define __cpp_lib_polymorphic_allocator 201902L
 #if __cpp_lib_concepts
 # define __cpp_lib_ranges 202110L
@@ -283,28 +292,29 @@
 #define __cpp_lib_shared_ptr_arrays 201707L
 #define __cpp_lib_shift 201806L
 #define __cpp_lib_smart_ptr_for_overwrite 202002L
-#if __cpp_lib_concepts
-# define __cpp_lib_span 202002L
-#endif
-#define __cpp_lib_ssize 201902L
 #define __cpp_lib_starts_ends_with 201711L
 # if _GLIBCXX_USE_CXX11_ABI
 // Only supported with cxx11-abi
 #  define __cpp_lib_syncbuf 201803L
 # endif
-#define __cpp_lib_to_address 201711L
-#define __cpp_lib_to_array 201907L
-#if __cpp_concepts >= 202002L && __cpp_constexpr >= 201811L
-# define __cpp_lib_variant 202106L
-#endif
 #endif
 
 #if __cplusplus > 202002L
 // c++23
 #define __cpp_lib_byteswap 202110L
 #define __cpp_lib_constexpr_typeinfo 202106L
+#if __cpp_concepts >= 202002L
+# define __cpp_lib_expected 202202L
+#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
 
 #if _GLIBCXX_HOSTED
 #define __cpp_lib_adaptor_iterator_pair_constructor 202106L
@@ -313,15 +323,7 @@
 # undef __cpp_lib_constexpr_memory
 # define __cpp_lib_constexpr_memory 202202L
 #endif
-#if __cpp_concepts >= 202002L
-# define __cpp_lib_expected 202202L
-#endif
-#define __cpp_lib_invoke_r 202106L
 #define __cpp_lib_ios_noreplace 202207L
-#if __cpp_lib_concepts
-# undef __cpp_lib_optional
-# define __cpp_lib_optional 202110L
-#endif
 #define __cpp_lib_move_only_function 202110L
 #if __cpp_lib_span
 # define __cpp_lib_spanstream 202106L
@@ -334,8 +336,6 @@
 #if _GLIBCXX_USE_CXX11_ABI // Only supported with cxx11-abi
 # define __cpp_lib_string_resize_and_overwrite 202110L
 #endif
-#define __cpp_lib_to_underlying 202102L
-#define __cpp_lib_unreachable 202202L
 #endif
 #endif // C++23
 #endif // C++20
diff --git a/libstdc++-v3/include/tr1/array b/libstdc++-v3/include/tr1/array
index 2aac0ed8106..f03ad810f60 100644
--- a/libstdc++-v3/include/tr1/array
+++ b/libstdc++-v3/include/tr1/array
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <bits/stl_algobase.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/tr1/ccomplex b/libstdc++-v3/include/tr1/ccomplex
index 8f9546e24df..1b632be1aad 100644
--- a/libstdc++-v3/include/tr1/ccomplex
+++ b/libstdc++-v3/include/tr1/ccomplex
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_CCOMPLEX
 #define _GLIBCXX_TR1_CCOMPLEX 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/complex>
 
 #endif // _GLIBCXX_TR1_CCOMPLEX
diff --git a/libstdc++-v3/include/tr1/cctype b/libstdc++-v3/include/tr1/cctype
index 43520c7a2c1..2c4a15b4edc 100644
--- a/libstdc++-v3/include/tr1/cctype
+++ b/libstdc++-v3/include/tr1/cctype
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_CCTYPE
 #define _GLIBCXX_TR1_CCTYPE 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <bits/c++config.h>
 #include <cctype>
 
diff --git a/libstdc++-v3/include/tr1/cfenv b/libstdc++-v3/include/tr1/cfenv
index 202fe27229c..37e06c641b9 100644
--- a/libstdc++-v3/include/tr1/cfenv
+++ b/libstdc++-v3/include/tr1/cfenv
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <bits/c++config.h>
 
 #if _GLIBCXX_HAVE_FENV_H
diff --git a/libstdc++-v3/include/tr1/cfloat b/libstdc++-v3/include/tr1/cfloat
index 24565138b91..76bfcfb4e6c 100644
--- a/libstdc++-v3/include/tr1/cfloat
+++ b/libstdc++-v3/include/tr1/cfloat
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_CFLOAT
 #define _GLIBCXX_TR1_CFLOAT 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cfloat>
 
 #ifndef DECIMAL_DIG
diff --git a/libstdc++-v3/include/tr1/cinttypes b/libstdc++-v3/include/tr1/cinttypes
index a04cf24720f..24b46482771 100644
--- a/libstdc++-v3/include/tr1/cinttypes
+++ b/libstdc++-v3/include/tr1/cinttypes
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cstdint>
 
 // For 8.11.1/1 (see C99, Note 184)
diff --git a/libstdc++-v3/include/tr1/climits b/libstdc++-v3/include/tr1/climits
index 95e3bc3b4da..0d702dcdaec 100644
--- a/libstdc++-v3/include/tr1/climits
+++ b/libstdc++-v3/include/tr1/climits
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_CLIMITS
 #define _GLIBCXX_TR1_CLIMITS 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <climits>
 
 #ifndef LLONG_MIN
diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath
index f3a53f3c5b2..384f1169524 100644
--- a/libstdc++-v3/include/tr1/cmath
+++ b/libstdc++-v3/include/tr1/cmath
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cmath>
 
 #ifdef _GLIBCXX_USE_C99_MATH_TR1
diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex
index abb5e13fe23..fa88cd5017c 100644
--- a/libstdc++-v3/include/tr1/complex
+++ b/libstdc++-v3/include/tr1/complex
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <complex>
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/tr1/complex.h b/libstdc++-v3/include/tr1/complex.h
index f2824784f60..c5fb4c103d7 100644
--- a/libstdc++-v3/include/tr1/complex.h
+++ b/libstdc++-v3/include/tr1/complex.h
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_COMPLEX_H
 #define _GLIBCXX_TR1_COMPLEX_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/ccomplex>
 
 #endif // _GLIBCXX_TR1_COMPLEX_H
diff --git a/libstdc++-v3/include/tr1/cstdarg b/libstdc++-v3/include/tr1/cstdarg
index f28ff2a602d..f046e816251 100644
--- a/libstdc++-v3/include/tr1/cstdarg
+++ b/libstdc++-v3/include/tr1/cstdarg
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_CSTDARG
 #define _GLIBCXX_TR1_CSTDARG 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cstdarg>
 
 #endif // _GLIBCXX_TR1_CSTDARG
diff --git a/libstdc++-v3/include/tr1/cstdbool b/libstdc++-v3/include/tr1/cstdbool
index 77c03156248..20afb63be52 100644
--- a/libstdc++-v3/include/tr1/cstdbool
+++ b/libstdc++-v3/include/tr1/cstdbool
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <bits/c++config.h>
 
 #if _GLIBCXX_HAVE_STDBOOL_H
diff --git a/libstdc++-v3/include/tr1/cstdint b/libstdc++-v3/include/tr1/cstdint
index 0d13b30daa4..9e3e45c76aa 100644
--- a/libstdc++-v3/include/tr1/cstdint
+++ b/libstdc++-v3/include/tr1/cstdint
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <bits/c++config.h>
 
 // For 8.22.1/1 (see C99, Notes 219, 220, 222)
diff --git a/libstdc++-v3/include/tr1/cstdio b/libstdc++-v3/include/tr1/cstdio
index 4692d213d4d..dcbff6a0eb4 100644
--- a/libstdc++-v3/include/tr1/cstdio
+++ b/libstdc++-v3/include/tr1/cstdio
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cstdio>
 
 #if _GLIBCXX_USE_C99_STDIO
diff --git a/libstdc++-v3/include/tr1/cstdlib b/libstdc++-v3/include/tr1/cstdlib
index de952bb1619..5569b0dca65 100644
--- a/libstdc++-v3/include/tr1/cstdlib
+++ b/libstdc++-v3/include/tr1/cstdlib
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cstdlib>
 
 #if _GLIBCXX_HOSTED
diff --git a/libstdc++-v3/include/tr1/ctgmath b/libstdc++-v3/include/tr1/ctgmath
index 64ef40544e7..15ada9c9255 100644
--- a/libstdc++-v3/include/tr1/ctgmath
+++ b/libstdc++-v3/include/tr1/ctgmath
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_CTGMATH
 #define _GLIBCXX_TR1_CTGMATH 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cmath>
 
 #endif // _GLIBCXX_TR1_CTGMATH
diff --git a/libstdc++-v3/include/tr1/ctime b/libstdc++-v3/include/tr1/ctime
index 8b9b8699b73..99b529a0f50 100644
--- a/libstdc++-v3/include/tr1/ctime
+++ b/libstdc++-v3/include/tr1/ctime
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_CTIME
 #define _GLIBCXX_TR1_CTIME 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <ctime>
 
 #endif // _GLIBCXX_TR1_CTIME
diff --git a/libstdc++-v3/include/tr1/ctype.h b/libstdc++-v3/include/tr1/ctype.h
index 91177ff7d7c..014fc2b0a53 100644
--- a/libstdc++-v3/include/tr1/ctype.h
+++ b/libstdc++-v3/include/tr1/ctype.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_CTYPE_H
 #define _TR1_CTYPE_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cctype>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/cwchar b/libstdc++-v3/include/tr1/cwchar
index 23219bc2d6b..1140edaa965 100644
--- a/libstdc++-v3/include/tr1/cwchar
+++ b/libstdc++-v3/include/tr1/cwchar
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cwchar>
 
 #ifdef _GLIBCXX_USE_WCHAR_T
diff --git a/libstdc++-v3/include/tr1/cwctype b/libstdc++-v3/include/tr1/cwctype
index 1a71dd05d26..ddb25af4cfc 100644
--- a/libstdc++-v3/include/tr1/cwctype
+++ b/libstdc++-v3/include/tr1/cwctype
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cwctype>
 
 #ifdef _GLIBCXX_USE_WCHAR_T
diff --git a/libstdc++-v3/include/tr1/fenv.h b/libstdc++-v3/include/tr1/fenv.h
index 091b0b8a83d..2547f003fdb 100644
--- a/libstdc++-v3/include/tr1/fenv.h
+++ b/libstdc++-v3/include/tr1/fenv.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_FENV_H
 #define _TR1_FENV_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cfenv>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/float.h b/libstdc++-v3/include/tr1/float.h
index 23670789d68..1dd3ef13f40 100644
--- a/libstdc++-v3/include/tr1/float.h
+++ b/libstdc++-v3/include/tr1/float.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_FLOAT_H
 #define _TR1_FLOAT_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cfloat>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index 83d22bed9e5..ae219ab9678 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <functional> // for std::_Placeholder, std::_Bind, std::_Bind_result
 
 #include <typeinfo>
diff --git a/libstdc++-v3/include/tr1/inttypes.h b/libstdc++-v3/include/tr1/inttypes.h
index 22a75144bb8..eb5ddbe5123 100644
--- a/libstdc++-v3/include/tr1/inttypes.h
+++ b/libstdc++-v3/include/tr1/inttypes.h
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_INTTYPES_H
 #define _GLIBCXX_TR1_INTTYPES_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cinttypes>
 
 #endif // _GLIBCXX_TR1_INTTYPES_H
diff --git a/libstdc++-v3/include/tr1/limits.h b/libstdc++-v3/include/tr1/limits.h
index b54f9d2ed0f..73baf85cc94 100644
--- a/libstdc++-v3/include/tr1/limits.h
+++ b/libstdc++-v3/include/tr1/limits.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_LIMITS_H
 #define _TR1_LIMITS_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/climits>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/math.h b/libstdc++-v3/include/tr1/math.h
index 423b5ea0ad7..99c8f45b523 100644
--- a/libstdc++-v3/include/tr1/math.h
+++ b/libstdc++-v3/include/tr1/math.h
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_MATH_H
 #define _GLIBCXX_TR1_MATH_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cmath>
 
 #if _GLIBCXX_USE_C99_MATH_TR1
diff --git a/libstdc++-v3/include/tr1/memory b/libstdc++-v3/include/tr1/memory
index b50a5588a40..759000b2b93 100644
--- a/libstdc++-v3/include/tr1/memory
+++ b/libstdc++-v3/include/tr1/memory
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #if defined(_GLIBCXX_INCLUDE_AS_CXX11)
 #  error TR1 header cannot be included from C++11 header
 #endif
diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random
index cb5754082e2..f9fbd4d625a 100644
--- a/libstdc++-v3/include/tr1/random
+++ b/libstdc++-v3/include/tr1/random
@@ -32,6 +32,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <cmath>
 #include <cstdio>
 #include <cstdlib>
diff --git a/libstdc++-v3/include/tr1/regex b/libstdc++-v3/include/tr1/regex
index 10db3725723..bcdea9d7881 100644
--- a/libstdc++-v3/include/tr1/regex
+++ b/libstdc++-v3/include/tr1/regex
@@ -33,6 +33,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <algorithm>
 #include <bitset>
 #include <iterator>
diff --git a/libstdc++-v3/include/tr1/stdarg.h b/libstdc++-v3/include/tr1/stdarg.h
index 446dda16b1a..4622f3338be 100644
--- a/libstdc++-v3/include/tr1/stdarg.h
+++ b/libstdc++-v3/include/tr1/stdarg.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_STDARG_H
 #define _TR1_STDARG_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cstdarg>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/stdbool.h b/libstdc++-v3/include/tr1/stdbool.h
index 76d0b729e79..368e891dd3c 100644
--- a/libstdc++-v3/include/tr1/stdbool.h
+++ b/libstdc++-v3/include/tr1/stdbool.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_STDBOOL_H
 #define _TR1_STDBOOL_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cstdbool>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/stdint.h b/libstdc++-v3/include/tr1/stdint.h
index 59c1d958fdb..b19361b3053 100644
--- a/libstdc++-v3/include/tr1/stdint.h
+++ b/libstdc++-v3/include/tr1/stdint.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_STDINT_H
 #define _TR1_STDINT_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cstdint>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/stdio.h b/libstdc++-v3/include/tr1/stdio.h
index f7cc5c7ebe7..3ef65f9044b 100644
--- a/libstdc++-v3/include/tr1/stdio.h
+++ b/libstdc++-v3/include/tr1/stdio.h
@@ -29,6 +29,8 @@
 #ifndef _TR1_STDIO_H
 #define _TR1_STDIO_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cstdio>
 
 #endif
diff --git a/libstdc++-v3/include/tr1/stdlib.h b/libstdc++-v3/include/tr1/stdlib.h
index 0e9c605cce8..0963136ba3d 100644
--- a/libstdc++-v3/include/tr1/stdlib.h
+++ b/libstdc++-v3/include/tr1/stdlib.h
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_STDLIB_H
 #define _GLIBCXX_TR1_STDLIB_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cstdlib>
 
 #if _GLIBCXX_HOSTED
diff --git a/libstdc++-v3/include/tr1/tgmath.h b/libstdc++-v3/include/tr1/tgmath.h
index 3871c3c93e5..a3505c9b099 100644
--- a/libstdc++-v3/include/tr1/tgmath.h
+++ b/libstdc++-v3/include/tr1/tgmath.h
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_TGMATH_H
 #define _GLIBCXX_TR1_TGMATH_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/ctgmath>
 
 #endif // _GLIBCXX_TR1_TGMATH_H
diff --git a/libstdc++-v3/include/tr1/tuple b/libstdc++-v3/include/tr1/tuple
index 94b1c0de532..a24da25df73 100644
--- a/libstdc++-v3/include/tr1/tuple
+++ b/libstdc++-v3/include/tr1/tuple
@@ -34,6 +34,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <utility>
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index 2ee3b06e450..305a0d03de2 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <bits/c++config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/tr1/unordered_map b/libstdc++-v3/include/tr1/unordered_map
index edec4e2d379..24d38920021 100644
--- a/libstdc++-v3/include/tr1/unordered_map
+++ b/libstdc++-v3/include/tr1/unordered_map
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <utility>
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
diff --git a/libstdc++-v3/include/tr1/unordered_set b/libstdc++-v3/include/tr1/unordered_set
index fa11b167847..59f0ab92734 100644
--- a/libstdc++-v3/include/tr1/unordered_set
+++ b/libstdc++-v3/include/tr1/unordered_set
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <utility>
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
diff --git a/libstdc++-v3/include/tr1/utility b/libstdc++-v3/include/tr1/utility
index e6e3bbd42fa..cc2699d8a91 100644
--- a/libstdc++-v3/include/tr1/utility
+++ b/libstdc++-v3/include/tr1/utility
@@ -31,6 +31,8 @@
 
 #pragma GCC system_header
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <bits/c++config.h>
 #include <bits/stl_relops.h>
 #include <bits/stl_pair.h>
diff --git a/libstdc++-v3/include/tr1/wchar.h b/libstdc++-v3/include/tr1/wchar.h
index 503ca203961..0812c07ef11 100644
--- a/libstdc++-v3/include/tr1/wchar.h
+++ b/libstdc++-v3/include/tr1/wchar.h
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_WCHAR_H
 #define _GLIBCXX_TR1_WCHAR_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cwchar>
 
 #endif // _GLIBCXX_TR1_WCHAR_H
diff --git a/libstdc++-v3/include/tr1/wctype.h b/libstdc++-v3/include/tr1/wctype.h
index fa0e4581a7c..84fd7cc5045 100644
--- a/libstdc++-v3/include/tr1/wctype.h
+++ b/libstdc++-v3/include/tr1/wctype.h
@@ -29,6 +29,8 @@
 #ifndef _GLIBCXX_TR1_WCTYPE_H
 #define _GLIBCXX_TR1_WCTYPE_H 1
 
+#include <bits/requires_hosted.h> // TR1
+
 #include <tr1/cwctype>
 
 #endif // _GLIBCXX_TR1_WCTYPE_H
diff --git a/libstdc++-v3/testsuite/lib/prune.exp b/libstdc++-v3/testsuite/lib/prune.exp
index 70ff302288e..d457e975218 100644
--- a/libstdc++-v3/testsuite/lib/prune.exp
+++ b/libstdc++-v3/testsuite/lib/prune.exp
@@ -33,6 +33,10 @@ proc libstdc++-dg-prune { system text } {
 
 #    send_user "Before:$text\n"
 
+    if { [string match "*This header is not available in freestanding mode.*" $text] } {
+      return "::unsupported::hosted C++ headers not supported"
+    }
+
     # Ignore caret diagnostics. Unfortunately dejaGNU trims leading
     # spaces, so one cannot rely on them being present.
     regsub -all "(^|\n)\[^\n\]+\n *\\^\n" $text "\n" text
-- 
2.37.3


  parent reply	other threads:[~2022-09-30 16:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 16:45 [PATCH 00/10] c-family,libstdc++: P1642 and related changes Arsen Arsenović
2022-09-30 16:45 ` [PATCH 01/10] libstdc++: Make _GLIBCXX_HOSTED respect -ffreestanding [PR103626] Arsen Arsenović
2022-09-30 16:45 ` [PATCH 02/10] libstdc++: Filter out unconditional <stdio.h> default include Arsen Arsenović
2022-09-30 16:45 ` [PATCH 03/10] libstdc++: Adjust precompiled headers for freestanding Arsen Arsenović
2022-09-30 16:45 ` Arsen Arsenović [this message]
2022-09-30 16:45 ` [PATCH 05/10] c-family: Implement new `int main' semantics in freestanding Arsen Arsenović
2022-09-30 16:45 ` [PATCH 06/10] libstdc++: Rework how freestanding install works [PR106953] Arsen Arsenović
2022-09-30 16:45 ` [PATCH 07/10] libstdc++: Make some tests work on freestanding [PR103626] Arsen Arsenović
2022-09-30 16:45 ` [PATCH 08/10] libstdc++: Add effective-target 'hosted' for testsuite [PR103626] Arsen Arsenović
2022-09-30 16:45 ` [PATCH 09/10] libstdc++: Re-enable std::hash<std::bitset> in freestanding [PR103626] Arsen Arsenović
2022-09-30 16:45 ` [PATCH 10/10] libstdc++: Disable hosted-only tests [PR103626] Arsen Arsenović
2022-09-30 18:15 ` [PATCH 00/10] c-family,libstdc++: P1642 and related changes Jonathan Wakely
2022-10-03 14:49   ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220930164556.1198044-5-arsen@aarsen.me \
    --to=arsen@aarsen.me \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).