[libcxx-commits] [libcxx] [libcxxabi] [libc++] Granularize <cstddef> includes (PR #108696)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Oct 10 04:46:16 PDT 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/108696
>From 361262e685a1d91abe11a1c81331b8f84d613b9a Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sat, 14 Sep 2024 14:45:17 +0200
Subject: [PATCH] [libc++] Granularize <cstddef> includes
---
libcxx/include/__algorithm/copy_move_common.h | 2 +-
libcxx/include/__algorithm/inplace_merge.h | 1 +
libcxx/include/__algorithm/mismatch.h | 2 +-
libcxx/include/__algorithm/shuffle.h | 2 +-
libcxx/include/__algorithm/simd_utils.h | 2 +-
libcxx/include/__algorithm/stable_partition.h | 1 +
libcxx/include/__algorithm/stable_sort.h | 1 +
libcxx/include/__atomic/aliases.h | 3 +-
libcxx/include/__atomic/atomic.h | 2 +-
libcxx/include/__atomic/atomic_ref.h | 3 +-
libcxx/include/__atomic/cxx_atomic_impl.h | 3 +-
libcxx/include/__charconv/to_chars_integral.h | 2 +-
.../__compare/common_comparison_category.h | 2 +-
libcxx/include/__concepts/swappable.h | 2 +-
libcxx/include/__coroutine/coroutine_handle.h | 3 +-
libcxx/include/__exception/exception_ptr.h | 1 -
libcxx/include/__exception/nested_exception.h | 1 -
libcxx/include/__exception/operations.h | 1 -
.../include/__filesystem/directory_iterator.h | 1 -
libcxx/include/__filesystem/path.h | 1 -
libcxx/include/__filesystem/path_iterator.h | 3 -
.../recursive_directory_iterator.h | 1 -
libcxx/include/__format/buffer.h | 1 -
.../include/__format/escaped_output_table.h | 2 +-
.../extended_grapheme_cluster_table.h | 2 +-
libcxx/include/__format/format_arg.h | 1 +
libcxx/include/__format/format_args.h | 2 +-
libcxx/include/__format/format_context.h | 1 -
libcxx/include/__format/format_string.h | 2 +-
.../__format/formatter_floating_point.h | 1 -
libcxx/include/__format/formatter_output.h | 3 +-
libcxx/include/__format/formatter_pointer.h | 2 +-
.../__format/indic_conjunct_break_table.h | 2 +-
.../include/__format/width_estimation_table.h | 2 +-
libcxx/include/__functional/bind.h | 1 -
libcxx/include/__functional/hash.h | 1 -
libcxx/include/__hash_table | 1 +
libcxx/include/__iterator/access.h | 2 +-
libcxx/include/__iterator/aliasing_iterator.h | 2 +-
.../include/__iterator/back_insert_iterator.h | 2 +-
libcxx/include/__iterator/data.h | 1 -
libcxx/include/__iterator/empty.h | 1 -
.../__iterator/front_insert_iterator.h | 2 +-
.../include/__iterator/incrementable_traits.h | 2 +-
libcxx/include/__iterator/insert_iterator.h | 2 +-
libcxx/include/__iterator/istream_iterator.h | 2 +-
.../include/__iterator/istreambuf_iterator.h | 2 +
libcxx/include/__iterator/iterator.h | 2 +-
libcxx/include/__iterator/iterator_traits.h | 2 +-
libcxx/include/__iterator/ostream_iterator.h | 2 +-
.../include/__iterator/ostreambuf_iterator.h | 2 +-
libcxx/include/__iterator/reverse_access.h | 1 -
.../include/__iterator/segmented_iterator.h | 2 +-
libcxx/include/__iterator/size.h | 3 +-
libcxx/include/__iterator/wrap_iter.h | 2 +-
libcxx/include/__mdspan/default_accessor.h | 3 +-
libcxx/include/__mdspan/extents.h | 3 +-
libcxx/include/__mdspan/layout_left.h | 3 -
libcxx/include/__mdspan/layout_right.h | 4 +-
libcxx/include/__mdspan/layout_stride.h | 2 -
libcxx/include/__mdspan/mdspan.h | 3 -
libcxx/include/__memory/align.h | 2 +-
libcxx/include/__memory/aligned_alloc.h | 1 -
libcxx/include/__memory/allocate_at_least.h | 2 +-
libcxx/include/__memory/allocation_guard.h | 1 -
libcxx/include/__memory/allocator.h | 2 +-
libcxx/include/__memory/allocator_traits.h | 2 +-
libcxx/include/__memory/array_cookie.h | 2 +-
libcxx/include/__memory/assume_aligned.h | 2 +-
.../include/__memory/builtin_new_allocator.h | 1 -
libcxx/include/__memory/compressed_pair.h | 1 +
libcxx/include/__memory/destruct_n.h | 2 +-
libcxx/include/__memory/pointer_traits.h | 2 +-
.../include/__memory/raw_storage_iterator.h | 2 +-
libcxx/include/__memory/shared_ptr.h | 2 +-
libcxx/include/__memory/temporary_buffer.h | 3 +-
libcxx/include/__memory/unique_ptr.h | 3 +-
.../__memory/unique_temporary_buffer.h | 2 +-
libcxx/include/__memory/uses_allocator.h | 1 -
.../__memory_resource/memory_resource.h | 3 +-
.../monotonic_buffer_resource.h | 2 +-
.../__memory_resource/polymorphic_allocator.h | 3 +-
.../include/__memory_resource/pool_options.h | 2 +-
.../synchronized_pool_resource.h | 1 -
.../unsynchronized_pool_resource.h | 2 +-
libcxx/include/__numeric/midpoint.h | 2 +-
libcxx/include/__ostream/basic_ostream.h | 1 -
libcxx/include/__pstl/backends/libdispatch.h | 2 +-
libcxx/include/__pstl/backends/std_thread.h | 1 -
libcxx/include/__pstl/cpu_algos/cpu_traits.h | 1 -
libcxx/include/__pstl/cpu_algos/find_if.h | 1 -
.../__pstl/cpu_algos/transform_reduce.h | 1 -
.../include/__random/discard_block_engine.h | 2 +-
.../include/__random/discrete_distribution.h | 1 -
.../__random/independent_bits_engine.h | 2 +-
libcxx/include/__random/log2.h | 2 +-
.../__random/mersenne_twister_engine.h | 2 +-
.../piecewise_constant_distribution.h | 1 +
.../__random/piecewise_linear_distribution.h | 1 +
.../include/__random/shuffle_order_engine.h | 2 +-
.../__random/subtract_with_carry_engine.h | 2 +-
.../__random/uniform_int_distribution.h | 2 +-
libcxx/include/__ranges/access.h | 2 +-
libcxx/include/__ranges/counted.h | 2 +-
libcxx/include/__ranges/drop_view.h | 1 -
libcxx/include/__ranges/elements_view.h | 1 -
libcxx/include/__ranges/empty_view.h | 2 +-
libcxx/include/__ranges/istream_view.h | 2 +-
libcxx/include/__ranges/repeat_view.h | 1 +
libcxx/include/__ranges/single_view.h | 3 +-
libcxx/include/__ranges/size.h | 3 +-
libcxx/include/__ranges/subrange.h | 2 +-
libcxx/include/__ranges/take_view.h | 1 -
libcxx/include/__ranges/to.h | 2 +-
libcxx/include/__split_buffer | 2 +-
.../__stop_token/intrusive_shared_ptr.h | 2 +-
libcxx/include/__string/char_traits.h | 1 -
.../include/__string/constexpr_c_functions.h | 2 +-
libcxx/include/__system_error/error_code.h | 1 -
.../include/__system_error/error_condition.h | 1 -
libcxx/include/__utility/in_place.h | 2 +-
libcxx/include/__utility/integer_sequence.h | 2 +-
libcxx/include/__utility/pair.h | 2 +-
libcxx/include/__utility/priority_tag.h | 2 +-
libcxx/include/__utility/small_buffer.h | 2 +-
libcxx/include/__utility/swap.h | 2 +-
libcxx/include/__variant/monostate.h | 2 +-
libcxx/include/array | 1 +
libcxx/include/atomic | 1 +
libcxx/include/barrier | 2 +-
libcxx/include/bitset | 1 -
libcxx/include/charconv | 1 +
libcxx/include/compare | 1 +
libcxx/include/concepts | 5 +-
libcxx/include/coroutine | 1 +
libcxx/include/exception | 1 +
.../include/experimental/__simd/aligned_tag.h | 2 +-
.../include/experimental/__simd/declaration.h | 2 +-
.../include/experimental/__simd/reference.h | 2 +-
libcxx/include/experimental/__simd/scalar.h | 2 +-
libcxx/include/experimental/__simd/simd.h | 2 +-
.../include/experimental/__simd/simd_mask.h | 2 +-
libcxx/include/experimental/__simd/traits.h | 2 +-
libcxx/include/experimental/__simd/utility.h | 2 +-
libcxx/include/experimental/__simd/vec_ext.h | 2 +-
libcxx/include/experimental/iterator | 1 +
libcxx/include/experimental/memory | 5 +-
libcxx/include/experimental/propagate_const | 5 +-
libcxx/include/experimental/simd | 4 ++
libcxx/include/experimental/type_traits | 4 ++
libcxx/include/experimental/utility | 4 ++
libcxx/include/initializer_list | 7 ++-
libcxx/include/iterator | 1 +
libcxx/include/latch | 3 +-
libcxx/include/module.modulemap | 10 +++-
libcxx/include/mutex | 1 -
libcxx/include/new | 3 +-
libcxx/include/numbers | 1 +
libcxx/include/semaphore | 3 +-
libcxx/include/span | 3 +-
libcxx/include/stdexcept | 1 +
libcxx/include/stop_token | 1 +
libcxx/include/string_view | 3 +-
libcxx/include/tuple | 3 +-
libcxx/include/typeindex | 1 +
libcxx/include/typeinfo | 4 +-
libcxx/include/utility | 1 +
libcxx/include/valarray | 2 +-
libcxx/include/variant | 1 +
libcxx/src/memory_resource.cpp | 1 +
.../random_shuffle.cxx1z.pass.cpp | 1 +
.../copy_move_unwrap_reverse.pass.cpp | 2 +-
...using_non_transparent_comparators.pass.cpp | 1 +
.../sequences/deque/asan_turning_off.pass.cpp | 1 +
.../test/libcxx/transitive_includes/cxx03.csv | 19 ++++++
.../test/libcxx/transitive_includes/cxx11.csv | 19 ++++++
.../test/libcxx/transitive_includes/cxx14.csv | 19 ++++++
.../test/libcxx/transitive_includes/cxx17.csv | 19 ++++++
.../test/libcxx/transitive_includes/cxx20.csv | 27 +++++++++
.../test/libcxx/transitive_includes/cxx23.csv | 58 ++-----------------
.../test/libcxx/transitive_includes/cxx26.csv | 57 ++----------------
.../template.bitset/includes.pass.cpp | 6 +-
.../alg.nonmodifying/alg.count/count.pass.cpp | 1 +
.../alg.count/ranges.count.pass.cpp | 1 +
.../atomics.types.generic/address.pass.cpp | 3 +-
.../invocable.compile.pass.cpp | 2 +-
.../regular_invocable.compile.pass.cpp | 3 +-
.../equality_comparable.compile.pass.cpp | 2 +-
.../equality_comparable_with.compile.pass.cpp | 5 +-
.../totally_ordered.compile.pass.cpp | 3 +-
.../totally_ordered_with.compile.pass.cpp | 5 +-
.../constructible_from.compile.pass.cpp | 1 +
.../views/mdspan/MinimalElementType.h | 1 +
.../mdspan/extents/CtorTestCombinations.h | 5 +-
.../views/mdspan/extents/comparison.pass.cpp | 5 +-
.../views/mdspan/extents/conversion.pass.cpp | 6 +-
.../views/mdspan/extents/ctad.pass.cpp | 3 +-
.../views/mdspan/extents/obs_static.pass.cpp | 3 +-
.../views/mdspan/extents/types.pass.cpp | 3 +-
.../mdspan/layout_left/comparison.pass.cpp | 5 +-
.../mdspan/layout_left/ctor.default.pass.cpp | 3 +-
.../mdspan/layout_left/ctor.extents.pass.cpp | 3 +-
.../layout_left/ctor.layout_right.pass.cpp | 3 +-
.../layout_left/ctor.layout_stride.pass.cpp | 4 +-
.../mdspan/layout_left/ctor.mapping.pass.cpp | 3 +-
.../layout_left/index_operator.pass.cpp | 5 +-
.../mdspan/layout_left/properties.pass.cpp | 5 +-
.../layout_left/required_span_size.pass.cpp | 3 +-
.../layout_left/static_requirements.pass.cpp | 4 +-
.../mdspan/layout_right/comparison.pass.cpp | 5 +-
.../mdspan/layout_right/ctor.default.pass.cpp | 3 +-
.../mdspan/layout_right/ctor.extents.pass.cpp | 3 +-
.../layout_right/ctor.layout_left.pass.cpp | 3 +-
.../layout_right/ctor.layout_stride.pass.cpp | 4 +-
.../mdspan/layout_right/ctor.mapping.pass.cpp | 3 +-
.../layout_right/index_operator.pass.cpp | 3 +-
.../mdspan/layout_right/properties.pass.cpp | 5 +-
.../layout_right/required_span_size.pass.cpp | 4 +-
.../layout_right/static_requirements.pass.cpp | 4 +-
.../layout_stride/ctor.default.pass.cpp | 3 +-
.../layout_stride/ctor.extents_array.pass.cpp | 3 +-
.../layout_stride/ctor.extents_span.pass.cpp | 3 +-
.../mdspan/layout_stride/deduction.pass.cpp | 5 +-
.../is_exhaustive_corner_case.pass.cpp | 7 +--
.../mdspan/layout_stride/properties.pass.cpp | 3 +-
.../layout_stride/required_span_size.pass.cpp | 3 +-
.../static_requirements.pass.cpp | 4 +-
.../views/mdspan/mdspan/CustomTestAccessors.h | 3 +-
.../span.cons/iterator_len.pass.cpp | 3 +-
.../span.cons/iterator_sentinel.verify.cpp | 3 +-
.../span.objectrep/as_bytes.pass.cpp | 4 +-
.../span.objectrep/as_writable_bytes.pass.cpp | 4 +-
.../syserr/is_error_code_enum.pass.cpp | 4 +-
.../syserr/is_error_condition_enum.pass.cpp | 2 +
.../simd.class/simd_ctor_broadcast.pass.cpp | 3 +
.../test/std/experimental/simd/test_utils.h | 5 +-
.../incrementable_traits.compile.pass.cpp | 5 +-
.../iter_difference_t.compile.pass.cpp | 1 +
...ndirectly_readable_traits.compile.pass.cpp | 2 +-
.../back.insert.iterator/types.pass.cpp | 1 +
.../front.insert.iterator/types.pass.cpp | 1 +
.../insert.iterator/types.pass.cpp | 2 +
.../test/std/numerics/bit/byteswap.pass.cpp | 1 +
.../exclusive.scan/exclusive_scan.pass.cpp | 5 +-
.../inclusive.scan/inclusive_scan.pass.cpp | 5 +-
.../inclusive.scan/inclusive_scan_op.pass.cpp | 4 +-
.../inclusive_scan_op_init.pass.cpp | 4 +-
...sform_exclusive_scan_init_bop_uop.pass.cpp | 4 +-
.../transform_inclusive_scan_bop_uop.pass.cpp | 4 +-
...sform_inclusive_scan_bop_uop_init.pass.cpp | 4 +-
.../rand.dist.samp.plinear/eval.pass.cpp | 5 +-
.../eval_param.pass.cpp | 5 +-
.../range.chunk.by/ctor.default.pass.cpp | 1 +
.../range.chunk.by.iter/deref.pass.cpp | 3 +-
.../iterator/member_typedefs.compile.pass.cpp | 1 +
.../range.repeat.view/iterator/minus.pass.cpp | 4 +-
.../range.subrange/ctad.compile.pass.cpp | 3 +-
.../remove_prefix.pass.cpp | 3 +-
.../remove_suffix.pass.cpp | 3 +-
.../string.view.modifiers/swap.pass.cpp | 3 +-
.../string.view/string.view.ops/copy.pass.cpp | 3 +-
.../string.view.ops/substr.pass.cpp | 5 +-
.../func.search/func.search.bm/hash.pass.cpp | 2 +-
.../func.search.bm/hash.pred.pass.cpp | 2 +-
.../func.search/func.search.bmh/hash.pass.cpp | 4 +-
.../func.search.bmh/hash.pred.pass.cpp | 4 +-
.../func.wrap.func.con/deduct_F.pass.cpp | 3 +-
.../unord.hash/pointer.pass.cpp | 4 +-
.../construct_at.pass.cpp | 3 +-
.../temporary.buffer/overaligned.pass.cpp | 3 +-
.../temporary_buffer.pass.cpp | 5 +-
.../meta/meta.rel/is_invocable.pass.cpp | 5 +-
.../meta.rel/is_nothrow_invocable.pass.cpp | 4 +-
.../allocate_overaligned_request.pass.cpp | 3 +-
...sync_allocate_overaligned_request.pass.cpp | 3 +-
...sync_allocate_overaligned_request.pass.cpp | 3 +-
libcxx/utils/generate_escaped_output_table.py | 2 +-
...enerate_extended_grapheme_cluster_table.py | 2 +-
.../generate_indic_conjunct_break_table.py | 2 +-
.../utils/generate_width_estimation_table.py | 2 +-
libcxxabi/src/private_typeinfo.cpp | 4 +-
281 files changed, 475 insertions(+), 423 deletions(-)
diff --git a/libcxx/include/__algorithm/copy_move_common.h b/libcxx/include/__algorithm/copy_move_common.h
index 8a98451a8f9653..d76bf4903aaa9b 100644
--- a/libcxx/include/__algorithm/copy_move_common.h
+++ b/libcxx/include/__algorithm/copy_move_common.h
@@ -13,6 +13,7 @@
#include <__algorithm/unwrap_iter.h>
#include <__algorithm/unwrap_range.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__iterator/iterator_traits.h>
#include <__memory/pointer_traits.h>
#include <__string/constexpr_c_functions.h>
@@ -24,7 +25,6 @@
#include <__type_traits/is_volatile.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__algorithm/inplace_merge.h b/libcxx/include/__algorithm/inplace_merge.h
index 62a8bc53e23f3c..ad3fe6a7a505d9 100644
--- a/libcxx/include/__algorithm/inplace_merge.h
+++ b/libcxx/include/__algorithm/inplace_merge.h
@@ -18,6 +18,7 @@
#include <__algorithm/rotate.h>
#include <__algorithm/upper_bound.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__functional/identity.h>
#include <__iterator/advance.h>
#include <__iterator/distance.h>
diff --git a/libcxx/include/__algorithm/mismatch.h b/libcxx/include/__algorithm/mismatch.h
index cb83347584b1a5..556bd4216307d5 100644
--- a/libcxx/include/__algorithm/mismatch.h
+++ b/libcxx/include/__algorithm/mismatch.h
@@ -15,6 +15,7 @@
#include <__algorithm/simd_utils.h>
#include <__algorithm/unwrap_iter.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__functional/identity.h>
#include <__iterator/aliasing_iterator.h>
#include <__iterator/iterator_traits.h>
@@ -27,7 +28,6 @@
#include <__utility/move.h>
#include <__utility/pair.h>
#include <__utility/unreachable.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__algorithm/shuffle.h b/libcxx/include/__algorithm/shuffle.h
index c9c56ce8c2c0b1..7177fbb469ba7c 100644
--- a/libcxx/include/__algorithm/shuffle.h
+++ b/libcxx/include/__algorithm/shuffle.h
@@ -11,12 +11,12 @@
#include <__algorithm/iterator_operations.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/iterator_traits.h>
#include <__random/uniform_int_distribution.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/simd_utils.h b/libcxx/include/__algorithm/simd_utils.h
index 56518dafa3193b..4e3e4f2b9404e3 100644
--- a/libcxx/include/__algorithm/simd_utils.h
+++ b/libcxx/include/__algorithm/simd_utils.h
@@ -14,10 +14,10 @@
#include <__bit/countl.h>
#include <__bit/countr.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/is_arithmetic.h>
#include <__type_traits/is_same.h>
#include <__utility/integer_sequence.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/stable_partition.h b/libcxx/include/__algorithm/stable_partition.h
index 5df5e8eaf689ba..0438f589a39d7a 100644
--- a/libcxx/include/__algorithm/stable_partition.h
+++ b/libcxx/include/__algorithm/stable_partition.h
@@ -12,6 +12,7 @@
#include <__algorithm/iterator_operations.h>
#include <__algorithm/rotate.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/advance.h>
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
diff --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h
index ec556aad82e8d8..43f591ac02b01d 100644
--- a/libcxx/include/__algorithm/stable_sort.h
+++ b/libcxx/include/__algorithm/stable_sort.h
@@ -15,6 +15,7 @@
#include <__algorithm/iterator_operations.h>
#include <__algorithm/sort.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__debug_utils/strict_weak_ordering_check.h>
#include <__iterator/iterator_traits.h>
#include <__memory/destruct_n.h>
diff --git a/libcxx/include/__atomic/aliases.h b/libcxx/include/__atomic/aliases.h
index e27e09af6b77d9..6bd34c8f13a4cb 100644
--- a/libcxx/include/__atomic/aliases.h
+++ b/libcxx/include/__atomic/aliases.h
@@ -14,9 +14,10 @@
#include <__atomic/contention_t.h>
#include <__atomic/is_always_lock_free.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
#include <__type_traits/conditional.h>
#include <__type_traits/make_unsigned.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h
index af6d12b5e4ce91..113475cb1f0079 100644
--- a/libcxx/include/__atomic/atomic.h
+++ b/libcxx/include/__atomic/atomic.h
@@ -14,6 +14,7 @@
#include <__atomic/cxx_atomic_impl.h>
#include <__atomic/memory_order.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__functional/operations.h>
#include <__memory/addressof.h>
#include <__type_traits/enable_if.h>
@@ -25,7 +26,6 @@
#include <__type_traits/remove_pointer.h>
#include <__type_traits/remove_volatile.h>
#include <__utility/forward.h>
-#include <cstddef>
#include <cstring>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h
index 465cd9a77ea792..eef15983b98331 100644
--- a/libcxx/include/__atomic/atomic_ref.h
+++ b/libcxx/include/__atomic/atomic_ref.h
@@ -25,10 +25,11 @@
#include <__concepts/arithmetic.h>
#include <__concepts/same_as.h>
#include <__config>
+#include <__cstddef/byte.h>
+#include <__cstddef/ptrdiff_t.h>
#include <__memory/addressof.h>
#include <__type_traits/has_unique_object_representation.h>
#include <__type_traits/is_trivially_copyable.h>
-#include <cstddef>
#include <cstdint>
#include <cstring>
diff --git a/libcxx/include/__atomic/cxx_atomic_impl.h b/libcxx/include/__atomic/cxx_atomic_impl.h
index 18e88aa97bec75..86a57d1d5d8ff2 100644
--- a/libcxx/include/__atomic/cxx_atomic_impl.h
+++ b/libcxx/include/__atomic/cxx_atomic_impl.h
@@ -12,11 +12,12 @@
#include <__atomic/memory_order.h>
#include <__atomic/to_gcc_order.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__memory/addressof.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_trivially_copyable.h>
#include <__type_traits/remove_const.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__charconv/to_chars_integral.h b/libcxx/include/__charconv/to_chars_integral.h
index ccb5856df17993..4fa6c1bf82f8e0 100644
--- a/libcxx/include/__charconv/to_chars_integral.h
+++ b/libcxx/include/__charconv/to_chars_integral.h
@@ -18,6 +18,7 @@
#include <__charconv/to_chars_result.h>
#include <__charconv/traits.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__system_error/errc.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
@@ -26,7 +27,6 @@
#include <__type_traits/make_32_64_or_128_bit.h>
#include <__type_traits/make_unsigned.h>
#include <__utility/unreachable.h>
-#include <cstddef>
#include <cstdint>
#include <limits>
diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h
index 7aeb3da03a4f4a..215922abad6b0e 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -11,8 +11,8 @@
#include <__compare/ordering.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/is_same.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__concepts/swappable.h b/libcxx/include/__concepts/swappable.h
index d339488a087a5c..985c733021a0d7 100644
--- a/libcxx/include/__concepts/swappable.h
+++ b/libcxx/include/__concepts/swappable.h
@@ -14,6 +14,7 @@
#include <__concepts/common_reference_with.h>
#include <__concepts/constructible.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/extent.h>
#include <__type_traits/is_nothrow_assignable.h>
#include <__type_traits/is_nothrow_constructible.h>
@@ -22,7 +23,6 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__coroutine/coroutine_handle.h b/libcxx/include/__coroutine/coroutine_handle.h
index 4557a6643c2393..e2cde20498d843 100644
--- a/libcxx/include/__coroutine/coroutine_handle.h
+++ b/libcxx/include/__coroutine/coroutine_handle.h
@@ -11,11 +11,12 @@
#include <__assert>
#include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
#include <__functional/hash.h>
#include <__memory/addressof.h>
#include <__type_traits/remove_cv.h>
#include <compare>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__exception/exception_ptr.h b/libcxx/include/__exception/exception_ptr.h
index 9e5351f534a1c1..0b2fcf51183f8f 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -14,7 +14,6 @@
#include <__memory/addressof.h>
#include <__memory/construct_at.h>
#include <__type_traits/decay.h>
-#include <cstddef>
#include <cstdlib>
#include <new>
#include <typeinfo>
diff --git a/libcxx/include/__exception/nested_exception.h b/libcxx/include/__exception/nested_exception.h
index 8e817e1c069788..cff25813d78e48 100644
--- a/libcxx/include/__exception/nested_exception.h
+++ b/libcxx/include/__exception/nested_exception.h
@@ -22,7 +22,6 @@
#include <__type_traits/is_final.h>
#include <__type_traits/is_polymorphic.h>
#include <__utility/forward.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__exception/operations.h b/libcxx/include/__exception/operations.h
index c8744eb297a4e8..15520c558a0b4e 100644
--- a/libcxx/include/__exception/operations.h
+++ b/libcxx/include/__exception/operations.h
@@ -10,7 +10,6 @@
#define _LIBCPP___EXCEPTION_OPERATIONS_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__filesystem/directory_iterator.h b/libcxx/include/__filesystem/directory_iterator.h
index e0246d8001e195..621e9bf9258efb 100644
--- a/libcxx/include/__filesystem/directory_iterator.h
+++ b/libcxx/include/__filesystem/directory_iterator.h
@@ -22,7 +22,6 @@
#include <__ranges/enable_view.h>
#include <__system_error/error_code.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index f0d39680430ec5..a3afd617bbbd8d 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -22,7 +22,6 @@
#include <__type_traits/remove_const.h>
#include <__type_traits/remove_pointer.h>
#include <__utility/move.h>
-#include <cstddef>
#include <string>
#include <string_view>
diff --git a/libcxx/include/__filesystem/path_iterator.h b/libcxx/include/__filesystem/path_iterator.h
index f4d486d86cf380..e0f601662d4620 100644
--- a/libcxx/include/__filesystem/path_iterator.h
+++ b/libcxx/include/__filesystem/path_iterator.h
@@ -14,9 +14,6 @@
#include <__config>
#include <__filesystem/path.h>
#include <__iterator/iterator_traits.h>
-#include <cstddef>
-#include <string>
-#include <string_view>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__filesystem/recursive_directory_iterator.h b/libcxx/include/__filesystem/recursive_directory_iterator.h
index caa1396eb301fc..1be92a8bd5f492 100644
--- a/libcxx/include/__filesystem/recursive_directory_iterator.h
+++ b/libcxx/include/__filesystem/recursive_directory_iterator.h
@@ -21,7 +21,6 @@
#include <__ranges/enable_view.h>
#include <__system_error/error_code.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index ce9ac0c81e315a..618b8ef0256432 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -37,7 +37,6 @@
#include <__type_traits/conditional.h>
#include <__utility/exception_guard.h>
#include <__utility/move.h>
-#include <cstddef>
#include <string_view>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/escaped_output_table.h b/libcxx/include/__format/escaped_output_table.h
index bdf86cb6f99ccb..7a0b35239861e0 100644
--- a/libcxx/include/__format/escaped_output_table.h
+++ b/libcxx/include/__format/escaped_output_table.h
@@ -63,7 +63,7 @@
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/extended_grapheme_cluster_table.h b/libcxx/include/__format/extended_grapheme_cluster_table.h
index 7dbc239f5f5cd6..7653a9e03b815d 100644
--- a/libcxx/include/__format/extended_grapheme_cluster_table.h
+++ b/libcxx/include/__format/extended_grapheme_cluster_table.h
@@ -63,8 +63,8 @@
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/access.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index d1ce055874413e..86d8b12dc08304 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -13,6 +13,7 @@
#include <__assert>
#include <__concepts/arithmetic.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__format/concepts.h>
#include <__format/format_parse_context.h>
#include <__functional/invoke.h>
diff --git a/libcxx/include/__format/format_args.h b/libcxx/include/__format/format_args.h
index e19b4458e41a5b..b98663c06ea4d8 100644
--- a/libcxx/include/__format/format_args.h
+++ b/libcxx/include/__format/format_args.h
@@ -11,10 +11,10 @@
#define _LIBCPP___FORMAT_FORMAT_ARGS_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__format/format_arg.h>
#include <__format/format_arg_store.h>
#include <__fwd/format.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index a9be17b855837d..f3b686367dd290 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -23,7 +23,6 @@
#include <__memory/addressof.h>
#include <__utility/move.h>
#include <__variant/monostate.h>
-#include <cstddef>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <__locale>
diff --git a/libcxx/include/__format/format_string.h b/libcxx/include/__format/format_string.h
index a499afee8874a5..5db5973dd5889f 100644
--- a/libcxx/include/__format/format_string.h
+++ b/libcxx/include/__format/format_string.h
@@ -12,10 +12,10 @@
#include <__assert>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__format/format_error.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h> // iter_value_t
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h
index fc95dd3f22bbe7..9ffe20a1a72a06 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -36,7 +36,6 @@
#include <__utility/move.h>
#include <__utility/unreachable.h>
#include <cmath>
-#include <cstddef>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# include <__locale>
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 34c4c87313a450..457f5f53b2dc55 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -16,6 +16,8 @@
#include <__bit/countl.h>
#include <__concepts/same_as.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
#include <__format/buffer.h>
#include <__format/concepts.h>
#include <__format/formatter.h>
@@ -28,7 +30,6 @@
#include <__memory/pointer_traits.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
-#include <cstddef>
#include <string_view>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/formatter_pointer.h b/libcxx/include/__format/formatter_pointer.h
index 6e0fa9a1b4f196..4ef48c168d0d8b 100644
--- a/libcxx/include/__format/formatter_pointer.h
+++ b/libcxx/include/__format/formatter_pointer.h
@@ -11,13 +11,13 @@
#define _LIBCPP___FORMAT_FORMATTER_POINTER_H
#include <__config>
+#include <__cstddef/nullptr_t.h>
#include <__format/concepts.h>
#include <__format/format_parse_context.h>
#include <__format/formatter.h>
#include <__format/formatter_integral.h>
#include <__format/formatter_output.h>
#include <__format/parser_std_format_spec.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/indic_conjunct_break_table.h b/libcxx/include/__format/indic_conjunct_break_table.h
index 39dd45da771fc2..df6cfe6a02f348 100644
--- a/libcxx/include/__format/indic_conjunct_break_table.h
+++ b/libcxx/include/__format/indic_conjunct_break_table.h
@@ -63,8 +63,8 @@
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/access.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/width_estimation_table.h b/libcxx/include/__format/width_estimation_table.h
index 23a08746b91031..5b4b3950c6a1d0 100644
--- a/libcxx/include/__format/width_estimation_table.h
+++ b/libcxx/include/__format/width_estimation_table.h
@@ -63,7 +63,7 @@
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index 4251ef74ab7bd4..f82c1517249b16 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -17,7 +17,6 @@
#include <__type_traits/invoke.h>
#include <__type_traits/is_reference_wrapper.h>
#include <__type_traits/is_void.h>
-#include <cstddef>
#include <tuple>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index 59dce7ac9cc031..cd577edc56c8c5 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -20,7 +20,6 @@
#include <__type_traits/underlying_type.h>
#include <__utility/pair.h>
#include <__utility/swap.h>
-#include <cstddef>
#include <cstdint>
#include <cstring>
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 821d4edd8d87c0..81b0b79613a257 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -15,6 +15,7 @@
#include <__assert>
#include <__bit/countl.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__functional/hash.h>
#include <__iterator/iterator_traits.h>
#include <__math/rounding_functions.h>
diff --git a/libcxx/include/__iterator/access.h b/libcxx/include/__iterator/access.h
index acc4f60bf697ea..d42855f9254873 100644
--- a/libcxx/include/__iterator/access.h
+++ b/libcxx/include/__iterator/access.h
@@ -11,7 +11,7 @@
#define _LIBCPP___ITERATOR_ACCESS_H
#include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/aliasing_iterator.h b/libcxx/include/__iterator/aliasing_iterator.h
index 94ba577078b5e8..aeb5b4a88ec375 100644
--- a/libcxx/include/__iterator/aliasing_iterator.h
+++ b/libcxx/include/__iterator/aliasing_iterator.h
@@ -10,10 +10,10 @@
#define _LIBCPP___ITERATOR_ALIASING_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/iterator_traits.h>
#include <__memory/pointer_traits.h>
#include <__type_traits/is_trivial.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/back_insert_iterator.h b/libcxx/include/__iterator/back_insert_iterator.h
index 6d3dd4b12966fe..9a594875338854 100644
--- a/libcxx/include/__iterator/back_insert_iterator.h
+++ b/libcxx/include/__iterator/back_insert_iterator.h
@@ -11,11 +11,11 @@
#define _LIBCPP___ITERATOR_BACK_INSERT_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/data.h b/libcxx/include/__iterator/data.h
index b7c1603652b0e6..5f2624c2b819ed 100644
--- a/libcxx/include/__iterator/data.h
+++ b/libcxx/include/__iterator/data.h
@@ -11,7 +11,6 @@
#define _LIBCPP___ITERATOR_DATA_H
#include <__config>
-#include <cstddef>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/empty.h b/libcxx/include/__iterator/empty.h
index 773f2776955b2a..f2c653bcb329ba 100644
--- a/libcxx/include/__iterator/empty.h
+++ b/libcxx/include/__iterator/empty.h
@@ -11,7 +11,6 @@
#define _LIBCPP___ITERATOR_EMPTY_H
#include <__config>
-#include <cstddef>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/front_insert_iterator.h b/libcxx/include/__iterator/front_insert_iterator.h
index 7f2c54ec87442e..80819cd22ae6c1 100644
--- a/libcxx/include/__iterator/front_insert_iterator.h
+++ b/libcxx/include/__iterator/front_insert_iterator.h
@@ -11,11 +11,11 @@
#define _LIBCPP___ITERATOR_FRONT_INSERT_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/incrementable_traits.h b/libcxx/include/__iterator/incrementable_traits.h
index a228b228f6e552..37c8daddf8a861 100644
--- a/libcxx/include/__iterator/incrementable_traits.h
+++ b/libcxx/include/__iterator/incrementable_traits.h
@@ -12,13 +12,13 @@
#include <__concepts/arithmetic.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__type_traits/conditional.h>
#include <__type_traits/is_object.h>
#include <__type_traits/is_primary_template.h>
#include <__type_traits/make_signed.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/insert_iterator.h b/libcxx/include/__iterator/insert_iterator.h
index 8b7574dc9ec0af..b3311042014f8f 100644
--- a/libcxx/include/__iterator/insert_iterator.h
+++ b/libcxx/include/__iterator/insert_iterator.h
@@ -11,12 +11,12 @@
#define _LIBCPP___ITERATOR_INSERT_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include <__ranges/access.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/istream_iterator.h b/libcxx/include/__iterator/istream_iterator.h
index 58c9ac6d4cccea..a6c74d00178d29 100644
--- a/libcxx/include/__iterator/istream_iterator.h
+++ b/libcxx/include/__iterator/istream_iterator.h
@@ -11,13 +11,13 @@
#define _LIBCPP___ITERATOR_ISTREAM_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__fwd/istream.h>
#include <__fwd/string.h>
#include <__iterator/default_sentinel.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/istreambuf_iterator.h b/libcxx/include/__iterator/istreambuf_iterator.h
index 51c4ecff351f52..162873b9559ec6 100644
--- a/libcxx/include/__iterator/istreambuf_iterator.h
+++ b/libcxx/include/__iterator/istreambuf_iterator.h
@@ -16,6 +16,8 @@
#include <__iterator/default_sentinel.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
+#include <__string/char_traits.h>
+#include <iosfwd>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/iterator.h b/libcxx/include/__iterator/iterator.h
index ba9308f3c22430..1591655313ddec 100644
--- a/libcxx/include/__iterator/iterator.h
+++ b/libcxx/include/__iterator/iterator.h
@@ -11,7 +11,7 @@
#define _LIBCPP___ITERATOR_ITERATOR_H
#include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/iterator_traits.h b/libcxx/include/__iterator/iterator_traits.h
index 4d9ad480cc4a29..eb6ba8b62fb30f 100644
--- a/libcxx/include/__iterator/iterator_traits.h
+++ b/libcxx/include/__iterator/iterator_traits.h
@@ -18,6 +18,7 @@
#include <__concepts/same_as.h>
#include <__concepts/totally_ordered.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__fwd/pair.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/readable_traits.h>
@@ -36,7 +37,6 @@
#include <__type_traits/remove_cvref.h>
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/ostream_iterator.h b/libcxx/include/__iterator/ostream_iterator.h
index 05697e62d9dcb9..93ecc03010d07c 100644
--- a/libcxx/include/__iterator/ostream_iterator.h
+++ b/libcxx/include/__iterator/ostream_iterator.h
@@ -11,12 +11,12 @@
#define _LIBCPP___ITERATOR_OSTREAM_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__fwd/ostream.h>
#include <__fwd/string.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/ostreambuf_iterator.h b/libcxx/include/__iterator/ostreambuf_iterator.h
index 401b6f3f236032..621ffd4f988c31 100644
--- a/libcxx/include/__iterator/ostreambuf_iterator.h
+++ b/libcxx/include/__iterator/ostreambuf_iterator.h
@@ -11,12 +11,12 @@
#define _LIBCPP___ITERATOR_OSTREAMBUF_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__fwd/ios.h>
#include <__fwd/ostream.h>
#include <__fwd/streambuf.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
-#include <cstddef>
#include <iosfwd> // for forward declaration of ostreambuf_iterator
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/reverse_access.h b/libcxx/include/__iterator/reverse_access.h
index 54d7270b04a537..f6e60c3fb75b34 100644
--- a/libcxx/include/__iterator/reverse_access.h
+++ b/libcxx/include/__iterator/reverse_access.h
@@ -12,7 +12,6 @@
#include <__config>
#include <__iterator/reverse_iterator.h>
-#include <cstddef>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/segmented_iterator.h b/libcxx/include/__iterator/segmented_iterator.h
index f3cd1e5fa1f5da..8cb54a35a7f5ea 100644
--- a/libcxx/include/__iterator/segmented_iterator.h
+++ b/libcxx/include/__iterator/segmented_iterator.h
@@ -41,8 +41,8 @@
// Returns the iterator composed of the segment iterator and local iterator.
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/size.h b/libcxx/include/__iterator/size.h
index 876e6963f77d91..84e2e3b21f1d5d 100644
--- a/libcxx/include/__iterator/size.h
+++ b/libcxx/include/__iterator/size.h
@@ -11,9 +11,10 @@
#define _LIBCPP___ITERATOR_SIZE_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
#include <__type_traits/common_type.h>
#include <__type_traits/make_signed.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index 549d8ff2dbd7db..2856833e600798 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -13,13 +13,13 @@
#include <__compare/ordering.h>
#include <__compare/three_way_comparable.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include <__memory/pointer_traits.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_convertible.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__mdspan/default_accessor.h b/libcxx/include/__mdspan/default_accessor.h
index 1cc5f15545fc8c..d6f3ddb998e962 100644
--- a/libcxx/include/__mdspan/default_accessor.h
+++ b/libcxx/include/__mdspan/default_accessor.h
@@ -18,12 +18,11 @@
#define _LIBCPP___MDSPAN_DEFAULT_ACCESSOR_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/is_abstract.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_convertible.h>
#include <__type_traits/remove_const.h>
-#include <cinttypes>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__mdspan/extents.h b/libcxx/include/__mdspan/extents.h
index 3d2c2771a834b4..edbc30a7a40e42 100644
--- a/libcxx/include/__mdspan/extents.h
+++ b/libcxx/include/__mdspan/extents.h
@@ -21,6 +21,7 @@
#include <__config>
#include <__concepts/arithmetic.h>
+#include <__cstddef/byte.h>
#include <__type_traits/common_type.h>
#include <__type_traits/is_convertible.h>
#include <__type_traits/is_nothrow_constructible.h>
@@ -29,9 +30,7 @@
#include <__utility/integer_sequence.h>
#include <__utility/unreachable.h>
#include <array>
-#include <cinttypes>
#include <concepts>
-#include <cstddef>
#include <limits>
#include <span>
diff --git a/libcxx/include/__mdspan/layout_left.h b/libcxx/include/__mdspan/layout_left.h
index 59574e83b0d7b1..288b3dd8038ee2 100644
--- a/libcxx/include/__mdspan/layout_left.h
+++ b/libcxx/include/__mdspan/layout_left.h
@@ -27,9 +27,6 @@
#include <__type_traits/is_nothrow_constructible.h>
#include <__utility/integer_sequence.h>
#include <array>
-#include <cinttypes>
-#include <cstddef>
-#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__mdspan/layout_right.h b/libcxx/include/__mdspan/layout_right.h
index d1acdb41238f7f..72922d1049c7a1 100644
--- a/libcxx/include/__mdspan/layout_right.h
+++ b/libcxx/include/__mdspan/layout_right.h
@@ -19,6 +19,7 @@
#include <__assert>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__fwd/mdspan.h>
#include <__mdspan/extents.h>
#include <__type_traits/common_type.h>
@@ -26,9 +27,6 @@
#include <__type_traits/is_convertible.h>
#include <__type_traits/is_nothrow_constructible.h>
#include <__utility/integer_sequence.h>
-#include <cinttypes>
-#include <cstddef>
-#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__mdspan/layout_stride.h b/libcxx/include/__mdspan/layout_stride.h
index c57f596431c7c5..bb93de97751457 100644
--- a/libcxx/include/__mdspan/layout_stride.h
+++ b/libcxx/include/__mdspan/layout_stride.h
@@ -32,8 +32,6 @@
#include <__utility/integer_sequence.h>
#include <__utility/swap.h>
#include <array>
-#include <cinttypes>
-#include <cstddef>
#include <limits>
#include <span>
diff --git a/libcxx/include/__mdspan/mdspan.h b/libcxx/include/__mdspan/mdspan.h
index 1ff4fd4ba4a829..3f9b35b185b167 100644
--- a/libcxx/include/__mdspan/mdspan.h
+++ b/libcxx/include/__mdspan/mdspan.h
@@ -37,9 +37,6 @@
#include <__type_traits/remove_reference.h>
#include <__utility/integer_sequence.h>
#include <array>
-#include <cinttypes>
-#include <cstddef>
-#include <limits>
#include <span>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/align.h b/libcxx/include/__memory/align.h
index bbb995f4a8c8ed..402eac3380925d 100644
--- a/libcxx/include/__memory/align.h
+++ b/libcxx/include/__memory/align.h
@@ -10,7 +10,7 @@
#define _LIBCPP___MEMORY_ALIGN_H
#include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/aligned_alloc.h b/libcxx/include/__memory/aligned_alloc.h
index cb424328bcafc1..8d4f0c1f07d821 100644
--- a/libcxx/include/__memory/aligned_alloc.h
+++ b/libcxx/include/__memory/aligned_alloc.h
@@ -10,7 +10,6 @@
#define _LIBCPP___MEMORY_ALIGNED_ALLOC_H
#include <__config>
-#include <cstddef>
#include <cstdlib>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/allocate_at_least.h b/libcxx/include/__memory/allocate_at_least.h
index a10e4fbaead38b..9b5a8bcbd4596b 100644
--- a/libcxx/include/__memory/allocate_at_least.h
+++ b/libcxx/include/__memory/allocate_at_least.h
@@ -10,8 +10,8 @@
#define _LIBCPP___MEMORY_ALLOCATE_AT_LEAST_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__memory/allocator_traits.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/allocation_guard.h b/libcxx/include/__memory/allocation_guard.h
index cb870af7be6760..66d6a5002c299e 100644
--- a/libcxx/include/__memory/allocation_guard.h
+++ b/libcxx/include/__memory/allocation_guard.h
@@ -14,7 +14,6 @@
#include <__memory/addressof.h>
#include <__memory/allocator_traits.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h
index cd146da8e7eb5c..ddb4179940b8b1 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -11,6 +11,7 @@
#define _LIBCPP___MEMORY_ALLOCATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__memory/addressof.h>
#include <__memory/allocate_at_least.h>
#include <__memory/allocator_traits.h>
@@ -20,7 +21,6 @@
#include <__type_traits/is_void.h>
#include <__type_traits/is_volatile.h>
#include <__utility/forward.h>
-#include <cstddef>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index f4d9679807ae01..499b30b85b6c9b 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -11,6 +11,7 @@
#define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__fwd/memory.h>
#include <__memory/construct_at.h>
#include <__memory/pointer_traits.h>
@@ -23,7 +24,6 @@
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
-#include <cstddef>
#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/array_cookie.h b/libcxx/include/__memory/array_cookie.h
index 10b29c9dcc78e3..806a9e99ecafe7 100644
--- a/libcxx/include/__memory/array_cookie.h
+++ b/libcxx/include/__memory/array_cookie.h
@@ -12,10 +12,10 @@
#include <__config>
#include <__configuration/abi.h>
+#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_trivially_destructible.h>
#include <__type_traits/negation.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/assume_aligned.h b/libcxx/include/__memory/assume_aligned.h
index c7ba2a99c7e226..08f1772cd6dfa6 100644
--- a/libcxx/include/__memory/assume_aligned.h
+++ b/libcxx/include/__memory/assume_aligned.h
@@ -12,8 +12,8 @@
#include <__assert>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/is_constant_evaluated.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/builtin_new_allocator.h b/libcxx/include/__memory/builtin_new_allocator.h
index c6f7f3c5ff52a1..128288efb05bc1 100644
--- a/libcxx/include/__memory/builtin_new_allocator.h
+++ b/libcxx/include/__memory/builtin_new_allocator.h
@@ -11,7 +11,6 @@
#include <__config>
#include <__memory/unique_ptr.h>
-#include <cstddef>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h
index 9d44775bdb4871..a7acaaff9da099 100644
--- a/libcxx/include/__memory/compressed_pair.h
+++ b/libcxx/include/__memory/compressed_pair.h
@@ -11,6 +11,7 @@
#define _LIBCPP___MEMORY_COMPRESSED_PAIR_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/datasizeof.h>
#include <__type_traits/is_empty.h>
#include <__type_traits/is_final.h>
diff --git a/libcxx/include/__memory/destruct_n.h b/libcxx/include/__memory/destruct_n.h
index 78635ad0af04bd..66adefb0f51fc7 100644
--- a/libcxx/include/__memory/destruct_n.h
+++ b/libcxx/include/__memory/destruct_n.h
@@ -10,9 +10,9 @@
#define _LIBCPP___MEMORY_DESTRUCT_N_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_trivially_destructible.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index 98961ddf9709f6..4acf3d18401ae4 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -11,6 +11,7 @@
#define _LIBCPP___MEMORY_POINTER_TRAITS_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__memory/addressof.h>
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
@@ -23,7 +24,6 @@
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/raw_storage_iterator.h b/libcxx/include/__memory/raw_storage_iterator.h
index 774878aa1c5e81..2ee4c074d8d337 100644
--- a/libcxx/include/__memory/raw_storage_iterator.h
+++ b/libcxx/include/__memory/raw_storage_iterator.h
@@ -11,11 +11,11 @@
#define _LIBCPP___MEMORY_RAW_STORAGE_ITERATOR_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
#include <__utility/move.h>
-#include <cstddef>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index 20c1b69f45ae66..806a9bac78b5d0 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -13,6 +13,7 @@
#include <__compare/compare_three_way.h>
#include <__compare/ordering.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__exception/exception.h>
#include <__functional/binary_function.h>
#include <__functional/operations.h>
@@ -51,7 +52,6 @@
#include <__utility/move.h>
#include <__utility/swap.h>
#include <__verbose_abort>
-#include <cstddef>
#include <new>
#include <typeinfo>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
diff --git a/libcxx/include/__memory/temporary_buffer.h b/libcxx/include/__memory/temporary_buffer.h
index 219e03f99bc01d..d18717f52d1cdd 100644
--- a/libcxx/include/__memory/temporary_buffer.h
+++ b/libcxx/include/__memory/temporary_buffer.h
@@ -11,10 +11,9 @@
#define _LIBCPP___MEMORY_TEMPORARY_BUFFER_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__memory/unique_temporary_buffer.h>
#include <__utility/pair.h>
-#include <cstddef>
-#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 6e42ef1eaa1a3c..4ed6393b1209f5 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -15,6 +15,8 @@
#include <__compare/compare_three_way_result.h>
#include <__compare/three_way_comparable.h>
#include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
#include <__functional/hash.h>
#include <__functional/operations.h>
#include <__memory/allocator_traits.h> // __pointer
@@ -46,7 +48,6 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/private_constructor_tag.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/unique_temporary_buffer.h b/libcxx/include/__memory/unique_temporary_buffer.h
index 001254e8fa4be1..5b5ee50b001ad0 100644
--- a/libcxx/include/__memory/unique_temporary_buffer.h
+++ b/libcxx/include/__memory/unique_temporary_buffer.h
@@ -13,10 +13,10 @@
#include <__assert>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__memory/allocator.h>
#include <__memory/unique_ptr.h>
#include <__type_traits/is_constant_evaluated.h>
-#include <cstddef>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/uses_allocator.h b/libcxx/include/__memory/uses_allocator.h
index 16504e8b2a9989..20aa0e6b7f2724 100644
--- a/libcxx/include/__memory/uses_allocator.h
+++ b/libcxx/include/__memory/uses_allocator.h
@@ -13,7 +13,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_convertible.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/memory_resource.h b/libcxx/include/__memory_resource/memory_resource.h
index ea85e50cd568bc..f93f10fe21a2d0 100644
--- a/libcxx/include/__memory_resource/memory_resource.h
+++ b/libcxx/include/__memory_resource/memory_resource.h
@@ -10,8 +10,9 @@
#define _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H
#include <__config>
+#include <__cstddef/max_align_t.h>
+#include <__cstddef/size_t.h>
#include <__fwd/memory_resource.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/monotonic_buffer_resource.h b/libcxx/include/__memory_resource/monotonic_buffer_resource.h
index f45b30fdb38616..c5a2b556707f6a 100644
--- a/libcxx/include/__memory_resource/monotonic_buffer_resource.h
+++ b/libcxx/include/__memory_resource/monotonic_buffer_resource.h
@@ -10,9 +10,9 @@
#define _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__memory/addressof.h>
#include <__memory_resource/memory_resource.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h
index fb36d5cad78ec6..30fa5c2170d502 100644
--- a/libcxx/include/__memory_resource/polymorphic_allocator.h
+++ b/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -11,10 +11,11 @@
#include <__assert>
#include <__config>
+#include <__cstddef/byte.h>
+#include <__cstddef/max_align_t.h>
#include <__fwd/pair.h>
#include <__memory_resource/memory_resource.h>
#include <__utility/exception_guard.h>
-#include <cstddef>
#include <limits>
#include <new>
#include <tuple>
diff --git a/libcxx/include/__memory_resource/pool_options.h b/libcxx/include/__memory_resource/pool_options.h
index 442959836c7ef3..324b8aaa8502b1 100644
--- a/libcxx/include/__memory_resource/pool_options.h
+++ b/libcxx/include/__memory_resource/pool_options.h
@@ -10,7 +10,7 @@
#define _LIBCPP___MEMORY_RESOURCE_POOL_OPTIONS_H
#include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory_resource/synchronized_pool_resource.h b/libcxx/include/__memory_resource/synchronized_pool_resource.h
index 50a673c2861d10..2679afc16617ba 100644
--- a/libcxx/include/__memory_resource/synchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/synchronized_pool_resource.h
@@ -13,7 +13,6 @@
#include <__memory_resource/memory_resource.h>
#include <__memory_resource/pool_options.h>
#include <__memory_resource/unsynchronized_pool_resource.h>
-#include <cstddef>
#include <mutex>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
index 783db84262af72..92da16c559fea8 100644
--- a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
@@ -10,9 +10,9 @@
#define _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__memory_resource/memory_resource.h>
#include <__memory_resource/pool_options.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__numeric/midpoint.h b/libcxx/include/__numeric/midpoint.h
index 5ef30d4ec50f5a..2ba80e5cca07d3 100644
--- a/libcxx/include/__numeric/midpoint.h
+++ b/libcxx/include/__numeric/midpoint.h
@@ -11,6 +11,7 @@
#define _LIBCPP___NUMERIC_MIDPOINT_H
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_floating_point.h>
#include <__type_traits/is_integral.h>
@@ -21,7 +22,6 @@
#include <__type_traits/is_void.h>
#include <__type_traits/make_unsigned.h>
#include <__type_traits/remove_pointer.h>
-#include <cstddef>
#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__ostream/basic_ostream.h b/libcxx/include/__ostream/basic_ostream.h
index 1f7fe8338c5894..f1dea71a1d114f 100644
--- a/libcxx/include/__ostream/basic_ostream.h
+++ b/libcxx/include/__ostream/basic_ostream.h
@@ -23,7 +23,6 @@
# include <__type_traits/void_t.h>
# include <__utility/declval.h>
# include <bitset>
-# include <cstddef>
# include <ios>
# include <locale>
# include <new> // for __throw_bad_alloc
diff --git a/libcxx/include/__pstl/backends/libdispatch.h b/libcxx/include/__pstl/backends/libdispatch.h
index 2d6ab49c8f7f3a..66d14785713942 100644
--- a/libcxx/include/__pstl/backends/libdispatch.h
+++ b/libcxx/include/__pstl/backends/libdispatch.h
@@ -16,6 +16,7 @@
#include <__algorithm/upper_bound.h>
#include <__atomic/atomic.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__exception/terminate.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/move_iterator.h>
@@ -37,7 +38,6 @@
#include <__utility/exception_guard.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <cstddef>
#include <new>
#include <optional>
diff --git a/libcxx/include/__pstl/backends/std_thread.h b/libcxx/include/__pstl/backends/std_thread.h
index 19b985f860a174..dd2c3f15403e3d 100644
--- a/libcxx/include/__pstl/backends/std_thread.h
+++ b/libcxx/include/__pstl/backends/std_thread.h
@@ -22,7 +22,6 @@
#include <__pstl/cpu_algos/transform_reduce.h>
#include <__utility/empty.h>
#include <__utility/move.h>
-#include <cstddef>
#include <optional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__pstl/cpu_algos/cpu_traits.h b/libcxx/include/__pstl/cpu_algos/cpu_traits.h
index 5e59752fa5723c..ec1622419d0490 100644
--- a/libcxx/include/__pstl/cpu_algos/cpu_traits.h
+++ b/libcxx/include/__pstl/cpu_algos/cpu_traits.h
@@ -10,7 +10,6 @@
#define _LIBCPP___PSTL_CPU_ALGOS_CPU_TRAITS_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__pstl/cpu_algos/find_if.h b/libcxx/include/__pstl/cpu_algos/find_if.h
index cd92e5a99f12f8..ebb4ecb4a0ed36 100644
--- a/libcxx/include/__pstl/cpu_algos/find_if.h
+++ b/libcxx/include/__pstl/cpu_algos/find_if.h
@@ -21,7 +21,6 @@
#include <__type_traits/is_execution_policy.h>
#include <__utility/move.h>
#include <__utility/pair.h>
-#include <cstddef>
#include <optional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__pstl/cpu_algos/transform_reduce.h b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
index aafbf1ca96b40d..e9f622d832cd5c 100644
--- a/libcxx/include/__pstl/cpu_algos/transform_reduce.h
+++ b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
@@ -20,7 +20,6 @@
#include <__type_traits/is_arithmetic.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/move.h>
-#include <cstddef>
#include <new>
#include <optional>
diff --git a/libcxx/include/__random/discard_block_engine.h b/libcxx/include/__random/discard_block_engine.h
index 07f599067279e6..f319557a573657 100644
--- a/libcxx/include/__random/discard_block_engine.h
+++ b/libcxx/include/__random/discard_block_engine.h
@@ -10,11 +10,11 @@
#define _LIBCPP___RANDOM_DISCARD_BLOCK_ENGINE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__random/is_seed_sequence.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_convertible.h>
#include <__utility/move.h>
-#include <cstddef>
#include <iosfwd>
#include <limits>
diff --git a/libcxx/include/__random/discrete_distribution.h b/libcxx/include/__random/discrete_distribution.h
index bb72dd6cb5074c..a8498cd7c76a32 100644
--- a/libcxx/include/__random/discrete_distribution.h
+++ b/libcxx/include/__random/discrete_distribution.h
@@ -13,7 +13,6 @@
#include <__config>
#include <__random/is_valid.h>
#include <__random/uniform_real_distribution.h>
-#include <cstddef>
#include <iosfwd>
#include <numeric>
#include <vector>
diff --git a/libcxx/include/__random/independent_bits_engine.h b/libcxx/include/__random/independent_bits_engine.h
index 0f4a7b82b98f89..20f56e9b575609 100644
--- a/libcxx/include/__random/independent_bits_engine.h
+++ b/libcxx/include/__random/independent_bits_engine.h
@@ -10,6 +10,7 @@
#define _LIBCPP___RANDOM_INDEPENDENT_BITS_ENGINE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__fwd/istream.h>
#include <__fwd/ostream.h>
#include <__random/is_seed_sequence.h>
@@ -18,7 +19,6 @@
#include <__type_traits/enable_if.h>
#include <__type_traits/is_convertible.h>
#include <__utility/move.h>
-#include <cstddef>
#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__random/log2.h b/libcxx/include/__random/log2.h
index 74b4889c6402b5..2de7bd0ba52a4a 100644
--- a/libcxx/include/__random/log2.h
+++ b/libcxx/include/__random/log2.h
@@ -10,8 +10,8 @@
#define _LIBCPP___RANDOM_LOG2_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/conditional.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__random/mersenne_twister_engine.h b/libcxx/include/__random/mersenne_twister_engine.h
index 1f50e608ce8d4e..9dd87f9ce71a11 100644
--- a/libcxx/include/__random/mersenne_twister_engine.h
+++ b/libcxx/include/__random/mersenne_twister_engine.h
@@ -12,9 +12,9 @@
#include <__algorithm/equal.h>
#include <__algorithm/min.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__random/is_seed_sequence.h>
#include <__type_traits/enable_if.h>
-#include <cstddef>
#include <cstdint>
#include <iosfwd>
#include <limits>
diff --git a/libcxx/include/__random/piecewise_constant_distribution.h b/libcxx/include/__random/piecewise_constant_distribution.h
index e19380f97c35ec..7cb1efe0812856 100644
--- a/libcxx/include/__random/piecewise_constant_distribution.h
+++ b/libcxx/include/__random/piecewise_constant_distribution.h
@@ -11,6 +11,7 @@
#include <__algorithm/upper_bound.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__random/is_valid.h>
#include <__random/uniform_real_distribution.h>
#include <iosfwd>
diff --git a/libcxx/include/__random/piecewise_linear_distribution.h b/libcxx/include/__random/piecewise_linear_distribution.h
index 43769dc825e65b..59f51033b5510c 100644
--- a/libcxx/include/__random/piecewise_linear_distribution.h
+++ b/libcxx/include/__random/piecewise_linear_distribution.h
@@ -11,6 +11,7 @@
#include <__algorithm/upper_bound.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__random/is_valid.h>
#include <__random/uniform_real_distribution.h>
#include <cmath>
diff --git a/libcxx/include/__random/shuffle_order_engine.h b/libcxx/include/__random/shuffle_order_engine.h
index f54ed17e38383a..53f6c08971105e 100644
--- a/libcxx/include/__random/shuffle_order_engine.h
+++ b/libcxx/include/__random/shuffle_order_engine.h
@@ -11,12 +11,12 @@
#include <__algorithm/equal.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__random/is_seed_sequence.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_convertible.h>
#include <__utility/move.h>
-#include <cstddef>
#include <cstdint>
#include <iosfwd>
diff --git a/libcxx/include/__random/subtract_with_carry_engine.h b/libcxx/include/__random/subtract_with_carry_engine.h
index 926333cdda45ee..e087ab4a3c2c7b 100644
--- a/libcxx/include/__random/subtract_with_carry_engine.h
+++ b/libcxx/include/__random/subtract_with_carry_engine.h
@@ -12,10 +12,10 @@
#include <__algorithm/equal.h>
#include <__algorithm/min.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__random/is_seed_sequence.h>
#include <__random/linear_congruential_engine.h>
#include <__type_traits/enable_if.h>
-#include <cstddef>
#include <cstdint>
#include <iosfwd>
#include <limits>
diff --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h
index 4e3ca3efe56866..fa2c33755b7398 100644
--- a/libcxx/include/__random/uniform_int_distribution.h
+++ b/libcxx/include/__random/uniform_int_distribution.h
@@ -11,11 +11,11 @@
#include <__bit/countl.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__random/is_valid.h>
#include <__random/log2.h>
#include <__type_traits/conditional.h>
#include <__type_traits/make_unsigned.h>
-#include <cstddef>
#include <cstdint>
#include <iosfwd>
#include <limits>
diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h
index c0a40c5e10178a..bbacef3eae6be1 100644
--- a/libcxx/include/__ranges/access.h
+++ b/libcxx/include/__ranges/access.h
@@ -12,6 +12,7 @@
#include <__concepts/class_or_enum.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__iterator/concepts.h>
#include <__iterator/readable_traits.h>
#include <__ranges/enable_borrowed_range.h>
@@ -21,7 +22,6 @@
#include <__type_traits/remove_reference.h>
#include <__utility/auto_cast.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/counted.h b/libcxx/include/__ranges/counted.h
index e365deca4e632d..65bf1a371ec780 100644
--- a/libcxx/include/__ranges/counted.h
+++ b/libcxx/include/__ranges/counted.h
@@ -12,6 +12,7 @@
#include <__concepts/convertible_to.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__iterator/concepts.h>
#include <__iterator/counted_iterator.h>
#include <__iterator/default_sentinel.h>
@@ -22,7 +23,6 @@
#include <__type_traits/decay.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <cstddef>
#include <span>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h
index bd66371f4ed218..0943c1097aefd6 100644
--- a/libcxx/include/__ranges/drop_view.h
+++ b/libcxx/include/__ranges/drop_view.h
@@ -42,7 +42,6 @@
#include <__utility/auto_cast.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h
index ac0d8dbbd52b77..c99282f37960c3 100644
--- a/libcxx/include/__ranges/elements_view.h
+++ b/libcxx/include/__ranges/elements_view.h
@@ -37,7 +37,6 @@
#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <cstddef>
#include <tuple> // std::get
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__ranges/empty_view.h b/libcxx/include/__ranges/empty_view.h
index 6c04b0200c35f2..fc08492110f53c 100644
--- a/libcxx/include/__ranges/empty_view.h
+++ b/libcxx/include/__ranges/empty_view.h
@@ -11,10 +11,10 @@
#define _LIBCPP___RANGES_EMPTY_VIEW_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__ranges/enable_borrowed_range.h>
#include <__ranges/view_interface.h>
#include <__type_traits/is_object.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/istream_view.h b/libcxx/include/__ranges/istream_view.h
index cd7096d35c2c1f..1820ef2a4c1f7e 100644
--- a/libcxx/include/__ranges/istream_view.h
+++ b/libcxx/include/__ranges/istream_view.h
@@ -14,6 +14,7 @@
#include <__concepts/derived_from.h>
#include <__concepts/movable.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__fwd/istream.h>
#include <__fwd/string.h>
#include <__iterator/default_sentinel.h>
@@ -22,7 +23,6 @@
#include <__ranges/view_interface.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/repeat_view.h b/libcxx/include/__ranges/repeat_view.h
index 53e4beb270ad01..93ceaf1711d329 100644
--- a/libcxx/include/__ranges/repeat_view.h
+++ b/libcxx/include/__ranges/repeat_view.h
@@ -15,6 +15,7 @@
#include <__concepts/same_as.h>
#include <__concepts/semiregular.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/unreachable_sentinel.h>
diff --git a/libcxx/include/__ranges/single_view.h b/libcxx/include/__ranges/single_view.h
index 45244f34994d74..955578b99cf58b 100644
--- a/libcxx/include/__ranges/single_view.h
+++ b/libcxx/include/__ranges/single_view.h
@@ -12,6 +12,8 @@
#include <__concepts/constructible.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
#include <__ranges/movable_box.h>
#include <__ranges/range_adaptor.h>
#include <__ranges/view_interface.h>
@@ -20,7 +22,6 @@
#include <__utility/forward.h>
#include <__utility/in_place.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/size.h b/libcxx/include/__ranges/size.h
index 40b0c6b6aad7a3..5da3a6ff268e80 100644
--- a/libcxx/include/__ranges/size.h
+++ b/libcxx/include/__ranges/size.h
@@ -13,6 +13,8 @@
#include <__concepts/arithmetic.h>
#include <__concepts/class_or_enum.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/access.h>
@@ -22,7 +24,6 @@
#include <__type_traits/remove_cvref.h>
#include <__utility/auto_cast.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h
index 144746babb325f..a40eab3c5a257e 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -17,6 +17,7 @@
#include <__concepts/derived_from.h>
#include <__concepts/different_from.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__fwd/subrange.h>
#include <__iterator/advance.h>
#include <__iterator/concepts.h>
@@ -40,7 +41,6 @@
#include <__type_traits/remove_const.h>
#include <__type_traits/remove_pointer.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h
index 8e2d354b58a554..39f99cee6b4dad 100644
--- a/libcxx/include/__ranges/take_view.h
+++ b/libcxx/include/__ranges/take_view.h
@@ -42,7 +42,6 @@
#include <__utility/auto_cast.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/to.h b/libcxx/include/__ranges/to.h
index 85fc580b53c9bc..0809cab3b38735 100644
--- a/libcxx/include/__ranges/to.h
+++ b/libcxx/include/__ranges/to.h
@@ -16,6 +16,7 @@
#include <__concepts/derived_from.h>
#include <__concepts/same_as.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__functional/bind_back.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/insert_iterator.h>
@@ -33,7 +34,6 @@
#include <__type_traits/type_identity.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer
index 7916769bd83bfa..26ee7d78d9d21e 100644
--- a/libcxx/include/__split_buffer
+++ b/libcxx/include/__split_buffer
@@ -14,6 +14,7 @@
#include <__algorithm/move.h>
#include <__algorithm/move_backward.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__iterator/distance.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/move_iterator.h>
@@ -35,7 +36,6 @@
#include <__type_traits/remove_reference.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__stop_token/intrusive_shared_ptr.h b/libcxx/include/__stop_token/intrusive_shared_ptr.h
index f00cea5bc2b670..d20c5227ec7291 100644
--- a/libcxx/include/__stop_token/intrusive_shared_ptr.h
+++ b/libcxx/include/__stop_token/intrusive_shared_ptr.h
@@ -13,10 +13,10 @@
#include <__atomic/atomic.h>
#include <__atomic/memory_order.h>
#include <__config>
+#include <__cstddef/nullptr_t.h>
#include <__type_traits/is_reference.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h
index 9b7d567dd3c278..33d17513d8580d 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -24,7 +24,6 @@
#include <__string/constexpr_c_functions.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__utility/is_pointer_in_range.h>
-#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <iosfwd>
diff --git a/libcxx/include/__string/constexpr_c_functions.h b/libcxx/include/__string/constexpr_c_functions.h
index 9b8871e2e71a38..16801bf2015c17 100644
--- a/libcxx/include/__string/constexpr_c_functions.h
+++ b/libcxx/include/__string/constexpr_c_functions.h
@@ -10,6 +10,7 @@
#define _LIBCPP___STRING_CONSTEXPR_C_FUNCTIONS_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__memory/addressof.h>
#include <__memory/construct_at.h>
#include <__type_traits/datasizeof.h>
@@ -25,7 +26,6 @@
#include <__type_traits/is_trivially_lexicographically_comparable.h>
#include <__type_traits/remove_cv.h>
#include <__utility/is_pointer_in_range.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__system_error/error_code.h b/libcxx/include/__system_error/error_code.h
index 475f2bb96a56d9..6fa673b4ff713b 100644
--- a/libcxx/include/__system_error/error_code.h
+++ b/libcxx/include/__system_error/error_code.h
@@ -17,7 +17,6 @@
#include <__system_error/errc.h>
#include <__system_error/error_category.h>
#include <__system_error/error_condition.h>
-#include <cstddef>
#include <string>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__system_error/error_condition.h b/libcxx/include/__system_error/error_condition.h
index 42898c1f0e9013..bfee6528c3f1d2 100644
--- a/libcxx/include/__system_error/error_condition.h
+++ b/libcxx/include/__system_error/error_condition.h
@@ -16,7 +16,6 @@
#include <__functional/unary_function.h>
#include <__system_error/errc.h>
#include <__system_error/error_category.h>
-#include <cstddef>
#include <string>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__utility/in_place.h b/libcxx/include/__utility/in_place.h
index 459b271675261c..edaa4e02c55f54 100644
--- a/libcxx/include/__utility/in_place.h
+++ b/libcxx/include/__utility/in_place.h
@@ -10,9 +10,9 @@
#define _LIBCPP___UTILITY_IN_PLACE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/remove_cvref.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__utility/integer_sequence.h b/libcxx/include/__utility/integer_sequence.h
index ccce9433e7a801..35eb606ee37f67 100644
--- a/libcxx/include/__utility/integer_sequence.h
+++ b/libcxx/include/__utility/integer_sequence.h
@@ -10,8 +10,8 @@
#define _LIBCPP___UTILITY_INTEGER_SEQUENCE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/is_integral.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 78534a3f399f25..cca6490476db11 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -13,6 +13,7 @@
#include <__compare/synth_three_way.h>
#include <__concepts/different_from.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__fwd/array.h>
#include <__fwd/pair.h>
#include <__fwd/tuple.h>
@@ -43,7 +44,6 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/piecewise_construct.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__utility/priority_tag.h b/libcxx/include/__utility/priority_tag.h
index a159ce7f1afb34..ef7cf162b9b4ca 100644
--- a/libcxx/include/__utility/priority_tag.h
+++ b/libcxx/include/__utility/priority_tag.h
@@ -10,7 +10,7 @@
#define _LIBCPP___UTILITY_PRIORITY_TAG_H
#include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__utility/small_buffer.h b/libcxx/include/__utility/small_buffer.h
index 9e13797573d2d7..70e068f89f62ed 100644
--- a/libcxx/include/__utility/small_buffer.h
+++ b/libcxx/include/__utility/small_buffer.h
@@ -10,13 +10,13 @@
#define _LIBCPP___UTILITY_SMALL_BUFFER_H
#include <__config>
+#include <__cstddef/byte.h>
#include <__memory/construct_at.h>
#include <__type_traits/decay.h>
#include <__type_traits/is_trivially_constructible.h>
#include <__type_traits/is_trivially_destructible.h>
#include <__utility/exception_guard.h>
#include <__utility/forward.h>
-#include <cstddef>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__utility/swap.h b/libcxx/include/__utility/swap.h
index ecfbdec75a2aeb..666d6d50f0d916 100644
--- a/libcxx/include/__utility/swap.h
+++ b/libcxx/include/__utility/swap.h
@@ -10,6 +10,7 @@
#define _LIBCPP___UTILITY_SWAP_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_constructible.h>
@@ -18,7 +19,6 @@
#include <__type_traits/is_swappable.h>
#include <__utility/declval.h>
#include <__utility/move.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__variant/monostate.h b/libcxx/include/__variant/monostate.h
index 16f156609eb7df..c5d2dacaf42051 100644
--- a/libcxx/include/__variant/monostate.h
+++ b/libcxx/include/__variant/monostate.h
@@ -12,8 +12,8 @@
#include <__compare/ordering.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__functional/hash.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/array b/libcxx/include/array
index 0e9af4198632d1..b1a9f0d29e68a8 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -118,6 +118,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#include <__algorithm/swap_ranges.h>
#include <__assert>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__fwd/array.h>
#include <__iterator/reverse_iterator.h>
#include <__iterator/wrap_iter.h>
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index bf65750672bb0a..153480d44b701c 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -620,6 +620,7 @@ template <class T>
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cmath>
# include <compare>
+# include <cstddef>
# include <cstdlib>
# include <cstring>
# include <type_traits>
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index abc014e8aaf5c0..36c30c7fe2e755 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -52,11 +52,11 @@ namespace std
# include <__assert>
# include <__atomic/atomic_base.h>
# include <__atomic/memory_order.h>
+# include <__cstddef/ptrdiff_t.h>
# include <__memory/unique_ptr.h>
# include <__thread/poll_with_backoff.h>
# include <__thread/timed_backoff_policy.h>
# include <__utility/move.h>
-# include <cstddef>
# include <cstdint>
# include <limits>
# include <version>
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index ce23d522168c4c..1982f073e970e4 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -136,7 +136,6 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <__functional/unary_function.h>
#include <__type_traits/is_char_like_type.h>
#include <climits>
-#include <cstddef>
#include <stdexcept>
#include <string_view>
#include <version>
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index a2e270e9316dc7..649c22fa17f4a2 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -104,6 +104,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cmath>
# include <concepts>
+# include <cstddef>
# include <cstdint>
# include <cstdlib>
# include <cstring>
diff --git a/libcxx/include/compare b/libcxx/include/compare
index 8a41835b148978..de0e4c7ec2280c 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -172,6 +172,7 @@ namespace std {
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cmath>
+# include <cstddef>
# include <type_traits>
#endif
diff --git a/libcxx/include/concepts b/libcxx/include/concepts
index e89d216a593725..6db2caebaf5b1a 100644
--- a/libcxx/include/concepts
+++ b/libcxx/include/concepts
@@ -158,11 +158,8 @@ namespace std {
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstddef>
-#endif
-
-#if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
# include <type_traits>
#endif
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index ee54388ad5aaf8..18601717768c07 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -59,6 +59,7 @@ struct suspend_always;
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <iosfwd>
# include <limits>
# include <type_traits>
diff --git a/libcxx/include/exception b/libcxx/include/exception
index 64463e02cb16aa..88eaaf06bf4a26 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -89,6 +89,7 @@ template <class E> void rethrow_if_nested(const E& e);
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <type_traits>
#endif
diff --git a/libcxx/include/experimental/__simd/aligned_tag.h b/libcxx/include/experimental/__simd/aligned_tag.h
index e364e146a60116..d208bf5c4fbb97 100644
--- a/libcxx/include/experimental/__simd/aligned_tag.h
+++ b/libcxx/include/experimental/__simd/aligned_tag.h
@@ -11,9 +11,9 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__memory/assume_aligned.h>
#include <__type_traits/remove_const.h>
-#include <cstddef>
#include <experimental/__simd/traits.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
diff --git a/libcxx/include/experimental/__simd/declaration.h b/libcxx/include/experimental/__simd/declaration.h
index 2ac7224159cf35..1b4fcf958516c9 100644
--- a/libcxx/include/experimental/__simd/declaration.h
+++ b/libcxx/include/experimental/__simd/declaration.h
@@ -11,7 +11,7 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
#include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
diff --git a/libcxx/include/experimental/__simd/reference.h b/libcxx/include/experimental/__simd/reference.h
index cba460baaa95bb..b9fe962348adc9 100644
--- a/libcxx/include/experimental/__simd/reference.h
+++ b/libcxx/include/experimental/__simd/reference.h
@@ -11,13 +11,13 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_REFERENCE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_same.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <cstddef>
#include <experimental/__simd/utility.h>
_LIBCPP_PUSH_MACROS
diff --git a/libcxx/include/experimental/__simd/scalar.h b/libcxx/include/experimental/__simd/scalar.h
index a76933e1a5849d..9d59f8096e36c7 100644
--- a/libcxx/include/experimental/__simd/scalar.h
+++ b/libcxx/include/experimental/__simd/scalar.h
@@ -12,8 +12,8 @@
#include <__assert>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>
-#include <cstddef>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/simd.h b/libcxx/include/experimental/__simd/simd.h
index 2c65d19e67b36f..69373779541c11 100644
--- a/libcxx/include/experimental/__simd/simd.h
+++ b/libcxx/include/experimental/__simd/simd.h
@@ -11,11 +11,11 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_same.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
-#include <cstddef>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/simd_mask.h b/libcxx/include/experimental/__simd/simd_mask.h
index 55273194153134..27e7d50d4956b6 100644
--- a/libcxx/include/experimental/__simd/simd_mask.h
+++ b/libcxx/include/experimental/__simd/simd_mask.h
@@ -11,9 +11,9 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_MASK_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_same.h>
-#include <cstddef>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/traits.h b/libcxx/include/experimental/__simd/traits.h
index b817df604ef72e..0bcc2eeba5ce8b 100644
--- a/libcxx/include/experimental/__simd/traits.h
+++ b/libcxx/include/experimental/__simd/traits.h
@@ -12,9 +12,9 @@
#include <__bit/bit_ceil.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_same.h>
-#include <cstddef>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/utility.h>
diff --git a/libcxx/include/experimental/__simd/utility.h b/libcxx/include/experimental/__simd/utility.h
index 0103b06b719532..2d902613a86bd0 100644
--- a/libcxx/include/experimental/__simd/utility.h
+++ b/libcxx/include/experimental/__simd/utility.h
@@ -11,6 +11,7 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_UTILITY_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/is_arithmetic.h>
#include <__type_traits/is_const.h>
#include <__type_traits/is_constant_evaluated.h>
@@ -21,7 +22,6 @@
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <__utility/integer_sequence.h>
-#include <cstddef>
#include <cstdint>
#include <limits>
diff --git a/libcxx/include/experimental/__simd/vec_ext.h b/libcxx/include/experimental/__simd/vec_ext.h
index 6c7fb8b09a467c..bb7658d927eab7 100644
--- a/libcxx/include/experimental/__simd/vec_ext.h
+++ b/libcxx/include/experimental/__simd/vec_ext.h
@@ -13,10 +13,10 @@
#include <__assert>
#include <__bit/bit_ceil.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__type_traits/integral_constant.h>
#include <__utility/forward.h>
#include <__utility/integer_sequence.h>
-#include <cstddef>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
#include <experimental/__simd/utility.h>
diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator
index e3a9c771fe61cf..2488bcfc155a8d 100644
--- a/libcxx/include/experimental/iterator
+++ b/libcxx/include/experimental/iterator
@@ -122,6 +122,7 @@ _LIBCPP_END_NAMESPACE_LFTS
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <iosfwd>
# include <type_traits>
#endif
diff --git a/libcxx/include/experimental/memory b/libcxx/include/experimental/memory
index bf8a154690af01..48e42a0a88a649 100644
--- a/libcxx/include/experimental/memory
+++ b/libcxx/include/experimental/memory
@@ -50,6 +50,8 @@ public:
*/
#include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
#include <__functional/hash.h>
#include <__functional/operations.h>
#include <__type_traits/add_lvalue_reference.h>
@@ -57,7 +59,7 @@ public:
#include <__type_traits/common_type.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_convertible.h>
-#include <cstddef>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -192,6 +194,7 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ENABLE_EXPERIMENTAL
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <limits>
#endif
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 510d374bb4bf94..8466d4e9c7ef3c 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -108,6 +108,8 @@
*/
#include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
#include <__functional/operations.h>
#include <__fwd/functional.h>
#include <__type_traits/conditional.h>
@@ -128,7 +130,7 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <cstddef>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -484,6 +486,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <type_traits>
#endif
diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index 35120b4b4aab42..1a868513d160b6 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -85,4 +85,8 @@ inline namespace parallelism_v2 {
#include <experimental/__simd/traits.h>
#include <experimental/__simd/vec_ext.h>
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+#endif
+
#endif /* _LIBCPP_EXPERIMENTAL_SIMD */
diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits
index a4bb59afaf4ac2..6980fc3c51e465 100644
--- a/libcxx/include/experimental/type_traits
+++ b/libcxx/include/experimental/type_traits
@@ -148,6 +148,10 @@ constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Ar
_LIBCPP_END_NAMESPACE_LFTS
+# if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+# endif
+
#endif /* _LIBCPP_STD_VER >= 14 */
#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */
diff --git a/libcxx/include/experimental/utility b/libcxx/include/experimental/utility
index cbc7ad140e40c1..00151b967e496d 100644
--- a/libcxx/include/experimental/utility
+++ b/libcxx/include/experimental/utility
@@ -43,4 +43,8 @@ struct _LIBCPP_TEMPLATE_VIS erased_type {};
_LIBCPP_END_NAMESPACE_LFTS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+#endif
+
#endif /* _LIBCPP_EXPERIMENTAL_UTILITY */
diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list
index 680ca1cd20d550..8b9325069c1296 100644
--- a/libcxx/include/initializer_list
+++ b/libcxx/include/initializer_list
@@ -43,7 +43,8 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
*/
#include <__config>
-#include <cstddef>
+#include <__cstddef/size_t.h>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -95,4 +96,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initia
} // namespace std
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+#endif
+
#endif // _LIBCPP_INITIALIZER_LIST
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index fca75f0a19ed1b..63fbae220b604e 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -743,6 +743,7 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <exception>
# include <new>
diff --git a/libcxx/include/latch b/libcxx/include/latch
index b56e49bc768bf9..92dadf68bcaabb 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -48,7 +48,7 @@ namespace std
# include <__atomic/atomic_base.h>
# include <__atomic/atomic_sync.h>
# include <__atomic/memory_order.h>
-# include <cstddef>
+# include <__cstddef/ptrdiff_t.h>
# include <limits>
# include <version>
@@ -124,6 +124,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
+# include <cstddef>
#endif
#endif // _LIBCPP_LATCH
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 22a1313498e73e..15ba406973c3f0 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -13,7 +13,10 @@ module std_config [system] {
module std_core [system] {
module cstddef {
module byte { header "__cstddef/byte.h" }
- module max_align_t { header "__cstddef/max_align_t.h" }
+ module max_align_t {
+ header "__cstddef/max_align_t.h"
+ export *
+ }
module nullptr_t { header "__cstddef/nullptr_t.h" }
module ptrdiff_t { header "__cstddef/ptrdiff_t.h" }
module size_t { header "__cstddef/size_t.h" }
@@ -1393,7 +1396,10 @@ module std [system] {
module indirectly_comparable { header "__iterator/indirectly_comparable.h" }
module insert_iterator { header "__iterator/insert_iterator.h" }
module istream_iterator { header "__iterator/istream_iterator.h" }
- module istreambuf_iterator { header "__iterator/istreambuf_iterator.h" }
+ module istreambuf_iterator {
+ header "__iterator/istreambuf_iterator.h"
+ export std.string.char_traits
+ }
module iter_move { header "__iterator/iter_move.h" }
module iter_swap { header "__iterator/iter_swap.h" }
module iterator_traits {
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index 02c52dd72f02b0..427fce5f3ec463 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -199,7 +199,6 @@ template<class Callable, class ...Args>
#include <__thread/id.h>
#include <__thread/support.h>
#include <__utility/forward.h>
-#include <cstddef>
#include <limits>
#ifndef _LIBCPP_CXX03_LANG
# include <tuple>
diff --git a/libcxx/include/new b/libcxx/include/new
index 3252b0bb1abcdb..79b6ee95201a28 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -87,12 +87,12 @@ void operator delete[](void* ptr, void*) noexcept;
*/
#include <__config>
+#include <__cstddef/size_t.h>
#include <__exception/exception.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_same.h>
#include <__type_traits/remove_cv.h>
#include <__verbose_abort>
-#include <cstddef>
#include <version>
#if defined(_LIBCPP_ABI_VCRUNTIME)
@@ -361,6 +361,7 @@ inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUC
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <type_traits>
#endif
diff --git a/libcxx/include/numbers b/libcxx/include/numbers
index f48ba4baf38ffd..191563c3d8a5ff 100644
--- a/libcxx/include/numbers
+++ b/libcxx/include/numbers
@@ -158,6 +158,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <cstddef>
# include <type_traits>
#endif
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index bf6317c587e2f9..98122c96459a29 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -54,10 +54,10 @@ using binary_semaphore = counting_semaphore<1>; // since C++20
# include <__atomic/atomic_sync.h>
# include <__atomic/memory_order.h>
# include <__chrono/time_point.h>
+# include <__cstddef/ptrdiff_t.h>
# include <__thread/poll_with_backoff.h>
# include <__thread/support.h>
# include <__thread/timed_backoff_policy.h>
-# include <cstddef>
# include <limits>
# include <version>
@@ -181,6 +181,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
+# include <cstddef>
#endif
#endif // _LIBCPP_SEMAPHORE
diff --git a/libcxx/include/span b/libcxx/include/span
index a32f7a372e2ae1..896a3cd890186c 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -148,6 +148,8 @@ template<class R>
#include <__concepts/convertible_to.h>
#include <__concepts/equality_comparable.h>
#include <__config>
+#include <__cstddef/byte.h>
+#include <__cstddef/ptrdiff_t.h>
#include <__fwd/array.h>
#include <__fwd/span.h>
#include <__iterator/bounded_iter.h>
@@ -173,7 +175,6 @@ template<class R>
#include <__type_traits/remove_reference.h>
#include <__type_traits/type_identity.h>
#include <__utility/forward.h>
-#include <cstddef> // for byte
#include <initializer_list>
#include <stdexcept>
#include <version>
diff --git a/libcxx/include/stdexcept b/libcxx/include/stdexcept
index bdfc27aeac3742..b848537730b43b 100644
--- a/libcxx/include/stdexcept
+++ b/libcxx/include/stdexcept
@@ -278,6 +278,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <exception>
# include <iosfwd>
diff --git a/libcxx/include/stop_token b/libcxx/include/stop_token
index d4e651d9541f4e..cf8d0cf9b91916 100644
--- a/libcxx/include/stop_token
+++ b/libcxx/include/stop_token
@@ -50,6 +50,7 @@ namespace std {
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <iosfwd>
#endif
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 3b32117386388c..2a3e4da1976b05 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -208,6 +208,8 @@ namespace std {
#include <__algorithm/min.h>
#include <__assert>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
+#include <__cstddef/size_t.h>
#include <__functional/hash.h>
#include <__functional/unary_function.h>
#include <__fwd/ostream.h>
@@ -233,7 +235,6 @@ namespace std {
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_reference.h>
#include <__type_traits/type_identity.h>
-#include <cstddef>
#include <iosfwd>
#include <limits>
#include <stdexcept>
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index e7e14b8d12d42a..c3f7b8041686d1 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -214,6 +214,7 @@ template <class... Types>
#include <__compare/ordering.h>
#include <__compare/synth_three_way.h>
#include <__config>
+#include <__cstddef/size_t.h>
#include <__fwd/array.h>
#include <__fwd/pair.h>
#include <__fwd/tuple.h>
@@ -262,7 +263,6 @@ template <class... Types>
#include <__utility/move.h>
#include <__utility/piecewise_construct.h>
#include <__utility/swap.h>
-#include <cstddef>
#include <version>
// standard-mandated includes
@@ -1411,6 +1411,7 @@ _LIBCPP_POP_MACROS
// clang-format on
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <exception>
# include <iosfwd>
# include <new>
diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex
index 6398aa40d616a7..9f8e65befcba41 100644
--- a/libcxx/include/typeindex
+++ b/libcxx/include/typeindex
@@ -98,6 +98,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<type_index> : public __unary_function<type_inde
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <iosfwd>
# include <new>
# include <utility>
diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo
index a44fa4d73ee580..4a7a88723f86ae 100644
--- a/libcxx/include/typeinfo
+++ b/libcxx/include/typeinfo
@@ -57,12 +57,13 @@ public:
*/
#include <__config>
+#include <__cstddef/size_t.h>
#include <__exception/exception.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__verbose_abort>
-#include <cstddef>
#include <cstdint>
+#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -383,6 +384,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <type_traits>
#endif
diff --git a/libcxx/include/utility b/libcxx/include/utility
index f97907fbf72e9d..138cc3ba31893e 100644
--- a/libcxx/include/utility
+++ b/libcxx/include/utility
@@ -301,6 +301,7 @@ template <class T>
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <iosfwd>
# include <type_traits>
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index 44341eb2ba6c14..c8c520d35b335b 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -352,6 +352,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <__algorithm/unwrap_iter.h>
#include <__assert>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__functional/operations.h>
#include <__memory/addressof.h>
#include <__memory/allocator.h>
@@ -361,7 +362,6 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <__utility/move.h>
#include <__utility/swap.h>
#include <cmath>
-#include <cstddef>
#include <new>
#include <version>
diff --git a/libcxx/include/variant b/libcxx/include/variant
index fd3aebaea0e14a..f7a495e912198e 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1631,6 +1631,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <exception>
# include <tuple>
# include <type_traits>
diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp
index d2ff3509c5a31e..ba966495a91ea3 100644
--- a/libcxx/src/memory_resource.cpp
+++ b/libcxx/src/memory_resource.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include <cstddef>
#include <memory>
#include <memory_resource>
diff --git a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index c1acc100a66098..4e51014f20b18b 100644
--- a/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -26,6 +26,7 @@
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
#include <algorithm>
+#include <cstddef>
#include <vector>
#include "test_macros.h"
diff --git a/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp b/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp
index f295b807864ead..2a85e7b5ddcc37 100644
--- a/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/alg.modifying.operations/copy_move_unwrap_reverse.pass.cpp
@@ -15,9 +15,9 @@
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include <cstdint>
#include <iterator>
-#include <ranges>
#include <type_traits>
#include "test_iterators.h"
diff --git a/libcxx/test/libcxx/algorithms/robust_against_using_non_transparent_comparators.pass.cpp b/libcxx/test/libcxx/algorithms/robust_against_using_non_transparent_comparators.pass.cpp
index eaa5d44385be63..39870ebe7ff02d 100644
--- a/libcxx/test/libcxx/algorithms/robust_against_using_non_transparent_comparators.pass.cpp
+++ b/libcxx/test/libcxx/algorithms/robust_against_using_non_transparent_comparators.pass.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include <iterator>
#include "test_macros.h"
diff --git a/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp
index e9b9cde64ee91a..b31775a873481d 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/asan_turning_off.pass.cpp
@@ -17,6 +17,7 @@
// This test confirms that those allocators work after turning off annotations.
#include <cassert>
+#include <cstddef>
#include <deque>
#include <new>
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index 506b5cd02c4495..a03736ef0e04f6 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -7,6 +7,7 @@ algorithm compare
algorithm concepts
algorithm cstddef
algorithm cstdint
+algorithm cstdio
algorithm cstdlib
algorithm cstring
algorithm ctime
@@ -86,6 +87,7 @@ array compare
array concepts
array cstddef
array cstdint
+array cstdio
array cstdlib
array cstring
array ctime
@@ -1138,13 +1140,17 @@ istream utility
istream variant
istream vector
istream version
+iterator cctype
iterator cmath
iterator compare
iterator concepts
iterator cstddef
iterator cstdint
+iterator cstdio
iterator cstdlib
iterator cstring
+iterator cwchar
+iterator cwctype
iterator exception
iterator initializer_list
iterator iosfwd
@@ -1354,15 +1360,19 @@ mdspan variant
mdspan vector
mdspan version
memory atomic
+memory cctype
memory climits
memory cmath
memory compare
memory concepts
memory cstddef
memory cstdint
+memory cstdio
memory cstdlib
memory cstring
memory ctime
+memory cwchar
+memory cwctype
memory exception
memory initializer_list
memory iosfwd
@@ -1508,15 +1518,19 @@ numeric variant
numeric vector
numeric version
optional atomic
+optional cctype
optional climits
optional cmath
optional compare
optional concepts
optional cstddef
optional cstdint
+optional cstdio
optional cstdlib
optional cstring
optional ctime
+optional cwchar
+optional cwctype
optional exception
optional initializer_list
optional iosfwd
@@ -1828,15 +1842,19 @@ regex variant
regex vector
regex version
scoped_allocator atomic
+scoped_allocator cctype
scoped_allocator climits
scoped_allocator cmath
scoped_allocator compare
scoped_allocator concepts
scoped_allocator cstddef
scoped_allocator cstdint
+scoped_allocator cstdio
scoped_allocator cstdlib
scoped_allocator cstring
scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
scoped_allocator exception
scoped_allocator initializer_list
scoped_allocator iosfwd
@@ -2456,6 +2474,7 @@ unordered_map compare
unordered_map concepts
unordered_map cstddef
unordered_map cstdint
+unordered_map cstdio
unordered_map cstdlib
unordered_map cstring
unordered_map ctime
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index 506b5cd02c4495..a03736ef0e04f6 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -7,6 +7,7 @@ algorithm compare
algorithm concepts
algorithm cstddef
algorithm cstdint
+algorithm cstdio
algorithm cstdlib
algorithm cstring
algorithm ctime
@@ -86,6 +87,7 @@ array compare
array concepts
array cstddef
array cstdint
+array cstdio
array cstdlib
array cstring
array ctime
@@ -1138,13 +1140,17 @@ istream utility
istream variant
istream vector
istream version
+iterator cctype
iterator cmath
iterator compare
iterator concepts
iterator cstddef
iterator cstdint
+iterator cstdio
iterator cstdlib
iterator cstring
+iterator cwchar
+iterator cwctype
iterator exception
iterator initializer_list
iterator iosfwd
@@ -1354,15 +1360,19 @@ mdspan variant
mdspan vector
mdspan version
memory atomic
+memory cctype
memory climits
memory cmath
memory compare
memory concepts
memory cstddef
memory cstdint
+memory cstdio
memory cstdlib
memory cstring
memory ctime
+memory cwchar
+memory cwctype
memory exception
memory initializer_list
memory iosfwd
@@ -1508,15 +1518,19 @@ numeric variant
numeric vector
numeric version
optional atomic
+optional cctype
optional climits
optional cmath
optional compare
optional concepts
optional cstddef
optional cstdint
+optional cstdio
optional cstdlib
optional cstring
optional ctime
+optional cwchar
+optional cwctype
optional exception
optional initializer_list
optional iosfwd
@@ -1828,15 +1842,19 @@ regex variant
regex vector
regex version
scoped_allocator atomic
+scoped_allocator cctype
scoped_allocator climits
scoped_allocator cmath
scoped_allocator compare
scoped_allocator concepts
scoped_allocator cstddef
scoped_allocator cstdint
+scoped_allocator cstdio
scoped_allocator cstdlib
scoped_allocator cstring
scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
scoped_allocator exception
scoped_allocator initializer_list
scoped_allocator iosfwd
@@ -2456,6 +2474,7 @@ unordered_map compare
unordered_map concepts
unordered_map cstddef
unordered_map cstdint
+unordered_map cstdio
unordered_map cstdlib
unordered_map cstring
unordered_map ctime
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index 828e1d62c6ec3e..216d12765366c3 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -7,6 +7,7 @@ algorithm compare
algorithm concepts
algorithm cstddef
algorithm cstdint
+algorithm cstdio
algorithm cstdlib
algorithm cstring
algorithm ctime
@@ -88,6 +89,7 @@ array compare
array concepts
array cstddef
array cstdint
+array cstdio
array cstdlib
array cstring
array ctime
@@ -1165,13 +1167,17 @@ istream utility
istream variant
istream vector
istream version
+iterator cctype
iterator cmath
iterator compare
iterator concepts
iterator cstddef
iterator cstdint
+iterator cstdio
iterator cstdlib
iterator cstring
+iterator cwchar
+iterator cwctype
iterator exception
iterator initializer_list
iterator iosfwd
@@ -1385,15 +1391,19 @@ mdspan variant
mdspan vector
mdspan version
memory atomic
+memory cctype
memory climits
memory cmath
memory compare
memory concepts
memory cstddef
memory cstdint
+memory cstdio
memory cstdlib
memory cstring
memory ctime
+memory cwchar
+memory cwctype
memory exception
memory initializer_list
memory iosfwd
@@ -1541,15 +1551,19 @@ numeric variant
numeric vector
numeric version
optional atomic
+optional cctype
optional climits
optional cmath
optional compare
optional concepts
optional cstddef
optional cstdint
+optional cstdio
optional cstdlib
optional cstring
optional ctime
+optional cwchar
+optional cwctype
optional exception
optional initializer_list
optional iosfwd
@@ -1866,15 +1880,19 @@ regex variant
regex vector
regex version
scoped_allocator atomic
+scoped_allocator cctype
scoped_allocator climits
scoped_allocator cmath
scoped_allocator compare
scoped_allocator concepts
scoped_allocator cstddef
scoped_allocator cstdint
+scoped_allocator cstdio
scoped_allocator cstdlib
scoped_allocator cstring
scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
scoped_allocator exception
scoped_allocator initializer_list
scoped_allocator iosfwd
@@ -2506,6 +2524,7 @@ unordered_map compare
unordered_map concepts
unordered_map cstddef
unordered_map cstdint
+unordered_map cstdio
unordered_map cstdlib
unordered_map cstring
unordered_map ctime
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 0bee6e9beb7af1..232dd27ec666d2 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -7,6 +7,7 @@ algorithm compare
algorithm concepts
algorithm cstddef
algorithm cstdint
+algorithm cstdio
algorithm cstdlib
algorithm cstring
algorithm ctime
@@ -86,6 +87,7 @@ array compare
array concepts
array cstddef
array cstdint
+array cstdio
array cstdlib
array cstring
array ctime
@@ -1162,13 +1164,17 @@ istream utility
istream variant
istream vector
istream version
+iterator cctype
iterator cmath
iterator compare
iterator concepts
iterator cstddef
iterator cstdint
+iterator cstdio
iterator cstdlib
iterator cstring
+iterator cwchar
+iterator cwctype
iterator exception
iterator initializer_list
iterator iosfwd
@@ -1378,15 +1384,19 @@ mdspan variant
mdspan vector
mdspan version
memory atomic
+memory cctype
memory climits
memory cmath
memory compare
memory concepts
memory cstddef
memory cstdint
+memory cstdio
memory cstdlib
memory cstring
memory ctime
+memory cwchar
+memory cwctype
memory exception
memory initializer_list
memory iosfwd
@@ -1532,15 +1542,19 @@ numeric variant
numeric vector
numeric version
optional atomic
+optional cctype
optional climits
optional cmath
optional compare
optional concepts
optional cstddef
optional cstdint
+optional cstdio
optional cstdlib
optional cstring
optional ctime
+optional cwchar
+optional cwctype
optional exception
optional initializer_list
optional iosfwd
@@ -1852,15 +1866,19 @@ regex variant
regex vector
regex version
scoped_allocator atomic
+scoped_allocator cctype
scoped_allocator climits
scoped_allocator cmath
scoped_allocator compare
scoped_allocator concepts
scoped_allocator cstddef
scoped_allocator cstdint
+scoped_allocator cstdio
scoped_allocator cstdlib
scoped_allocator cstring
scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
scoped_allocator exception
scoped_allocator initializer_list
scoped_allocator iosfwd
@@ -2480,6 +2498,7 @@ unordered_map compare
unordered_map concepts
unordered_map cstddef
unordered_map cstdint
+unordered_map cstdio
unordered_map cstdlib
unordered_map cstring
unordered_map ctime
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 026c26f3bd9819..97c6a0b0545edb 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -7,6 +7,7 @@ algorithm compare
algorithm concepts
algorithm cstddef
algorithm cstdint
+algorithm cstdio
algorithm cstdlib
algorithm cstring
algorithm ctime
@@ -29,15 +30,19 @@ algorithm utility
algorithm variant
algorithm version
any atomic
+any cctype
any climits
any cmath
any compare
any concepts
any cstddef
any cstdint
+any cstdio
any cstdlib
any cstring
any ctime
+any cwchar
+any cwctype
any exception
any initializer_list
any iosfwd
@@ -63,6 +68,7 @@ array compare
array concepts
array cstddef
array cstdint
+array cstdio
array cstdlib
array cstring
array ctime
@@ -97,15 +103,19 @@ atomic ratio
atomic type_traits
atomic version
barrier atomic
+barrier cctype
barrier climits
barrier cmath
barrier compare
barrier concepts
barrier cstddef
barrier cstdint
+barrier cstdio
barrier cstdlib
barrier cstring
barrier ctime
+barrier cwchar
+barrier cwctype
barrier exception
barrier initializer_list
barrier iosfwd
@@ -1148,13 +1158,17 @@ istream utility
istream variant
istream vector
istream version
+iterator cctype
iterator cmath
iterator compare
iterator concepts
iterator cstddef
iterator cstdint
+iterator cstdio
iterator cstdlib
iterator cstring
+iterator cwchar
+iterator cwctype
iterator exception
iterator initializer_list
iterator iosfwd
@@ -1364,15 +1378,19 @@ mdspan variant
mdspan vector
mdspan version
memory atomic
+memory cctype
memory climits
memory cmath
memory compare
memory concepts
memory cstddef
memory cstdint
+memory cstdio
memory cstdlib
memory cstring
memory ctime
+memory cwchar
+memory cwctype
memory exception
memory initializer_list
memory iosfwd
@@ -1518,15 +1536,19 @@ numeric variant
numeric vector
numeric version
optional atomic
+optional cctype
optional climits
optional cmath
optional compare
optional concepts
optional cstddef
optional cstdint
+optional cstdio
optional cstdlib
optional cstring
optional ctime
+optional cwchar
+optional cwctype
optional exception
optional initializer_list
optional iosfwd
@@ -1838,15 +1860,19 @@ regex variant
regex vector
regex version
scoped_allocator atomic
+scoped_allocator cctype
scoped_allocator climits
scoped_allocator cmath
scoped_allocator compare
scoped_allocator concepts
scoped_allocator cstddef
scoped_allocator cstdint
+scoped_allocator cstdio
scoped_allocator cstdlib
scoped_allocator cstring
scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
scoped_allocator exception
scoped_allocator initializer_list
scoped_allocator iosfwd
@@ -2476,6 +2502,7 @@ unordered_map compare
unordered_map concepts
unordered_map cstddef
unordered_map cstdint
+unordered_map cstdio
unordered_map cstdlib
unordered_map cstring
unordered_map ctime
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 861fd2bb9ba98f..7aca73f20863fc 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -1,7 +1,6 @@
algorithm cctype
algorithm climits
algorithm compare
-algorithm cstddef
algorithm cstdint
algorithm cstring
algorithm ctime
@@ -15,7 +14,6 @@ algorithm optional
algorithm ratio
algorithm tuple
algorithm version
-any cstddef
any cstdint
any cstring
any initializer_list
@@ -25,7 +23,6 @@ any typeinfo
any version
array cctype
array compare
-array cstddef
array cstdint
array cwchar
array cwctype
@@ -35,7 +32,6 @@ array new
array stdexcept
array version
atomic climits
-atomic cstddef
atomic cstdint
atomic cstring
atomic ctime
@@ -43,7 +39,6 @@ atomic limits
atomic ratio
atomic version
barrier climits
-barrier cstddef
barrier cstdint
barrier cstring
barrier ctime
@@ -57,7 +52,6 @@ bit version
bitset cctype
bitset climits
bitset compare
-bitset cstddef
bitset cstdint
bitset cstdio
bitset cstring
@@ -105,7 +99,6 @@ ccomplex tuple
ccomplex typeinfo
ccomplex version
charconv cerrno
-charconv cstddef
charconv cstdint
charconv initializer_list
charconv limits
@@ -171,7 +164,6 @@ codecvt string_view
codecvt tuple
codecvt typeinfo
codecvt version
-compare cstddef
compare cstdint
compare limits
compare version
@@ -206,14 +198,12 @@ complex string_view
complex tuple
complex typeinfo
complex version
-concepts cstddef
concepts version
condition_variable atomic
condition_variable cctype
condition_variable cerrno
condition_variable climits
condition_variable compare
-condition_variable cstddef
condition_variable cstdint
condition_variable cstdio
condition_variable cstring
@@ -232,7 +222,6 @@ condition_variable tuple
condition_variable typeinfo
condition_variable version
coroutine compare
-coroutine cstddef
coroutine cstdint
coroutine cstring
coroutine limits
@@ -276,7 +265,6 @@ cwchar cwctype
cwctype cctype
deque cctype
deque compare
-deque cstddef
deque cstdint
deque cstring
deque cwchar
@@ -287,14 +275,12 @@ deque new
deque stdexcept
deque tuple
deque version
-exception cstddef
exception cstdint
exception cstdlib
exception new
exception typeinfo
exception version
execution version
-expected cstddef
expected cstdint
expected initializer_list
expected new
@@ -306,7 +292,6 @@ experimental/iterator climits
experimental/iterator clocale
experimental/iterator compare
experimental/iterator concepts
-experimental/iterator cstddef
experimental/iterator cstdint
experimental/iterator cstdio
experimental/iterator cstdlib
@@ -330,23 +315,18 @@ experimental/iterator tuple
experimental/iterator typeinfo
experimental/iterator variant
experimental/iterator version
-experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
experimental/memory version
-experimental/propagate_const cstddef
experimental/propagate_const version
-experimental/simd cstddef
experimental/simd cstdint
experimental/simd limits
experimental/simd version
-experimental/type_traits cstddef
experimental/type_traits cstdint
experimental/type_traits initializer_list
experimental/type_traits type_traits
experimental/type_traits version
experimental/utility compare
-experimental/utility cstddef
experimental/utility cstdint
experimental/utility initializer_list
experimental/utility limits
@@ -409,7 +389,6 @@ format typeinfo
format version
forward_list cctype
forward_list compare
-forward_list cstddef
forward_list cstdint
forward_list cwchar
forward_list cwctype
@@ -515,7 +494,6 @@ future thread
future tuple
future typeinfo
future version
-initializer_list cstddef
initializer_list version
iomanip bitset
iomanip cctype
@@ -634,11 +612,14 @@ istream string_view
istream tuple
istream typeinfo
istream version
+iterator cctype
iterator compare
iterator concepts
-iterator cstddef
iterator cstdint
+iterator cstdio
iterator cstring
+iterator cwchar
+iterator cwctype
iterator initializer_list
iterator iosfwd
iterator limits
@@ -646,7 +627,6 @@ iterator new
iterator variant
iterator version
latch climits
-latch cstddef
latch cstdint
latch cstring
latch ctime
@@ -656,7 +636,6 @@ latch version
limits version
list cctype
list compare
-list cstddef
list cstdint
list cstring
list cwchar
@@ -694,7 +673,6 @@ locale typeinfo
locale version
map cctype
map compare
-map cstddef
map cstdint
map cstring
map cwchar
@@ -708,10 +686,8 @@ map tuple
map version
mdspan array
mdspan cctype
-mdspan cinttypes
mdspan compare
mdspan concepts
-mdspan cstddef
mdspan cstdint
mdspan cwchar
mdspan cwctype
@@ -722,7 +698,6 @@ mdspan span
mdspan stdexcept
mdspan version
memory compare
-memory cstddef
memory cstdint
memory cstring
memory initializer_list
@@ -735,7 +710,6 @@ memory_resource cctype
memory_resource cerrno
memory_resource climits
memory_resource compare
-memory_resource cstddef
memory_resource cstdint
memory_resource cstdio
memory_resource cstring
@@ -758,7 +732,6 @@ mutex cctype
mutex cerrno
mutex climits
mutex compare
-mutex cstddef
mutex cstdint
mutex cstdio
mutex cstring
@@ -776,12 +749,10 @@ mutex string_view
mutex tuple
mutex typeinfo
mutex version
-new cstddef
new version
numbers version
numeric climits
numeric compare
-numeric cstddef
numeric cstdint
numeric cstring
numeric ctime
@@ -793,7 +764,6 @@ numeric ratio
numeric tuple
numeric version
optional compare
-optional cstddef
optional cstdint
optional cstring
optional initializer_list
@@ -916,8 +886,8 @@ random version
ranges cctype
ranges compare
ranges concepts
-ranges cstddef
ranges cstdint
+ranges cstdio
ranges cstring
ranges cwchar
ranges cwctype
@@ -961,14 +931,12 @@ regex typeinfo
regex vector
regex version
scoped_allocator compare
-scoped_allocator cstddef
scoped_allocator cstdint
scoped_allocator limits
scoped_allocator new
scoped_allocator tuple
scoped_allocator version
semaphore climits
-semaphore cstddef
semaphore cstdint
semaphore cstring
semaphore ctime
@@ -977,7 +945,6 @@ semaphore ratio
semaphore version
set cctype
set compare
-set cstddef
set cstdint
set cstring
set cwchar
@@ -992,7 +959,6 @@ shared_mutex cctype
shared_mutex cerrno
shared_mutex climits
shared_mutex compare
-shared_mutex cstddef
shared_mutex cstdint
shared_mutex cstdio
shared_mutex cstring
@@ -1011,7 +977,6 @@ shared_mutex tuple
shared_mutex version
source_location cstdint
source_location version
-span cstddef
span initializer_list
span limits
span stdexcept
@@ -1047,7 +1012,6 @@ sstream typeinfo
sstream version
stack cctype
stack compare
-stack cstddef
stack cstdint
stack cstring
stack cwchar
@@ -1061,7 +1025,6 @@ stack tuple
stack version
stop_token atomic
stop_token climits
-stop_token cstddef
stop_token cstdint
stop_token cstring
stop_token ctime
@@ -1096,7 +1059,6 @@ streambuf version
string cctype
string climits
string compare
-string cstddef
string cstdint
string cstdio
string cstring
@@ -1112,7 +1074,6 @@ string tuple
string version
string_view cctype
string_view compare
-string_view cstddef
string_view cstdint
string_view cstdio
string_view cstring
@@ -1200,7 +1161,6 @@ system_error cctype
system_error cerrno
system_error climits
system_error compare
-system_error cstddef
system_error cstdint
system_error cstdio
system_error cstring
@@ -1248,23 +1208,19 @@ thread tuple
thread typeinfo
thread version
tuple compare
-tuple cstddef
tuple cstdint
tuple limits
tuple version
type_traits cstdint
type_traits version
typeindex compare
-typeindex cstddef
typeindex cstdint
typeindex limits
typeindex typeinfo
typeindex version
-typeinfo cstddef
typeinfo cstdint
typeinfo version
unordered_map compare
-unordered_map cstddef
unordered_map cstdint
unordered_map cstring
unordered_map initializer_list
@@ -1275,7 +1231,6 @@ unordered_map stdexcept
unordered_map tuple
unordered_map version
unordered_set compare
-unordered_set cstddef
unordered_set cstdint
unordered_set cstring
unordered_set initializer_list
@@ -1285,20 +1240,17 @@ unordered_set optional
unordered_set tuple
unordered_set version
utility compare
-utility cstddef
utility cstdint
utility initializer_list
utility limits
utility version
valarray cmath
-valarray cstddef
valarray cstdint
valarray initializer_list
valarray limits
valarray new
valarray version
variant compare
-variant cstddef
variant cstdint
variant cstring
variant initializer_list
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index a31139f1ee8565..1dfb218638c2a9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -1,7 +1,6 @@
algorithm cctype
algorithm climits
algorithm compare
-algorithm cstddef
algorithm cstdint
algorithm cstring
algorithm ctime
@@ -15,7 +14,6 @@ algorithm optional
algorithm ratio
algorithm tuple
algorithm version
-any cstddef
any cstdint
any cstring
any initializer_list
@@ -25,7 +23,6 @@ any typeinfo
any version
array cctype
array compare
-array cstddef
array cstdint
array cwchar
array cwctype
@@ -35,7 +32,6 @@ array new
array stdexcept
array version
atomic climits
-atomic cstddef
atomic cstdint
atomic cstring
atomic ctime
@@ -43,7 +39,6 @@ atomic limits
atomic ratio
atomic version
barrier climits
-barrier cstddef
barrier cstdint
barrier cstring
barrier ctime
@@ -57,7 +52,6 @@ bit version
bitset cctype
bitset climits
bitset compare
-bitset cstddef
bitset cstdint
bitset cstdio
bitset cstring
@@ -105,7 +99,6 @@ ccomplex tuple
ccomplex typeinfo
ccomplex version
charconv cerrno
-charconv cstddef
charconv cstdint
charconv initializer_list
charconv limits
@@ -171,7 +164,6 @@ codecvt string_view
codecvt tuple
codecvt typeinfo
codecvt version
-compare cstddef
compare cstdint
compare limits
compare version
@@ -206,14 +198,12 @@ complex string_view
complex tuple
complex typeinfo
complex version
-concepts cstddef
concepts version
condition_variable atomic
condition_variable cctype
condition_variable cerrno
condition_variable climits
condition_variable compare
-condition_variable cstddef
condition_variable cstdint
condition_variable cstdio
condition_variable cstring
@@ -232,7 +222,6 @@ condition_variable tuple
condition_variable typeinfo
condition_variable version
coroutine compare
-coroutine cstddef
coroutine cstdint
coroutine cstring
coroutine limits
@@ -276,7 +265,6 @@ cwchar cwctype
cwctype cctype
deque cctype
deque compare
-deque cstddef
deque cstdint
deque cstring
deque cwchar
@@ -287,14 +275,12 @@ deque new
deque stdexcept
deque tuple
deque version
-exception cstddef
exception cstdint
exception cstdlib
exception new
exception typeinfo
exception version
execution version
-expected cstddef
expected cstdint
expected initializer_list
expected new
@@ -330,23 +316,18 @@ experimental/iterator tuple
experimental/iterator typeinfo
experimental/iterator variant
experimental/iterator version
-experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
experimental/memory version
-experimental/propagate_const cstddef
experimental/propagate_const version
-experimental/simd cstddef
experimental/simd cstdint
experimental/simd limits
experimental/simd version
-experimental/type_traits cstddef
experimental/type_traits cstdint
experimental/type_traits initializer_list
experimental/type_traits type_traits
experimental/type_traits version
experimental/utility compare
-experimental/utility cstddef
experimental/utility cstdint
experimental/utility initializer_list
experimental/utility limits
@@ -409,7 +390,6 @@ format typeinfo
format version
forward_list cctype
forward_list compare
-forward_list cstddef
forward_list cstdint
forward_list cwchar
forward_list cwctype
@@ -514,7 +494,6 @@ future thread
future tuple
future typeinfo
future version
-initializer_list cstddef
initializer_list version
iomanip bitset
iomanip cctype
@@ -633,11 +612,14 @@ istream string_view
istream tuple
istream typeinfo
istream version
+iterator cctype
iterator compare
iterator concepts
-iterator cstddef
iterator cstdint
+iterator cstdio
iterator cstring
+iterator cwchar
+iterator cwctype
iterator initializer_list
iterator iosfwd
iterator limits
@@ -645,7 +627,6 @@ iterator new
iterator variant
iterator version
latch climits
-latch cstddef
latch cstdint
latch cstring
latch ctime
@@ -655,7 +636,6 @@ latch version
limits version
list cctype
list compare
-list cstddef
list cstdint
list cstring
list cwchar
@@ -693,7 +673,6 @@ locale typeinfo
locale version
map cctype
map compare
-map cstddef
map cstdint
map cstring
map cwchar
@@ -707,10 +686,8 @@ map tuple
map version
mdspan array
mdspan cctype
-mdspan cinttypes
mdspan compare
mdspan concepts
-mdspan cstddef
mdspan cstdint
mdspan cwchar
mdspan cwctype
@@ -721,7 +698,6 @@ mdspan span
mdspan stdexcept
mdspan version
memory compare
-memory cstddef
memory cstdint
memory cstring
memory initializer_list
@@ -734,7 +710,6 @@ memory_resource cctype
memory_resource cerrno
memory_resource climits
memory_resource compare
-memory_resource cstddef
memory_resource cstdint
memory_resource cstdio
memory_resource cstring
@@ -757,7 +732,6 @@ mutex cctype
mutex cerrno
mutex climits
mutex compare
-mutex cstddef
mutex cstdint
mutex cstdio
mutex cstring
@@ -775,12 +749,10 @@ mutex string_view
mutex tuple
mutex typeinfo
mutex version
-new cstddef
new version
numbers version
numeric climits
numeric compare
-numeric cstddef
numeric cstdint
numeric cstring
numeric ctime
@@ -792,7 +764,6 @@ numeric ratio
numeric tuple
numeric version
optional compare
-optional cstddef
optional cstdint
optional cstring
optional initializer_list
@@ -915,8 +886,8 @@ random version
ranges cctype
ranges compare
ranges concepts
-ranges cstddef
ranges cstdint
+ranges cstdio
ranges cstring
ranges cwchar
ranges cwctype
@@ -960,14 +931,12 @@ regex typeinfo
regex vector
regex version
scoped_allocator compare
-scoped_allocator cstddef
scoped_allocator cstdint
scoped_allocator limits
scoped_allocator new
scoped_allocator tuple
scoped_allocator version
semaphore climits
-semaphore cstddef
semaphore cstdint
semaphore cstring
semaphore ctime
@@ -976,7 +945,6 @@ semaphore ratio
semaphore version
set cctype
set compare
-set cstddef
set cstdint
set cstring
set cwchar
@@ -991,7 +959,6 @@ shared_mutex cctype
shared_mutex cerrno
shared_mutex climits
shared_mutex compare
-shared_mutex cstddef
shared_mutex cstdint
shared_mutex cstdio
shared_mutex cstring
@@ -1010,7 +977,6 @@ shared_mutex tuple
shared_mutex version
source_location cstdint
source_location version
-span cstddef
span initializer_list
span limits
span stdexcept
@@ -1046,7 +1012,6 @@ sstream typeinfo
sstream version
stack cctype
stack compare
-stack cstddef
stack cstdint
stack cstring
stack cwchar
@@ -1060,7 +1025,6 @@ stack tuple
stack version
stop_token atomic
stop_token climits
-stop_token cstddef
stop_token cstdint
stop_token cstring
stop_token ctime
@@ -1095,7 +1059,6 @@ streambuf version
string cctype
string climits
string compare
-string cstddef
string cstdint
string cstdio
string cstring
@@ -1111,7 +1074,6 @@ string tuple
string version
string_view cctype
string_view compare
-string_view cstddef
string_view cstdint
string_view cstdio
string_view cstring
@@ -1199,7 +1161,6 @@ system_error cctype
system_error cerrno
system_error climits
system_error compare
-system_error cstddef
system_error cstdint
system_error cstdio
system_error cstring
@@ -1247,23 +1208,19 @@ thread tuple
thread typeinfo
thread version
tuple compare
-tuple cstddef
tuple cstdint
tuple limits
tuple version
type_traits cstdint
type_traits version
typeindex compare
-typeindex cstddef
typeindex cstdint
typeindex limits
typeindex typeinfo
typeindex version
-typeinfo cstddef
typeinfo cstdint
typeinfo version
unordered_map compare
-unordered_map cstddef
unordered_map cstdint
unordered_map cstring
unordered_map initializer_list
@@ -1274,7 +1231,6 @@ unordered_map stdexcept
unordered_map tuple
unordered_map version
unordered_set compare
-unordered_set cstddef
unordered_set cstdint
unordered_set cstring
unordered_set initializer_list
@@ -1284,20 +1240,17 @@ unordered_set optional
unordered_set tuple
unordered_set version
utility compare
-utility cstddef
utility cstdint
utility initializer_list
utility limits
utility version
valarray cmath
-valarray cstddef
valarray cstdint
valarray initializer_list
valarray limits
valarray new
valarray version
variant compare
-variant cstddef
variant cstdint
variant cstring
variant initializer_list
diff --git a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp b/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
index 42deaaa4b2d37e..214b0eff8d9d26 100644
--- a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
+++ b/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
@@ -6,16 +6,12 @@
//
//===----------------------------------------------------------------------===//
-// test that <bitset> includes <cstddef>, <string>, <stdexcept> and <iosfwd>
+// test that <bitset> includes <string>, <stdexcept> and <iosfwd>
#include <bitset>
#include "test_macros.h"
-#ifndef _LIBCPP_CSTDDEF
-#error <cstddef> has not been included
-#endif
-
#ifndef _LIBCPP_STRING
#error <string> has not been included
#endif
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp
index 7654a4b0c7f007..7250c49a7ff952 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include <vector>
#include "test_macros.h"
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/ranges.count.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/ranges.count.pass.cpp
index b6631add7e48a7..6030bed47ec6a7 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/ranges.count.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/ranges.count.pass.cpp
@@ -25,6 +25,7 @@
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
#include <ranges>
#include <vector>
diff --git a/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp
index 0926628a2e9a89..dbe1841762f201 100644
--- a/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp
@@ -65,9 +65,10 @@
// };
#include <atomic>
+#include <cassert>
+#include <cstddef>
#include <new>
#include <type_traits>
-#include <cassert>
#include <cmpxchg_loop.h>
diff --git a/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
index 9b9bac27174e0f..f9c8f645b284f4 100644
--- a/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.callable/concept.invocable/invocable.compile.pass.cpp
@@ -11,8 +11,8 @@
// template<class T, class U>
// concept invocable;
-#include <chrono>
#include <concepts>
+#include <cstddef>
#include <functional>
#include <memory>
#include <random>
diff --git a/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
index bfd20751861d12..f3547a3ad97cbe 100644
--- a/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.callable/concept.regularinvocable/regular_invocable.compile.pass.cpp
@@ -11,11 +11,10 @@
// template<class T, class U>
// concept regular_invocable;
-#include <chrono>
#include <concepts>
+#include <cstddef>
#include <functional>
#include <memory>
-#include <random>
#include <type_traits>
template <class R, class... Args>
diff --git a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
index 126606ef7ab3cd..ca0f40eb77d49e 100644
--- a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable.compile.pass.cpp
@@ -14,11 +14,11 @@
#include <concepts>
#include <array>
+#include <cstddef>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
-#include <memory>
#include <optional>
#include <set>
#include <unordered_map>
diff --git a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp
index e0edd1f332f811..0afbe582ba8966 100644
--- a/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp
@@ -14,15 +14,12 @@
#include <concepts>
#include <array>
+#include <cstddef>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
-#include <memory>
#include <optional>
-#include <set>
-#include <unordered_map>
-#include <unordered_set>
#include <vector>
#include "test_macros.h"
diff --git a/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.compile.pass.cpp b/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.compile.pass.cpp
index d95de10f35cd97..6f8324eaf76471 100644
--- a/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered.compile.pass.cpp
@@ -14,11 +14,10 @@
#include <concepts>
#include <array>
+#include <cstddef>
#include <deque>
#include <forward_list>
#include <list>
-#include <map>
-#include <memory>
#include <optional>
#include <set>
#include <unordered_map>
diff --git a/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.compile.pass.cpp b/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.compile.pass.cpp
index 0d7bd288c0a18b..dffc33265aebfd 100644
--- a/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.compare/concepts.totallyordered/totally_ordered_with.compile.pass.cpp
@@ -14,15 +14,12 @@
#include <concepts>
#include <array>
+#include <cstddef>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
-#include <memory>
#include <optional>
-#include <set>
-#include <unordered_map>
-#include <unordered_set>
#include <vector>
#include "compare_types.h"
diff --git a/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp b/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp
index fe0ecece3382f9..e3b58d622e4506 100644
--- a/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp
@@ -14,6 +14,7 @@
#include <array>
#include <concepts>
+#include <cstddef>
#include <memory>
#include <string>
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/MinimalElementType.h b/libcxx/test/std/containers/views/mdspan/MinimalElementType.h
index fe7f0e1f238379..1d1a2c3752102d 100644
--- a/libcxx/test/std/containers/views/mdspan/MinimalElementType.h
+++ b/libcxx/test/std/containers/views/mdspan/MinimalElementType.h
@@ -9,6 +9,7 @@
#ifndef TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H
#define TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H
+#include <cstddef>
#include <memory>
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h b/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
index 18d4f4b61fb231..36f95704631f50 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
+++ b/libcxx/test/std/containers/views/mdspan/extents/CtorTestCombinations.h
@@ -9,9 +9,10 @@
// <mdspan>
-#include <mdspan>
-#include <cassert>
#include <array>
+#include <cassert>
+#include <cstddef>
+#include <mdspan>
#include <span>
#include "../ConvertibleToIntegral.h"
diff --git a/libcxx/test/std/containers/views/mdspan/extents/comparison.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/comparison.pass.cpp
index 574290ebec8547..1d713044e60f79 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/comparison.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/comparison.pass.cpp
@@ -17,11 +17,10 @@
// if lhs.extent(r) equals rhs.extent(r) for every rank index r of rhs, otherwise false.
//
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
-#include <type_traits>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/extents/conversion.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/conversion.pass.cpp
index f6834b0b4133e6..7baaa7ec9898e4 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/conversion.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/conversion.pass.cpp
@@ -28,15 +28,13 @@
// (((Extents != dynamic_extent) && (OtherExtents == dynamic_extent)) || ... ) ||
// (numeric_limits<index_type>::max() < numeric_limits<OtherIndexType>::max())
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
#include <limits>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
-#include "test_macros.h"
-
template <class To, class From>
constexpr void test_implicit_conversion(To dest, From src) {
assert(dest == src);
diff --git a/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp
index 1a6501b3913965..82f111153ce6ab 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp
@@ -16,8 +16,9 @@
// Remarks: The deduced type is dextents<size_t, sizeof...(Integrals)>. // until C++26
// Remarks: The deduced type is extents<size_t, maybe-static-ext<Integrals>...>. // since C++26
-#include <mdspan>
#include <cassert>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
index 29dd9e2d270721..1d5f61d02e4ff7 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp
@@ -26,8 +26,9 @@
// Returns: Di.
//
-#include <mdspan>
#include <cassert>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <utility>
diff --git a/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp
index 2924da91f77ee4..10bc769473951e 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp
@@ -22,9 +22,10 @@
// ...
// }
-#include <mdspan>
#include <cassert>
#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/comparison.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/comparison.pass.cpp
index c8b4083291a684..151da5ba617403 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/comparison.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/comparison.pass.cpp
@@ -15,11 +15,10 @@
// `
// Constraints: extents_type::rank() == OtherExtents::rank() is true.
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
-#include <type_traits>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp
index 5a4040317d243f..12c59a4caf10e0 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp
@@ -14,9 +14,10 @@
//
// constexpr mapping() noexcept = default;
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp
index 46505cb961bbdf..299012dc5af84d 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp
@@ -17,9 +17,10 @@
//
// Effects: Direct-non-list-initializes extents_ with e.
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_right.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_right.pass.cpp
index 5f9bd4344d0ec7..1e8f8fb54d5ef8 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_right.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_right.pass.cpp
@@ -20,9 +20,10 @@
//
// Preconditions: other.required_span_size() is representable as a value of type index_type
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <limits>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_stride.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_stride.pass.cpp
index 34489b7c52d7db..1668c26a697d45 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_stride.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_stride.pass.cpp
@@ -23,10 +23,10 @@
//
// Effects: Direct-non-list-initializes extents_ with other.extents().
-#include <mdspan>
#include <array>
#include <cassert>
-#include <limits>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.mapping.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.mapping.pass.cpp
index 63b3c50c73175d..737e5f3d25728b 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/ctor.mapping.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/ctor.mapping.pass.cpp
@@ -18,9 +18,10 @@
//
// Preconditions: other.required_span_size() is representable as a value of type index_type
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <limits>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
index 40cd6bc2812e39..84c3ef45c69b6b 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp
@@ -23,11 +23,12 @@
// Preconditions:
// * extents_type::index-cast(i) is a multidimensional index in extents_.
-#include <mdspan>
-#include <type_traits>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
+#include <type_traits>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp
index 19f523824cfc48..32442ecd5a0e6d 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/properties.pass.cpp
@@ -26,11 +26,10 @@
// };
// }
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
-#include <type_traits>
#include <utility>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp
index 4cb111d29827a7..9ad61b0799c15f 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/required_span_size.pass.cpp
@@ -14,9 +14,10 @@
//
// Returns: extents().fwd-prod-of-extents(extents_type::rank()).
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
index 7a6add60efcd11..6410fecdab59e2 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
@@ -76,9 +76,9 @@
// Result: A constant expression ([expr.const]) of type bool.
// Returns: true only if m.is_strided() is true for all possible objects m of type M.
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
#include <utility>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/comparison.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/comparison.pass.cpp
index 03c78ca5e91d96..a65d7d39db8e22 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/comparison.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/comparison.pass.cpp
@@ -15,11 +15,10 @@
// `
// Constraints: extents_type::rank() == OtherExtents::rank() is true.
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
-#include <type_traits>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp
index f02174416f33cc..d644b0ff18d82b 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.default.pass.cpp
@@ -14,9 +14,10 @@
//
// constexpr mapping() noexcept = default;
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp
index 9c2c39bc3cb3a5..cd0cff838fac53 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.extents.pass.cpp
@@ -17,9 +17,10 @@
//
// Effects: Direct-non-list-initializes extents_ with e.
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_left.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_left.pass.cpp
index 61aba5dae68294..994d98a8032119 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_left.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_left.pass.cpp
@@ -20,9 +20,10 @@
//
// Preconditions: other.required_span_size() is representable as a value of type index_type
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <limits>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_stride.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_stride.pass.cpp
index 3bc7d82f8ed8dc..89321f860dc3a9 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_stride.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.layout_stride.pass.cpp
@@ -23,10 +23,10 @@
//
// Effects: Direct-non-list-initializes extents_ with other.extents().
-#include <mdspan>
#include <array>
#include <cassert>
-#include <limits>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.mapping.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.mapping.pass.cpp
index eeea5ab021e973..ee00c688301ef8 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/ctor.mapping.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/ctor.mapping.pass.cpp
@@ -18,9 +18,10 @@
//
// Preconditions: other.required_span_size() is representable as a value of type index_type
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <limits>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
index 989078f17d303b..42d4e9a2d24b6f 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/index_operator.pass.cpp
@@ -23,9 +23,10 @@
// Preconditions:
// * extents_type::index-cast(i) is a multidimensional index in extents_.
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp
index 674a7ac98cbf7b..857ec3cb05835d 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/properties.pass.cpp
@@ -26,11 +26,10 @@
// };
// }
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
-#include <type_traits>
#include <utility>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp
index 0128d8c26a83e7..2ffd1f41f9638f 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/required_span_size.pass.cpp
@@ -14,10 +14,10 @@
//
// Returns: extents().fwd-prod-of-extents(extents_type::rank()).
-
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
index 2b11d17c6717a3..b7e01d14532d4a 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
@@ -76,9 +76,9 @@
// Result: A constant expression ([expr.const]) of type bool.
// Returns: true only if m.is_strided() is true for all possible objects m of type M.
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
#include <utility>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp
index 108c4c6fca98e1..055986d80c7263 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.default.pass.cpp
@@ -20,9 +20,10 @@
// Effects: Direct-non-list-initializes extents_ with extents_type(), and for all d in the range [0, rank_),
// direct-non-list-initializes strides_[d] with layout_right::mapping<extents_type>().stride(d).
-#include <mdspan>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_array.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_array.pass.cpp
index cecfb79ea68675..bbda6d4a736318 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_array.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_array.pass.cpp
@@ -27,10 +27,11 @@
// Effects: Direct-non-list-initializes extents_ with e, and for all d in the range [0, rank_),
// direct-non-list-initializes strides_[d] with as_const(s[d]).
-#include <mdspan>
#include <array>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_span.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_span.pass.cpp
index d0f26ad23df987..f5db6768f2c0ec 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_span.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/ctor.extents_span.pass.cpp
@@ -27,10 +27,11 @@
// Effects: Direct-non-list-initializes extents_ with e, and for all d in the range [0, rank_),
// direct-non-list-initializes strides_[d] with as_const(s[d]).
-#include <mdspan>
#include <array>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/deduction.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/deduction.pass.cpp
index ca88a9f8e0440e..233eebff0ccd0f 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/deduction.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/deduction.pass.cpp
@@ -10,13 +10,12 @@
// <mdspan>
-#include <mdspan>
#include <array>
#include <cassert>
-#include <concepts>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
-#include <type_traits>
#include <utility>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/is_exhaustive_corner_case.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/is_exhaustive_corner_case.pass.cpp
index 589e32f86e39d3..9f51cc01cf9dfa 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/is_exhaustive_corner_case.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/is_exhaustive_corner_case.pass.cpp
@@ -19,14 +19,11 @@
// range [1, rank_), where pi is the ith element of P.
// - Otherwise, false.
-#include <mdspan>
#include <array>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
-#include <type_traits>
-
-#include "test_macros.h"
template <class E>
constexpr void
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp
index b1eb84b375b6ed..eac1029882e3a3 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/properties.pass.cpp
@@ -38,10 +38,11 @@
// range [1, rank_), where pi is the ith element of P.
// - Otherwise, false.
-#include <mdspan>
#include <array>
#include <cassert>
#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp
index 870518994a9392..629849646bb228 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/required_span_size.pass.cpp
@@ -19,10 +19,11 @@
//
// Returns: REQUIRED-SPAN-SIZE(extents(), strides_).
-#include <mdspan>
#include <array>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <mdspan>
#include <span> // dynamic_extent
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
index a69fb4f287c3e8..8131ecde5d769e 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
@@ -76,9 +76,9 @@
// Result: A constant expression ([expr.const]) of type bool.
// Returns: true only if m.is_strided() is true for all possible objects m of type M.
-#include <mdspan>
#include <cassert>
-#include <concepts>
+#include <cstddef>
+#include <mdspan>
#include <span> // dynamic_extent
#include <type_traits>
#include <utility>
diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/CustomTestAccessors.h b/libcxx/test/std/containers/views/mdspan/mdspan/CustomTestAccessors.h
index b68268d172a1fe..0795926cb43ff8 100644
--- a/libcxx/test/std/containers/views/mdspan/mdspan/CustomTestAccessors.h
+++ b/libcxx/test/std/containers/views/mdspan/mdspan/CustomTestAccessors.h
@@ -17,9 +17,10 @@
#ifndef TEST_STD_CONTAINERS_VIEWS_MDSPAN_MDSPAN_CUSTOM_TEST_ACCESSORS_H
#define TEST_STD_CONTAINERS_VIEWS_MDSPAN_MDSPAN_CUSTOM_TEST_ACCESSORS_H
+#include <cassert>
+#include <cstddef>
#include <mdspan>
#include <type_traits>
-#include <cassert>
// This contains a bunch of accessors and handles which have different properties
// regarding constructibility and convertibility in order to test mdspan constraints
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp
index fbbd3d6ff40444..91d2e342ec6b5d 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/iterator_len.pass.cpp
@@ -15,9 +15,10 @@
//
-#include <span>
#include <cassert>
+#include <cstddef>
#include <iterator>
+#include <span>
#include <type_traits>
template <std::size_t Extent>
diff --git a/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp b/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
index a31aa2af7b9dd7..937d8d921ea0b1 100644
--- a/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.cons/iterator_sentinel.verify.cpp
@@ -15,8 +15,9 @@
// If Extent is not equal to dynamic_extent, then last - first shall be equal to Extent.
//
-#include <span>
+#include <cstddef>
#include <iterator>
+#include <span>
template<class T, std::size_t Extent>
std::span<T, Extent> createImplicitSpan(T* first, T* last) {
diff --git a/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp b/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
index 1f58d0f969f70e..44b658fb83759b 100644
--- a/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.objectrep/as_bytes.pass.cpp
@@ -16,9 +16,9 @@
// : sizeof(ElementType) * Extent>
// as_bytes(span<ElementType, Extent> s) noexcept;
-
-#include <span>
#include <cassert>
+#include <cstddef>
+#include <span>
#include <string>
#include "test_macros.h"
diff --git a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
index 6b7bd5dcf0c1e8..d38d69d9fee1d0 100644
--- a/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
+++ b/libcxx/test/std/containers/views/views.span/span.objectrep/as_writable_bytes.pass.cpp
@@ -16,9 +16,9 @@
// : sizeof(ElementType) * Extent>
// as_writable_bytes(span<ElementType, Extent> s) noexcept;
-
-#include <span>
#include <cassert>
+#include <cstddef>
+#include <span>
#include <string>
#include "test_macros.h"
diff --git a/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp b/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
index 3f614efee20361..437d0f0a91177a 100644
--- a/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
@@ -12,8 +12,10 @@
// template <> struct is_error_code_enum<> : public false_type {};
-#include <system_error>
+#include <cstddef>
#include <string>
+#include <system_error>
+
#include "test_macros.h"
template <bool Expected, class T>
diff --git a/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp b/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
index e9916f2427a554..f4d5057948acde 100644
--- a/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
@@ -12,9 +12,11 @@
// template <class T> constexpr bool is_error_condition_enum_v;
+#include <cstddef>
#include <string>
#include <system_error>
#include <type_traits>
+
#include "test_macros.h"
template <bool Expected, class T>
diff --git a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp
index 8a291632a8ab1e..fbdaa438f7886c 100644
--- a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp
@@ -14,6 +14,9 @@
// [simd.class]
// template<class U> simd(U&& value) noexcept;
+#include <algorithm>
+#include <experimental/simd>
+
#include "../test_utils.h"
namespace ex = std::experimental::parallelism_v2;
diff --git a/libcxx/test/std/experimental/simd/test_utils.h b/libcxx/test/std/experimental/simd/test_utils.h
index 3c227a43c2f4dd..4c7b459cc8eb11 100644
--- a/libcxx/test/std/experimental/simd/test_utils.h
+++ b/libcxx/test/std/experimental/simd/test_utils.h
@@ -9,12 +9,13 @@
#ifndef LIBCXX_TEST_STD_EXPERIMENTAL_SIMD_TEST_UTILS_H
#define LIBCXX_TEST_STD_EXPERIMENTAL_SIMD_TEST_UTILS_H
-#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
+#include <experimental/simd>
#include <type_traits>
#include <utility>
-#include <experimental/simd>
+
#include "type_algorithms.h"
namespace ex = std::experimental::parallelism_v2;
diff --git a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp
index 8413f912e57620..6d07e973ec306e 100644
--- a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/incrementable_traits.compile.pass.cpp
@@ -11,12 +11,9 @@
// template<class T>
// struct incrementable_traits;
-#include <iterator>
-
#include <concepts>
#include <cstddef>
-
-#include "test_macros.h"
+#include <iterator>
template <class T>
concept check_has_difference_type = requires {
diff --git a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/iter_difference_t.compile.pass.cpp b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/iter_difference_t.compile.pass.cpp
index bd6664fe957a2e..99512f7c3ba1c6 100644
--- a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/iter_difference_t.compile.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/incrementable.traits/iter_difference_t.compile.pass.cpp
@@ -14,6 +14,7 @@
#include <iterator>
#include <concepts>
+#include <cstddef>
#include <vector>
template <class T>
diff --git a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp
index 835aa9c7be278f..4fd935e460ca84 100644
--- a/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirectly_readable_traits.compile.pass.cpp
@@ -14,9 +14,9 @@
#include <iterator>
#include <concepts>
+#include <cstddef>
#include <memory>
#include <optional>
-#include <string>
#include <vector>
template <class T>
diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
index f8d3e2b4fdc7b2..68edbb1cb91dea 100644
--- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/types.pass.cpp
@@ -27,6 +27,7 @@
// typedef void pointer;
// };
+#include <cstddef>
#include <iterator>
#include <type_traits>
#include <vector>
diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
index f71ba368ab8612..c74f9704d0c35c 100644
--- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/types.pass.cpp
@@ -28,6 +28,7 @@
// typedef output_iterator_tag iterator_category;
// };
+#include <cstddef>
#include <iterator>
#include <type_traits>
#include <vector>
diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
index 08864868342aed..faf5ca5d61836d 100644
--- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp
@@ -28,9 +28,11 @@
// typedef void pointer;
// };
+#include <cstddef>
#include <iterator>
#include <type_traits>
#include <vector>
+
#include "test_macros.h"
template <class C>
diff --git a/libcxx/test/std/numerics/bit/byteswap.pass.cpp b/libcxx/test/std/numerics/bit/byteswap.pass.cpp
index b87faf150177f3..9d4e328ed9d0f7 100644
--- a/libcxx/test/std/numerics/bit/byteswap.pass.cpp
+++ b/libcxx/test/std/numerics/bit/byteswap.pass.cpp
@@ -10,6 +10,7 @@
#include <bit>
#include <cassert>
+#include <cstddef>
#include <cstdint>
#include <utility>
diff --git a/libcxx/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp b/libcxx/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
index bef2dd7866964c..f6cac33e944387 100644
--- a/libcxx/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
@@ -16,12 +16,11 @@
// OutputIterator result, T init);
//
-#include <numeric>
#include <algorithm>
#include <array>
#include <cassert>
-#include <functional>
-#include <iterator>
+#include <cstddef>
+#include <numeric>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp b/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
index 299d085d01a062..1c79eebb8ee2c6 100644
--- a/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp
@@ -16,12 +16,11 @@
// OutputIterator result, T init);
//
-#include <numeric>
#include <algorithm>
#include <array>
#include <cassert>
-#include <functional>
-#include <iterator>
+#include <cstddef>
+#include <numeric>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp b/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
index 87bea923eed3fd..fb39b4f06ece79 100644
--- a/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp
@@ -17,12 +17,12 @@
// OutputIterator result,
// BinaryOperation binary_op); // C++17
-#include <numeric>
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
#include <functional>
-#include <iterator>
+#include <numeric>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp b/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
index 2e21d38f473441..4e07306c293111 100644
--- a/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp
@@ -17,12 +17,12 @@
// OutputIterator result,
// BinaryOperation binary_op, T init); // C++17
-#include <numeric>
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
#include <functional>
-#include <iterator>
+#include <numeric>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp b/libcxx/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
index 52272205307a9f..abfd2a81ab5cba 100644
--- a/libcxx/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
@@ -19,12 +19,12 @@
// UnaryOperation unary_op);
-#include <numeric>
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
#include <functional>
-#include <iterator>
+#include <numeric>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp b/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
index 80ead01e9a7958..3afcca18c32202 100644
--- a/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp
@@ -19,12 +19,12 @@
// UnaryOperation unary_op);
-#include <numeric>
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
#include <functional>
-#include <iterator>
+#include <numeric>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp b/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
index 18be676c7a54d0..b3a45abb3bef27 100644
--- a/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp
@@ -20,12 +20,12 @@
// T init);
-#include <numeric>
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
#include <functional>
-#include <iterator>
+#include <numeric>
#include "test_macros.h"
#include "test_iterators.h"
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
index ec7f72edf9ee9b..c2d280406852a9 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -15,13 +15,12 @@
// template<class _URNG> result_type operator()(_URNG& g);
-#include <random>
#include <algorithm>
#include <cassert>
#include <cmath>
-#include <iterator>
+#include <cstddef>
#include <limits>
-#include <numeric>
+#include <random>
#include <vector>
#include "test_macros.h"
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
index 9bcb2ed3afac12..e31b4c5837fe91 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
@@ -15,13 +15,12 @@
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
-#include <random>
#include <algorithm> // for sort
#include <cassert>
#include <cmath>
-#include <iterator>
+#include <cstddef>
#include <limits>
-#include <numeric>
+#include <random>
#include <vector>
#include "test_macros.h"
diff --git a/libcxx/test/std/ranges/range.adaptors/range.chunk.by/ctor.default.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.chunk.by/ctor.default.pass.cpp
index 98c6cb7af5f563..96d96053f74ba5 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.chunk.by/ctor.default.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.chunk.by/ctor.default.pass.cpp
@@ -16,6 +16,7 @@
#include <ranges>
#include <cassert>
+#include <cstddef>
#include <type_traits>
constexpr int buff[] = {-2, 1, -1, 2};
diff --git a/libcxx/test/std/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/deref.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/deref.pass.cpp
index 8cc9bdac0b1d8d..6a5ce1335eccf8 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/deref.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.chunk.by/range.chunk.by.iter/deref.pass.cpp
@@ -17,13 +17,12 @@
#include <algorithm>
#include <array>
#include <cassert>
+#include <cstddef>
#include <concepts>
#include <functional>
-#include <utility>
#include "../types.h"
#include "test_iterators.h"
-#include "test_macros.h"
template <class Iter, class Sent = sentinel_wrapper<Iter>>
constexpr void test() {
diff --git a/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/member_typedefs.compile.pass.cpp b/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/member_typedefs.compile.pass.cpp
index 2ef09a6d921698..d7202e35e66d3d 100644
--- a/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/member_typedefs.compile.pass.cpp
+++ b/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/member_typedefs.compile.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <concepts>
+#include <cstddef>
#include <cstdint>
#include <ranges>
#include <type_traits>
diff --git a/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp b/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp
index 3a373741f4c0e4..523eefa69b4ca1 100644
--- a/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp
+++ b/libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/minus.pass.cpp
@@ -11,10 +11,10 @@
// friend constexpr iterator operator-(iterator i, difference_type n);
// friend constexpr difference_type operator-(const iterator& x, const iterator& y);
-#include <ranges>
#include <cassert>
-#include <cstdint>
#include <concepts>
+#include <cstddef>
+#include <ranges>
constexpr bool test() {
// <iterator> - difference_type
diff --git a/libcxx/test/std/ranges/range.utility/range.subrange/ctad.compile.pass.cpp b/libcxx/test/std/ranges/range.utility/range.subrange/ctad.compile.pass.cpp
index 670f9808b902ca..2bf6ca6fb0a0c3 100644
--- a/libcxx/test/std/ranges/range.utility/range.subrange/ctad.compile.pass.cpp
+++ b/libcxx/test/std/ranges/range.utility/range.subrange/ctad.compile.pass.cpp
@@ -13,7 +13,8 @@
#include <ranges>
#include <cassert>
-#include "test_macros.h"
+#include <cstddef>
+
#include "test_iterators.h"
using FI = forward_iterator<int*>;
diff --git a/libcxx/test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp b/libcxx/test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp
index 4bfa0f38829dda..26db908428c320 100644
--- a/libcxx/test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp
@@ -12,8 +12,9 @@
// void remove_prefix(size_type _n)
-#include <string_view>
#include <cassert>
+#include <cstddef>
+#include <string_view>
#include "test_macros.h"
diff --git a/libcxx/test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp b/libcxx/test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp
index 6d57f6c24a4877..b6edccc68c9e8d 100644
--- a/libcxx/test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp
@@ -12,8 +12,9 @@
// void remove_suffix(size_type _n)
-#include <string_view>
#include <cassert>
+#include <cstddef>
+#include <string_view>
#include "test_macros.h"
diff --git a/libcxx/test/std/strings/string.view/string.view.modifiers/swap.pass.cpp b/libcxx/test/std/strings/string.view/string.view.modifiers/swap.pass.cpp
index de0c5f423c4e8e..d18a7b28688dcd 100644
--- a/libcxx/test/std/strings/string.view/string.view.modifiers/swap.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.modifiers/swap.pass.cpp
@@ -12,8 +12,9 @@
// void swap(basic_string_view& _other) noexcept
-#include <string_view>
#include <cassert>
+#include <cstddef>
+#include <string_view>
#include "test_macros.h"
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp
index 1d97723b90edce..0b27a05056c68e 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp
@@ -18,10 +18,11 @@
// Effects: Equivalent to std::copy_n(begin() + pos, rlen, s).
// Returns: rlen.
-#include <string_view>
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include <stdexcept>
+#include <string_view>
#include "test_macros.h"
diff --git a/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp
index 1c8e0aebabd412..62b0259c175f8f 100644
--- a/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.ops/substr.pass.cpp
@@ -16,10 +16,11 @@
// Effects: Determines the effective length rlen of the string to reference as the smaller of n and size() - pos.
// Returns: basic_string_view(data()+pos, rlen).
-#include <string_view>
#include <algorithm>
-#include <stdexcept>
#include <cassert>
+#include <cstddef>
+#include <stdexcept>
+#include <string_view>
#include "test_macros.h"
diff --git a/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pass.cpp b/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pass.cpp
index 1704eb67562e1f..b9209ac2c89b65 100644
--- a/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pass.cpp
@@ -33,9 +33,9 @@
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include <functional>
-#include "test_macros.h"
#include "test_iterators.h"
template <typename T> struct MyHash {
diff --git a/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pred.pass.cpp b/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pred.pass.cpp
index 3648be9bb06acc..d616301767ede6 100644
--- a/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pred.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.search/func.search.bm/hash.pred.pass.cpp
@@ -33,9 +33,9 @@
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include <functional>
-#include "test_macros.h"
#include "test_iterators.h"
template <typename T> struct MyHash {
diff --git a/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pass.cpp b/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pass.cpp
index d0e6d5f8bfb6b5..19f5710819c463 100644
--- a/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pass.cpp
@@ -31,10 +31,10 @@
// };
#include <algorithm>
-#include <functional>
#include <cassert>
+#include <cstddef>
+#include <functional>
-#include "test_macros.h"
#include "test_iterators.h"
template <typename T> struct MyHash {
diff --git a/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pred.pass.cpp b/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pred.pass.cpp
index 59b5b30d7f1b5e..3d29a05efd40c0 100644
--- a/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pred.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/hash.pred.pass.cpp
@@ -31,10 +31,10 @@
// };
#include <algorithm>
-#include <functional>
#include <cassert>
+#include <cstddef>
+#include <functional>
-#include "test_macros.h"
#include "test_iterators.h"
template <typename T> struct MyHash {
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp
index 381bcda761700c..064f7acdf71a03 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp
@@ -13,8 +13,8 @@
// UNSUPPORTED: c++03, c++11, c++14
+#include <cstddef>
#include <functional>
-#include <type_traits>
#include <utility>
#include "test_macros.h"
@@ -153,4 +153,3 @@ struct invalid_c_vararg { R operator()(int, ...) { return {}; } };
static_assert(!can_deduce<invalid_rvalue_ref>);
static_assert(!can_deduce<invalid_c_vararg>);
static_assert(!can_deduce<std::nullptr_t>);
-
diff --git a/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
index 577a9bf0e15ba7..448c5ba143c101 100644
--- a/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp
@@ -19,10 +19,10 @@
// Not very portable
-#include <functional>
#include <cassert>
+#include <cstddef>
+#include <functional>
#include <type_traits>
-#include <limits>
#include "test_macros.h"
diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
index 272441ebedc2f2..92e8879d05bf01 100644
--- a/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
+++ b/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
@@ -13,8 +13,9 @@
// template <class T, class ...Args>
// constexpr T* construct_at(T* location, Args&& ...args);
-#include <memory>
#include <cassert>
+#include <cstddef>
+#include <memory>
#include <utility>
#include "test_iterators.h"
diff --git a/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp b/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp
index 4c66370fac9221..3fa9355270866a 100644
--- a/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp
+++ b/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp
@@ -22,12 +22,11 @@
// return_temporary_buffer(T* p);
#include <cassert>
+#include <cstddef>
#include <cstdint>
#include <memory>
#include <utility>
-#include "test_macros.h"
-
struct alignas(32) A {
int field;
};
diff --git a/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp b/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
index 5f7fc4571906cc..39a4767d874e39 100644
--- a/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
+++ b/libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
@@ -19,12 +19,11 @@
// void
// return_temporary_buffer(T* p);
-#include <memory>
#include <cassert>
+#include <cstddef>
+#include <memory>
#include <utility>
-#include "test_macros.h"
-
int main(int, char**)
{
std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
index 32db9d12099f26..2eecf7925d7395 100644
--- a/libcxx/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.rel/is_invocable.pass.cpp
@@ -18,13 +18,12 @@
// Fn and all types in the template parameter pack ArgTypes shall be
// complete types, cv void, or arrays of unknown bound.
-#include <type_traits>
+#include <cstddef>
#include <functional>
#include <memory>
+#include <type_traits>
#include <vector>
-#include "test_macros.h"
-
struct Tag {};
struct DerFromTag : Tag {};
diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp
index fa6048e869e182..47e81f38e54b36 100644
--- a/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_invocable.pass.cpp
@@ -12,12 +12,10 @@
// is_nothrow_invocable
+#include <cstddef>
#include <type_traits>
-#include <functional>
#include <vector>
-#include "test_macros.h"
-
struct Tag {};
struct Implicit {
diff --git a/libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_overaligned_request.pass.cpp b/libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_overaligned_request.pass.cpp
index cf3dfe21d96755..ad967798747abc 100644
--- a/libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_overaligned_request.pass.cpp
+++ b/libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_overaligned_request.pass.cpp
@@ -14,8 +14,9 @@
// class monotonic_buffer_resource
-#include <memory_resource>
#include <cassert>
+#include <cstddef>
+#include <memory_resource>
#include "test_macros.h"
#include "count_new.h"
diff --git a/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_overaligned_request.pass.cpp b/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_overaligned_request.pass.cpp
index 35a6a8f135a406..f3e1e4c026ef72 100644
--- a/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_overaligned_request.pass.cpp
+++ b/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_overaligned_request.pass.cpp
@@ -14,9 +14,10 @@
// class synchronized_pool_resource
-#include <memory_resource>
#include <cassert>
+#include <cstddef>
#include <memory> // std::align
+#include <memory_resource>
#include "count_new.h"
#include "test_macros.h"
diff --git a/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_overaligned_request.pass.cpp b/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_overaligned_request.pass.cpp
index cd8d8a77459252..5153a54ef3f14f 100644
--- a/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_overaligned_request.pass.cpp
+++ b/libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_overaligned_request.pass.cpp
@@ -14,9 +14,10 @@
// class unsynchronized_pool_resource
-#include <memory_resource>
#include <cassert>
+#include <cstddef>
#include <memory> // std::align
+#include <memory_resource>
#include "count_new.h"
#include "test_macros.h"
diff --git a/libcxx/utils/generate_escaped_output_table.py b/libcxx/utils/generate_escaped_output_table.py
index 41524e8fe7186c..59dd707ae6126d 100755
--- a/libcxx/utils/generate_escaped_output_table.py
+++ b/libcxx/utils/generate_escaped_output_table.py
@@ -218,7 +218,7 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/utils/generate_extended_grapheme_cluster_table.py b/libcxx/utils/generate_extended_grapheme_cluster_table.py
index 558b606186130f..eba88a4f487767 100755
--- a/libcxx/utils/generate_extended_grapheme_cluster_table.py
+++ b/libcxx/utils/generate_extended_grapheme_cluster_table.py
@@ -214,8 +214,8 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/access.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/utils/generate_indic_conjunct_break_table.py b/libcxx/utils/generate_indic_conjunct_break_table.py
index e41f6e9be233d7..580d8157ffebf9 100755
--- a/libcxx/utils/generate_indic_conjunct_break_table.py
+++ b/libcxx/utils/generate_indic_conjunct_break_table.py
@@ -207,8 +207,8 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
+#include <__cstddef/ptrdiff_t.h>
#include <__iterator/access.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/utils/generate_width_estimation_table.py b/libcxx/utils/generate_width_estimation_table.py
index d8c036f34e8353..f81f0ba77489eb 100644
--- a/libcxx/utils/generate_width_estimation_table.py
+++ b/libcxx/utils/generate_width_estimation_table.py
@@ -246,7 +246,7 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
-#include <cstddef>
+#include <__cstddef/ptrdiff_t.h>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxxabi/src/private_typeinfo.cpp b/libcxxabi/src/private_typeinfo.cpp
index 9dba91e1985e34..2f631041f74c94 100644
--- a/libcxxabi/src/private_typeinfo.cpp
+++ b/libcxxabi/src/private_typeinfo.cpp
@@ -41,9 +41,11 @@
// Defining _LIBCXXABI_FORGIVING_DYNAMIC_CAST does not help since can_catch() calls
// is_equal() with use_strcmp=false so the string names are not compared.
-#include <cstdint>
#include <cassert>
+#include <cstddef>
+#include <cstdint>
#include <string.h>
+
#include "abort_message.h"
#ifdef _LIBCXXABI_FORGIVING_DYNAMIC_CAST
More information about the libcxx-commits
mailing list