[libcxx-commits] [libcxx] [libc++] add commonly used aliases in <__config> and remove <cstddef> includes (PR #70598)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Oct 29 10:52:47 PDT 2023
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/70598
We include `<cstddef>` in almost every public header, but almost always just use `size_t`, `ptrdiff_t` or `nullptr_t`. Since these aliases are trivial to define, we can just add them to <__config> and avoid including `<cstddef>` everywhere.
>From 5c5665e905940a2c8d552b682c8d6389ea1486d9 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sun, 29 Oct 2023 18:45:12 +0100
Subject: [PATCH] [libc++] add commonly used aliases in <__config> and remove
<cstddef> includes
We include `<cstddef>` in almost every public header, but almost always
just use `size_t`, `ptrdiff_t` or `nullptr_t`. Since these aliases are
trivial to define, we can just add them to <__config> and avoid
including `<cstddef>` everywhere.
---
libcxx/include/__algorithm/copy_move_common.h | 1 -
.../pstl_backends/cpu_backends/backend.h | 1 -
.../pstl_backends/cpu_backends/find_if.h | 1 -
.../pstl_backends/cpu_backends/libdispatch.h | 1 -
.../pstl_backends/cpu_backends/serial.h | 1 -
.../pstl_backends/cpu_backends/thread.h | 1 -
libcxx/include/__algorithm/shuffle.h | 1 -
libcxx/include/__atomic/aliases.h | 1 -
libcxx/include/__atomic/atomic.h | 1 -
libcxx/include/__atomic/cxx_atomic_impl.h | 1 -
libcxx/include/__charconv/to_chars_integral.h | 2 +-
.../__compare/common_comparison_category.h | 1 -
libcxx/include/__concepts/swappable.h | 1 -
libcxx/include/__config | 9 ++-
libcxx/include/__coroutine/coroutine_handle.h | 1 -
libcxx/include/__exception/exception_ptr.h | 1 -
libcxx/include/__exception/nested_exception.h | 2 +-
libcxx/include/__exception/operations.h | 1 -
.../include/__filesystem/directory_iterator.h | 1 -
libcxx/include/__filesystem/path.h | 1 -
libcxx/include/__filesystem/path_iterator.h | 1 -
.../recursive_directory_iterator.h | 1 -
libcxx/include/__format/buffer.h | 1 -
.../include/__format/escaped_output_table.h | 1 -
.../extended_grapheme_cluster_table.h | 1 -
libcxx/include/__format/format_args.h | 1 -
libcxx/include/__format/format_context.h | 1 -
libcxx/include/__format/format_string.h | 1 -
.../__format/formatter_floating_point.h | 1 -
libcxx/include/__format/formatter_output.h | 1 -
libcxx/include/__format/formatter_pointer.h | 1 -
.../include/__format/width_estimation_table.h | 1 -
libcxx/include/__functional/bind.h | 1 -
libcxx/include/__functional/hash.h | 1 -
libcxx/include/__fwd/array.h | 1 -
libcxx/include/__fwd/get.h | 1 -
libcxx/include/__fwd/span.h | 1 -
libcxx/include/__iterator/access.h | 1 -
.../include/__iterator/back_insert_iterator.h | 1 -
libcxx/include/__iterator/data.h | 1 -
libcxx/include/__iterator/empty.h | 1 -
.../__iterator/front_insert_iterator.h | 1 -
.../include/__iterator/incrementable_traits.h | 1 -
libcxx/include/__iterator/insert_iterator.h | 1 -
libcxx/include/__iterator/istream_iterator.h | 1 -
libcxx/include/__iterator/iterator.h | 1 -
libcxx/include/__iterator/iterator_traits.h | 2 +-
libcxx/include/__iterator/ostream_iterator.h | 1 -
.../include/__iterator/ostreambuf_iterator.h | 1 -
libcxx/include/__iterator/reverse_access.h | 1 -
.../include/__iterator/segmented_iterator.h | 1 -
libcxx/include/__iterator/size.h | 1 -
libcxx/include/__iterator/wrap_iter.h | 1 -
libcxx/include/__locale | 1 -
libcxx/include/__mdspan/default_accessor.h | 1 -
libcxx/include/__mdspan/extents.h | 2 +-
libcxx/include/__mdspan/layout_left.h | 1 -
libcxx/include/__mdspan/layout_right.h | 1 -
libcxx/include/__mdspan/layout_stride.h | 1 -
libcxx/include/__mdspan/mdspan.h | 1 -
libcxx/include/__memory/align.h | 1 -
libcxx/include/__memory/aligned_alloc.h | 1 -
libcxx/include/__memory/allocate_at_least.h | 1 -
libcxx/include/__memory/allocation_guard.h | 1 -
libcxx/include/__memory/allocator.h | 1 -
libcxx/include/__memory/assume_aligned.h | 1 -
.../include/__memory/builtin_new_allocator.h | 1 -
libcxx/include/__memory/compressed_pair.h | 1 -
libcxx/include/__memory/destruct_n.h | 1 -
libcxx/include/__memory/pointer_traits.h | 2 +-
.../include/__memory/raw_storage_iterator.h | 1 -
libcxx/include/__memory/shared_ptr.h | 2 +-
libcxx/include/__memory/temporary_buffer.h | 1 -
libcxx/include/__memory/unique_ptr.h | 2 +-
libcxx/include/__memory/uses_allocator.h | 1 -
.../include/__memory_resource/pool_options.h | 1 -
.../synchronized_pool_resource.h | 1 -
.../unsynchronized_pool_resource.h | 1 -
libcxx/include/__numeric/midpoint.h | 1 -
.../include/__random/discard_block_engine.h | 1 -
.../include/__random/discrete_distribution.h | 1 -
.../__random/independent_bits_engine.h | 1 -
libcxx/include/__random/log2.h | 1 -
.../__random/mersenne_twister_engine.h | 2 +-
libcxx/include/__random/seed_seq.h | 2 +
.../include/__random/shuffle_order_engine.h | 1 -
.../__random/subtract_with_carry_engine.h | 2 +-
.../__random/uniform_int_distribution.h | 1 -
libcxx/include/__ranges/access.h | 1 -
libcxx/include/__ranges/counted.h | 1 -
libcxx/include/__ranges/drop_view.h | 1 -
libcxx/include/__ranges/elements_view.h | 1 -
libcxx/include/__ranges/empty_view.h | 1 -
libcxx/include/__ranges/istream_view.h | 1 -
libcxx/include/__ranges/single_view.h | 1 -
libcxx/include/__ranges/size.h | 1 -
libcxx/include/__ranges/subrange.h | 2 +-
libcxx/include/__ranges/take_view.h | 1 -
libcxx/include/__ranges/to.h | 1 -
libcxx/include/__split_buffer | 1 -
.../__stop_token/intrusive_shared_ptr.h | 1 -
libcxx/include/__string/char_traits.h | 1 -
.../include/__string/constexpr_c_functions.h | 3 +-
libcxx/include/__support/win32/locale_win32.h | 1 -
libcxx/include/__system_error/error_code.h | 1 -
.../include/__system_error/error_condition.h | 1 -
libcxx/include/__tuple/make_tuple_types.h | 1 -
libcxx/include/__tuple/sfinae_helpers.h | 1 -
libcxx/include/__tuple/tuple_element.h | 1 -
libcxx/include/__tuple/tuple_indices.h | 1 -
libcxx/include/__tuple/tuple_like.h | 1 -
libcxx/include/__tuple/tuple_like_ext.h | 1 -
libcxx/include/__tuple/tuple_size.h | 3 +-
.../include/__type_traits/aligned_storage.h | 1 -
libcxx/include/__type_traits/aligned_union.h | 1 -
libcxx/include/__type_traits/alignment_of.h | 1 -
libcxx/include/__type_traits/datasizeof.h | 3 +-
libcxx/include/__type_traits/extent.h | 1 -
libcxx/include/__type_traits/is_allocator.h | 1 -
libcxx/include/__type_traits/is_array.h | 1 -
.../include/__type_traits/is_bounded_array.h | 1 -
libcxx/include/__type_traits/is_convertible.h | 1 -
.../is_member_function_pointer.h | 1 -
.../__type_traits/is_nothrow_constructible.h | 1 -
.../__type_traits/is_nothrow_destructible.h | 1 -
.../include/__type_traits/is_null_pointer.h | 1 -
libcxx/include/__type_traits/is_swappable.h | 1 -
libcxx/include/__type_traits/rank.h | 1 -
.../__type_traits/remove_all_extents.h | 1 -
libcxx/include/__type_traits/remove_extent.h | 1 -
.../include/__type_traits/remove_reference.h | 1 -
libcxx/include/__type_traits/type_list.h | 1 -
libcxx/include/__utility/in_place.h | 2 +-
libcxx/include/__utility/integer_sequence.h | 1 -
libcxx/include/__utility/pair.h | 2 +-
libcxx/include/__utility/priority_tag.h | 1 -
libcxx/include/__utility/swap.h | 2 +-
libcxx/include/__variant/monostate.h | 1 -
libcxx/include/algorithm | 2 +-
libcxx/include/any | 2 +
libcxx/include/array | 1 +
libcxx/include/atomic | 1 +
libcxx/include/barrier | 2 +-
libcxx/include/bitset | 2 +-
libcxx/include/charconv | 1 +
libcxx/include/chrono | 1 +
libcxx/include/compare | 1 +
libcxx/include/concepts | 1 +
libcxx/include/condition_variable | 1 +
libcxx/include/coroutine | 1 +
libcxx/include/cstddef | 4 +-
libcxx/include/cwchar | 4 ++
libcxx/include/exception | 1 +
libcxx/include/expected | 1 -
libcxx/include/experimental/iterator | 1 +
libcxx/include/experimental/propagate_const | 2 +-
libcxx/include/filesystem | 1 +
libcxx/include/format | 4 ++
libcxx/include/fstream | 1 +
libcxx/include/functional | 1 +
libcxx/include/future | 1 +
libcxx/include/initializer_list | 5 +-
libcxx/include/istream | 1 +
libcxx/include/iterator | 2 +-
libcxx/include/latch | 2 +-
libcxx/include/locale | 1 +
libcxx/include/mutex | 1 +
libcxx/include/new | 3 +-
libcxx/include/numeric | 1 +
libcxx/include/optional | 1 +
libcxx/include/ostream | 1 +
libcxx/include/queue | 1 +
libcxx/include/ranges | 1 +
libcxx/include/regex | 1 +
libcxx/include/scoped_allocator | 1 +
libcxx/include/semaphore | 2 +-
libcxx/include/shared_mutex | 1 +
libcxx/include/sstream | 1 +
libcxx/include/stack | 1 +
libcxx/include/string_view | 2 +-
libcxx/include/system_error | 1 +
libcxx/include/tuple | 2 +-
libcxx/include/type_traits | 6 +-
libcxx/include/typeinfo | 3 +-
libcxx/include/utility | 1 +
libcxx/include/valarray | 2 +-
libcxx/include/variant | 1 +
libcxx/include/vector | 1 +
.../test/libcxx/transitive_includes/cxx20.csv | 4 --
.../test/libcxx/transitive_includes/cxx26.csv | 57 -------------------
.../test/std/numerics/bit/byteswap.pass.cpp | 1 +
191 files changed, 91 insertions(+), 220 deletions(-)
diff --git a/libcxx/include/__algorithm/copy_move_common.h b/libcxx/include/__algorithm/copy_move_common.h
index c06892e9e3c7994..8223b760c9b8a81 100644
--- a/libcxx/include/__algorithm/copy_move_common.h
+++ b/libcxx/include/__algorithm/copy_move_common.h
@@ -25,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/pstl_backends/cpu_backends/backend.h b/libcxx/include/__algorithm/pstl_backends/cpu_backends/backend.h
index ea2210a4a7adbdb..6b2fd0b2337974d 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backends/backend.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backends/backend.h
@@ -10,7 +10,6 @@
#define _LIBCPP___ALGORITHM_PSTL_BACKENDS_CPU_BACKEND_BACKEND_H
#include <__config>
-#include <cstddef>
#if defined(_LIBCPP_PSTL_CPU_BACKEND_SERIAL)
# include <__algorithm/pstl_backends/cpu_backends/serial.h>
diff --git a/libcxx/include/__algorithm/pstl_backends/cpu_backends/find_if.h b/libcxx/include/__algorithm/pstl_backends/cpu_backends/find_if.h
index 170470e4fb7edde..a6eb0efee39942f 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backends/find_if.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backends/find_if.h
@@ -19,7 +19,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/__algorithm/pstl_backends/cpu_backends/libdispatch.h b/libcxx/include/__algorithm/pstl_backends/cpu_backends/libdispatch.h
index e885e7f225172cc..9e821e794c0fbbb 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backends/libdispatch.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backends/libdispatch.h
@@ -27,7 +27,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/__algorithm/pstl_backends/cpu_backends/serial.h b/libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h
index afcc7ffb2661304..344f2740f19a9d9 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h
@@ -13,7 +13,6 @@
#include <__config>
#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/__algorithm/pstl_backends/cpu_backends/thread.h b/libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h
index eb11a961b760c30..da486ff87bc5a9f 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h
@@ -13,7 +13,6 @@
#include <__config>
#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/__algorithm/shuffle.h b/libcxx/include/__algorithm/shuffle.h
index 6fee88ca6ff25d1..cb2bb383601b68f 100644
--- a/libcxx/include/__algorithm/shuffle.h
+++ b/libcxx/include/__algorithm/shuffle.h
@@ -16,7 +16,6 @@
#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/__atomic/aliases.h b/libcxx/include/__atomic/aliases.h
index e2f9fae4094ef23..17463ce047d9729 100644
--- a/libcxx/include/__atomic/aliases.h
+++ b/libcxx/include/__atomic/aliases.h
@@ -15,7 +15,6 @@
#include <__atomic/is_always_lock_free.h>
#include <__config>
#include <__type_traits/conditional.h>
-#include <cstddef>
#include <cstdint>
#include <cstdlib>
diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h
index 47de6b958a96c1b..9e4d76d8c8fadd0 100644
--- a/libcxx/include/__atomic/atomic.h
+++ b/libcxx/include/__atomic/atomic.h
@@ -18,7 +18,6 @@
#include <__type_traits/is_function.h>
#include <__type_traits/is_same.h>
#include <__type_traits/remove_pointer.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__atomic/cxx_atomic_impl.h b/libcxx/include/__atomic/cxx_atomic_impl.h
index d670fddc3934cdd..0cd2919b2def478 100644
--- a/libcxx/include/__atomic/cxx_atomic_impl.h
+++ b/libcxx/include/__atomic/cxx_atomic_impl.h
@@ -17,7 +17,6 @@
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_trivially_copyable.h>
#include <__type_traits/remove_const.h>
-#include <cstddef>
#include <cstring>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__charconv/to_chars_integral.h b/libcxx/include/__charconv/to_chars_integral.h
index f50cc55a4c6d90f..7ab396264c9dfb7 100644
--- a/libcxx/include/__charconv/to_chars_integral.h
+++ b/libcxx/include/__charconv/to_chars_integral.h
@@ -20,11 +20,11 @@
#include <__system_error/errc.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_integral.h>
#include <__type_traits/is_same.h>
#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 5fad99bf5ce0a53..6949340dcf83bee 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -12,7 +12,6 @@
#include <__compare/ordering.h>
#include <__config>
#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 cdffe3420555787..53bf5d9cb02e042 100644
--- a/libcxx/include/__concepts/swappable.h
+++ b/libcxx/include/__concepts/swappable.h
@@ -22,7 +22,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/__config b/libcxx/include/__config
index 4bf171f998c6f05..2075566be464c91 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -827,8 +827,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_END_NAMESPACE_STD }}
# define _VSTD std
-_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
-
# if _LIBCPP_STD_VER >= 17
# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
_LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem {
@@ -1500,6 +1498,13 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
# define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
+// define a few very widely used type aliases
+_LIBCPP_BEGIN_NAMESPACE_STD
+using size_t = __SIZE_TYPE__;
+using ptrdiff_t = __PTRDIFF_TYPE__;
+using nullptr_t = decltype(nullptr);
+_LIBCPP_END_NAMESPACE_STD
+
#endif // __cplusplus
#endif // _LIBCPP___CONFIG
diff --git a/libcxx/include/__coroutine/coroutine_handle.h b/libcxx/include/__coroutine/coroutine_handle.h
index 7a4eff745eb7aa8..33fc24dd6f5fe98 100644
--- a/libcxx/include/__coroutine/coroutine_handle.h
+++ b/libcxx/include/__coroutine/coroutine_handle.h
@@ -15,7 +15,6 @@
#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 970d8196724b7cb..de3491f048fffb1 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -12,7 +12,6 @@
#include <__config>
#include <__exception/operations.h>
#include <__memory/addressof.h>
-#include <cstddef>
#include <cstdlib>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__exception/nested_exception.h b/libcxx/include/__exception/nested_exception.h
index 769da191aa2d45d..119a39345d4810f 100644
--- a/libcxx/include/__exception/nested_exception.h
+++ b/libcxx/include/__exception/nested_exception.h
@@ -13,6 +13,7 @@
#include <__exception/exception_ptr.h>
#include <__memory/addressof.h>
#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_base_of.h>
#include <__type_traits/is_class.h>
#include <__type_traits/is_convertible.h>
@@ -20,7 +21,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 78e7c7a5d0b51d4..86c5086d8edbe7e 100644
--- a/libcxx/include/__exception/operations.h
+++ b/libcxx/include/__exception/operations.h
@@ -11,7 +11,6 @@
#include <__availability>
#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 632c2c806369b80..8db8046810ab722 100644
--- a/libcxx/include/__filesystem/directory_iterator.h
+++ b/libcxx/include/__filesystem/directory_iterator.h
@@ -23,7 +23,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 8a9350be2a00f77..240a187bd6c5025 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -23,7 +23,6 @@
#include <__type_traits/is_pointer.h>
#include <__type_traits/remove_const.h>
#include <__type_traits/remove_pointer.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 9961b46cf81c0e9..bc9693cbb31f475 100644
--- a/libcxx/include/__filesystem/path_iterator.h
+++ b/libcxx/include/__filesystem/path_iterator.h
@@ -15,7 +15,6 @@
#include <__config>
#include <__filesystem/path.h>
#include <__iterator/iterator_traits.h>
-#include <cstddef>
#include <string>
#include <string_view>
diff --git a/libcxx/include/__filesystem/recursive_directory_iterator.h b/libcxx/include/__filesystem/recursive_directory_iterator.h
index c38d58e50215901..5c08b1a73325f23 100644
--- a/libcxx/include/__filesystem/recursive_directory_iterator.h
+++ b/libcxx/include/__filesystem/recursive_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/__format/buffer.h b/libcxx/include/__format/buffer.h
index c0502971ce127ad..7d9a170eae0c12c 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 222847e6af6747f..44574eaa6052fde 100644
--- a/libcxx/include/__format/escaped_output_table.h
+++ b/libcxx/include/__format/escaped_output_table.h
@@ -63,7 +63,6 @@
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
-#include <cstddef>
#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 bd6d39fdc7c2d14..48ece04a4bf10f0 100644
--- a/libcxx/include/__format/extended_grapheme_cluster_table.h
+++ b/libcxx/include/__format/extended_grapheme_cluster_table.h
@@ -64,7 +64,6 @@
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
#include <__iterator/access.h>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/format_args.h b/libcxx/include/__format/format_args.h
index defb42a4ab0067f..206c527c6403af0 100644
--- a/libcxx/include/__format/format_args.h
+++ b/libcxx/include/__format/format_args.h
@@ -15,7 +15,6 @@
#include <__format/format_arg.h>
#include <__format/format_arg_store.h>
#include <__format/format_fwd.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 9d50cee2483f347..9f50380d7e50b8d 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -24,7 +24,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 2e1c71b3d01b247..c50c1d07ac54d2e 100644
--- a/libcxx/include/__format/format_string.h
+++ b/libcxx/include/__format/format_string.h
@@ -15,7 +15,6 @@
#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 9bf48df21961ddb..6c9f2bdc027f9bd 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -35,7 +35,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 072305b6dbca10c..1c451e06b456e36 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -27,7 +27,6 @@
#include <__memory/addressof.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 a2212611df488e3..64b0f04eaffbb3d 100644
--- a/libcxx/include/__format/formatter_pointer.h
+++ b/libcxx/include/__format/formatter_pointer.h
@@ -18,7 +18,6 @@
#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/width_estimation_table.h b/libcxx/include/__format/width_estimation_table.h
index cfb488975d57127..11a9ff02122aead 100644
--- a/libcxx/include/__format/width_estimation_table.h
+++ b/libcxx/include/__format/width_estimation_table.h
@@ -63,7 +63,6 @@
#include <__algorithm/ranges_upper_bound.h>
#include <__config>
-#include <cstddef>
#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 364ab8d49ba5e01..e149135aa19ac10 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -16,7 +16,6 @@
#include <__type_traits/decay.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 87307f7f9934493..286653351723c2a 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -23,7 +23,6 @@
#include <__utility/move.h>
#include <__utility/pair.h>
#include <__utility/swap.h>
-#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
diff --git a/libcxx/include/__fwd/array.h b/libcxx/include/__fwd/array.h
index 9a79effb617d260..b7ea7dbed1bec56 100644
--- a/libcxx/include/__fwd/array.h
+++ b/libcxx/include/__fwd/array.h
@@ -10,7 +10,6 @@
#define _LIBCPP___FWD_ARRAY_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__fwd/get.h b/libcxx/include/__fwd/get.h
index d04341496c60dbc..193bc0224a97580 100644
--- a/libcxx/include/__fwd/get.h
+++ b/libcxx/include/__fwd/get.h
@@ -16,7 +16,6 @@
#include <__fwd/subrange.h>
#include <__fwd/tuple.h>
#include <__tuple/tuple_element.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__fwd/span.h
index e9fa70382f59048..d9a4a0bae32477d 100644
--- a/libcxx/include/__fwd/span.h
+++ b/libcxx/include/__fwd/span.h
@@ -11,7 +11,6 @@
#define _LIBCPP___FWD_SPAN_H
#include <__config>
-#include <cstddef>
#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/access.h b/libcxx/include/__iterator/access.h
index 2782400ea771be6..68685504b2005c6 100644
--- a/libcxx/include/__iterator/access.h
+++ b/libcxx/include/__iterator/access.h
@@ -11,7 +11,6 @@
#define _LIBCPP___ITERATOR_ACCESS_H
#include <__config>
-#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 a0083da1519fa7b..db85adbe231512c 100644
--- a/libcxx/include/__iterator/back_insert_iterator.h
+++ b/libcxx/include/__iterator/back_insert_iterator.h
@@ -15,7 +15,6 @@
#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 f10680744fc31c5..ed003481f69b4a6 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 2cd4c7abf48cb4b..ca1cdf16ee5bd0b 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 7c77daebb299e92..80cf778535dfa7c 100644
--- a/libcxx/include/__iterator/front_insert_iterator.h
+++ b/libcxx/include/__iterator/front_insert_iterator.h
@@ -15,7 +15,6 @@
#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 604e9580ef7cadc..284e1e7efd24187 100644
--- a/libcxx/include/__iterator/incrementable_traits.h
+++ b/libcxx/include/__iterator/incrementable_traits.h
@@ -18,7 +18,6 @@
#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 4e833733d202274..94ebc6ff8715105 100644
--- a/libcxx/include/__iterator/insert_iterator.h
+++ b/libcxx/include/__iterator/insert_iterator.h
@@ -16,7 +16,6 @@
#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 989902f212bdeb2..0036586933d6517 100644
--- a/libcxx/include/__iterator/istream_iterator.h
+++ b/libcxx/include/__iterator/istream_iterator.h
@@ -15,7 +15,6 @@
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
-#include <cstddef>
#include <iosfwd> // for forward declarations of char_traits and basic_istream
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/iterator.h b/libcxx/include/__iterator/iterator.h
index b417eeab79bfe66..75d48e440ad3097 100644
--- a/libcxx/include/__iterator/iterator.h
+++ b/libcxx/include/__iterator/iterator.h
@@ -11,7 +11,6 @@
#define _LIBCPP___ITERATOR_ITERATOR_H
#include <__config>
-#include <cstddef>
#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 248987e9b5605ba..186eb82a1183bcd 100644
--- a/libcxx/include/__iterator/iterator_traits.h
+++ b/libcxx/include/__iterator/iterator_traits.h
@@ -25,6 +25,7 @@
#include <__type_traits/common_reference.h>
#include <__type_traits/conditional.h>
#include <__type_traits/disjunction.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_convertible.h>
#include <__type_traits/is_object.h>
#include <__type_traits/is_primary_template.h>
@@ -35,7 +36,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 025712bb1ca96b6..41fc84fdd2e2048 100644
--- a/libcxx/include/__iterator/ostream_iterator.h
+++ b/libcxx/include/__iterator/ostream_iterator.h
@@ -14,7 +14,6 @@
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
-#include <cstddef>
#include <iosfwd> // for forward declarations of char_traits and basic_ostream
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/ostreambuf_iterator.h b/libcxx/include/__iterator/ostreambuf_iterator.h
index 898ef90e7e85c5e..5715384fc2854a7 100644
--- a/libcxx/include/__iterator/ostreambuf_iterator.h
+++ b/libcxx/include/__iterator/ostreambuf_iterator.h
@@ -13,7 +13,6 @@
#include <__config>
#include <__iterator/iterator.h>
#include <__iterator/iterator_traits.h>
-#include <cstddef>
#include <iosfwd> // for forward declaration of basic_streambuf
#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 b8c5a071cc63f6b..d74fbf8714870b3 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 f3cd1e5fa1f5da2..e2a92d55845f767 100644
--- a/libcxx/include/__iterator/segmented_iterator.h
+++ b/libcxx/include/__iterator/segmented_iterator.h
@@ -42,7 +42,6 @@
#include <__config>
#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 625eeb165bf5adc..94b8f5dd07ef9d8 100644
--- a/libcxx/include/__iterator/size.h
+++ b/libcxx/include/__iterator/size.h
@@ -13,7 +13,6 @@
#include <__config>
#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 8cab2179cfef09f..37ecbd46a180a97 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -16,7 +16,6 @@
#include <__memory/pointer_traits.h>
#include <__type_traits/enable_if.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/__locale b/libcxx/include/__locale
index 90dcad3590c3d21..5a1dce5a2098120 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -22,7 +22,6 @@
#include <string>
// Some platforms require more includes than others. Keep the includes on all plaforms for now.
-#include <cstddef>
#include <cstring>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
diff --git a/libcxx/include/__mdspan/default_accessor.h b/libcxx/include/__mdspan/default_accessor.h
index 1cc5f15545fc8cb..46c4e5a233497f6 100644
--- a/libcxx/include/__mdspan/default_accessor.h
+++ b/libcxx/include/__mdspan/default_accessor.h
@@ -23,7 +23,6 @@
#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 f6bcd940ee6077d..900614d7b0d3e09 100644
--- a/libcxx/include/__mdspan/extents.h
+++ b/libcxx/include/__mdspan/extents.h
@@ -21,6 +21,7 @@
#include <__config>
#include <__type_traits/common_type.h>
#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_integral.h>
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_same.h>
#include <__type_traits/make_unsigned.h>
@@ -29,7 +30,6 @@
#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 fd644fa0c53226b..07b6bad6d9951b7 100644
--- a/libcxx/include/__mdspan/layout_left.h
+++ b/libcxx/include/__mdspan/layout_left.h
@@ -27,7 +27,6 @@
#include <__utility/integer_sequence.h>
#include <array>
#include <cinttypes>
-#include <cstddef>
#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__mdspan/layout_right.h b/libcxx/include/__mdspan/layout_right.h
index 8e64d07dd52309c..5ad471ede93b8bb 100644
--- a/libcxx/include/__mdspan/layout_right.h
+++ b/libcxx/include/__mdspan/layout_right.h
@@ -26,7 +26,6 @@
#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)
diff --git a/libcxx/include/__mdspan/layout_stride.h b/libcxx/include/__mdspan/layout_stride.h
index 77934bfa11d9de0..0e9169ecd7c94db 100644
--- a/libcxx/include/__mdspan/layout_stride.h
+++ b/libcxx/include/__mdspan/layout_stride.h
@@ -29,7 +29,6 @@
#include <__utility/swap.h>
#include <array>
#include <cinttypes>
-#include <cstddef>
#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__mdspan/mdspan.h b/libcxx/include/__mdspan/mdspan.h
index 58f3b9cf1b18a45..c9ec9b729326d39 100644
--- a/libcxx/include/__mdspan/mdspan.h
+++ b/libcxx/include/__mdspan/mdspan.h
@@ -39,7 +39,6 @@
#include <__utility/integer_sequence.h>
#include <array>
#include <cinttypes>
-#include <cstddef>
#include <limits>
#include <span>
diff --git a/libcxx/include/__memory/align.h b/libcxx/include/__memory/align.h
index bbb995f4a8c8edd..66dabf31d9d8a1d 100644
--- a/libcxx/include/__memory/align.h
+++ b/libcxx/include/__memory/align.h
@@ -10,7 +10,6 @@
#define _LIBCPP___MEMORY_ALIGN_H
#include <__config>
-#include <cstddef>
#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 786963c72dfcdcd..96c6d6d54e47bfe 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 8d8ad071e2c2b8f..1f5cfd13a0a13e5 100644
--- a/libcxx/include/__memory/allocate_at_least.h
+++ b/libcxx/include/__memory/allocate_at_least.h
@@ -11,7 +11,6 @@
#include <__config>
#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 f63b17430ed1b1b..85a04aa90f58359 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 47e1ef926a4afe4..839d1d4b56b3824 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -19,7 +19,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/assume_aligned.h b/libcxx/include/__memory/assume_aligned.h
index bce00bf02a718c0..be4ef9b4e298199 100644
--- a/libcxx/include/__memory/assume_aligned.h
+++ b/libcxx/include/__memory/assume_aligned.h
@@ -13,7 +13,6 @@
#include <__assert>
#include <__config>
#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 ab449ad29987004..4b86c79ee42714b 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 f24b2bac5664472..3be2ecd158bc1b9 100644
--- a/libcxx/include/__memory/compressed_pair.h
+++ b/libcxx/include/__memory/compressed_pair.h
@@ -25,7 +25,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/__memory/destruct_n.h b/libcxx/include/__memory/destruct_n.h
index 2cfb2e4c88ce1a2..75238722aae1300 100644
--- a/libcxx/include/__memory/destruct_n.h
+++ b/libcxx/include/__memory/destruct_n.h
@@ -12,7 +12,6 @@
#include <__config>
#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 7617948ed76bd66..2cb0a60f438d7ed 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -15,12 +15,12 @@
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_class.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_void.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/__memory/raw_storage_iterator.h b/libcxx/include/__memory/raw_storage_iterator.h
index df7ef5afe7d4bc8..1d870b45541b199 100644
--- a/libcxx/include/__memory/raw_storage_iterator.h
+++ b/libcxx/include/__memory/raw_storage_iterator.h
@@ -15,7 +15,6 @@
#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 d9ddb8a17be273f..10186163e6180c6 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -33,6 +33,7 @@
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/disjunction.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_bounded_array.h>
#include <__type_traits/is_convertible.h>
@@ -48,7 +49,6 @@
#include <__utility/move.h>
#include <__utility/swap.h>
#include <__verbose_abort>
-#include <cstddef>
#include <iosfwd>
#include <new>
#include <stdexcept>
diff --git a/libcxx/include/__memory/temporary_buffer.h b/libcxx/include/__memory/temporary_buffer.h
index c917f041a014785..619ed49291fd3c1 100644
--- a/libcxx/include/__memory/temporary_buffer.h
+++ b/libcxx/include/__memory/temporary_buffer.h
@@ -13,7 +13,6 @@
#include <__config>
#include <__type_traits/alignment_of.h>
#include <__utility/pair.h>
-#include <cstddef>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 93a77b76dbd824c..c460e9dfb32968f 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -22,6 +22,7 @@
#include <__type_traits/add_lvalue_reference.h>
#include <__type_traits/common_type.h>
#include <__type_traits/dependent_type.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_assignable.h>
@@ -38,7 +39,6 @@
#include <__type_traits/type_identity.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/__memory/uses_allocator.h b/libcxx/include/__memory/uses_allocator.h
index f82ac1796383f88..ae2de5571fb2091 100644
--- a/libcxx/include/__memory/uses_allocator.h
+++ b/libcxx/include/__memory/uses_allocator.h
@@ -12,7 +12,6 @@
#include <__config>
#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/pool_options.h b/libcxx/include/__memory_resource/pool_options.h
index 442959836c7ef3f..76a89e0f23a253e 100644
--- a/libcxx/include/__memory_resource/pool_options.h
+++ b/libcxx/include/__memory_resource/pool_options.h
@@ -10,7 +10,6 @@
#define _LIBCPP___MEMORY_RESOURCE_POOL_OPTIONS_H
#include <__config>
-#include <cstddef>
#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 b261fb0b194a8e9..e4e9acd00f14946 100644
--- a/libcxx/include/__memory_resource/synchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/synchronized_pool_resource.h
@@ -14,7 +14,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 81d5f9ec4da87d9..7d0e9ac5645e74a 100644
--- a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
@@ -13,7 +13,6 @@
#include <__config>
#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 5325f5e6b322a79..dd3c28548951da5 100644
--- a/libcxx/include/__numeric/midpoint.h
+++ b/libcxx/include/__numeric/midpoint.h
@@ -21,7 +21,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/__random/discard_block_engine.h b/libcxx/include/__random/discard_block_engine.h
index 734cb257c3178ee..afe2f1f5bc59cbb 100644
--- a/libcxx/include/__random/discard_block_engine.h
+++ b/libcxx/include/__random/discard_block_engine.h
@@ -14,7 +14,6 @@
#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 a6546faae851395..08205062f236fda 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 0164ce08fb5d4bd..4dec635ca666da2 100644
--- a/libcxx/include/__random/independent_bits_engine.h
+++ b/libcxx/include/__random/independent_bits_engine.h
@@ -16,7 +16,6 @@
#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/log2.h b/libcxx/include/__random/log2.h
index 4ccd1ddc9bf23b6..0985774dff30763 100644
--- a/libcxx/include/__random/log2.h
+++ b/libcxx/include/__random/log2.h
@@ -11,7 +11,6 @@
#include <__config>
#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 9a06cfdb0080e20..4e17fcc434cfef2 100644
--- a/libcxx/include/__random/mersenne_twister_engine.h
+++ b/libcxx/include/__random/mersenne_twister_engine.h
@@ -13,7 +13,7 @@
#include <__algorithm/min.h>
#include <__config>
#include <__random/is_seed_sequence.h>
-#include <cstddef>
+#include <__type_traits/enable_if.h>
#include <cstdint>
#include <iosfwd>
#include <limits>
diff --git a/libcxx/include/__random/seed_seq.h b/libcxx/include/__random/seed_seq.h
index 506b979cf81262f..9e6837d362f09b0 100644
--- a/libcxx/include/__random/seed_seq.h
+++ b/libcxx/include/__random/seed_seq.h
@@ -14,6 +14,8 @@
#include <__algorithm/max.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_integral.h>
#include <cstdint>
#include <initializer_list>
#include <vector>
diff --git a/libcxx/include/__random/shuffle_order_engine.h b/libcxx/include/__random/shuffle_order_engine.h
index 2c7c22db1feea21..3a35f253dd0688a 100644
--- a/libcxx/include/__random/shuffle_order_engine.h
+++ b/libcxx/include/__random/shuffle_order_engine.h
@@ -16,7 +16,6 @@
#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 2f0b1c7a65c2390..5ec67144a7ed903 100644
--- a/libcxx/include/__random/subtract_with_carry_engine.h
+++ b/libcxx/include/__random/subtract_with_carry_engine.h
@@ -14,7 +14,7 @@
#include <__config>
#include <__random/is_seed_sequence.h>
#include <__random/linear_congruential_engine.h>
-#include <cstddef>
+#include <__type_traits/enable_if.h>
#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 3a2b95c035b3c75..df9e0cd42d64db4 100644
--- a/libcxx/include/__random/uniform_int_distribution.h
+++ b/libcxx/include/__random/uniform_int_distribution.h
@@ -15,7 +15,6 @@
#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 502bd5e951c4a63..8f8829cfb6ac632 100644
--- a/libcxx/include/__ranges/access.h
+++ b/libcxx/include/__ranges/access.h
@@ -21,7 +21,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 882f90b1ed82e7c..fe883903f80ab3d 100644
--- a/libcxx/include/__ranges/counted.h
+++ b/libcxx/include/__ranges/counted.h
@@ -22,7 +22,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 f10476f0011e739..37c8a11ff7522bd 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 325e4c9dca63994..2abfec40affeaf0 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>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/empty_view.h b/libcxx/include/__ranges/empty_view.h
index bb445b4e6f94f19..2b0006c9c2e5de6 100644
--- a/libcxx/include/__ranges/empty_view.h
+++ b/libcxx/include/__ranges/empty_view.h
@@ -14,7 +14,6 @@
#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 66cd91527616aea..b857cd8bed41893 100644
--- a/libcxx/include/__ranges/istream_view.h
+++ b/libcxx/include/__ranges/istream_view.h
@@ -20,7 +20,6 @@
#include <__ranges/view_interface.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
-#include <cstddef>
#include <iosfwd>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__ranges/single_view.h b/libcxx/include/__ranges/single_view.h
index 5724e2d1b6d5f42..073de824e277fe4 100644
--- a/libcxx/include/__ranges/single_view.h
+++ b/libcxx/include/__ranges/single_view.h
@@ -20,7 +20,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 f22dd1ff7b79f3b..82f2c3933af4a99 100644
--- a/libcxx/include/__ranges/size.h
+++ b/libcxx/include/__ranges/size.h
@@ -22,7 +22,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 75f9284a582ff1a..6860a63685dc00d 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -34,13 +34,13 @@
#include <__tuple/tuple_size.h>
#include <__type_traits/conditional.h>
#include <__type_traits/decay.h>
+#include <__type_traits/integral_constant.h>
#include <__type_traits/is_pointer.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/make_unsigned.h>
#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 4204017d9249bcf..18aa633cf4596b5 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 cf162100ee46b72..3f7c7540b6cb05a 100644
--- a/libcxx/include/__ranges/to.h
+++ b/libcxx/include/__ranges/to.h
@@ -32,7 +32,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 da73f4c83225683..4aa511933339e93 100644
--- a/libcxx/include/__split_buffer
+++ b/libcxx/include/__split_buffer
@@ -34,7 +34,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 f00cea5bc2b6706..53e97be8f5a27ce 100644
--- a/libcxx/include/__stop_token/intrusive_shared_ptr.h
+++ b/libcxx/include/__stop_token/intrusive_shared_ptr.h
@@ -16,7 +16,6 @@
#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 ca9867c39067d5d..90b0aedf158c85d 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -20,7 +20,6 @@
#include <__iterator/iterator_traits.h>
#include <__string/constexpr_c_functions.h>
#include <__type_traits/is_constant_evaluated.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 198f0f5e6809147..6c2e0de2bc3e1bd 100644
--- a/libcxx/include/__string/constexpr_c_functions.h
+++ b/libcxx/include/__string/constexpr_c_functions.h
@@ -13,17 +13,18 @@
#include <__memory/addressof.h>
#include <__memory/construct_at.h>
#include <__type_traits/datasizeof.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_always_bitcastable.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_equality_comparable.h>
+#include <__type_traits/is_integral.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_trivially_copyable.h>
#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/__support/win32/locale_win32.h b/libcxx/include/__support/win32/locale_win32.h
index d40e80e344e682a..ece4923f8ba31c3 100644
--- a/libcxx/include/__support/win32/locale_win32.h
+++ b/libcxx/include/__support/win32/locale_win32.h
@@ -11,7 +11,6 @@
#define _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H
#include <__config>
-#include <cstddef>
#include <locale.h> // _locale_t
#include <stdio.h>
#include <string>
diff --git a/libcxx/include/__system_error/error_code.h b/libcxx/include/__system_error/error_code.h
index 475f2bb96a56d93..6fa673b4ff713b3 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 42898c1f0e90133..bfee6528c3f1d26 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/__tuple/make_tuple_types.h b/libcxx/include/__tuple/make_tuple_types.h
index aee2bde89c7f9a4..9deeb08774d3000 100644
--- a/libcxx/include/__tuple/make_tuple_types.h
+++ b/libcxx/include/__tuple/make_tuple_types.h
@@ -19,7 +19,6 @@
#include <__type_traits/apply_cv.h>
#include <__type_traits/remove_cv.h>
#include <__type_traits/remove_reference.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__tuple/sfinae_helpers.h b/libcxx/include/__tuple/sfinae_helpers.h
index 2fffac9efda18b3..67c64120639fc53 100644
--- a/libcxx/include/__tuple/sfinae_helpers.h
+++ b/libcxx/include/__tuple/sfinae_helpers.h
@@ -24,7 +24,6 @@
#include <__type_traits/is_same.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_reference.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__tuple/tuple_element.h b/libcxx/include/__tuple/tuple_element.h
index 478dd089d46c66c..9af286dbe9ce820 100644
--- a/libcxx/include/__tuple/tuple_element.h
+++ b/libcxx/include/__tuple/tuple_element.h
@@ -15,7 +15,6 @@
#include <__type_traits/add_const.h>
#include <__type_traits/add_cv.h>
#include <__type_traits/add_volatile.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__tuple/tuple_indices.h b/libcxx/include/__tuple/tuple_indices.h
index 18666d5948c9b08..2b8767ce910a375 100644
--- a/libcxx/include/__tuple/tuple_indices.h
+++ b/libcxx/include/__tuple/tuple_indices.h
@@ -11,7 +11,6 @@
#include <__config>
#include <__utility/integer_sequence.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__tuple/tuple_like.h b/libcxx/include/__tuple/tuple_like.h
index dab395be616b7d2..3548af971ce2859 100644
--- a/libcxx/include/__tuple/tuple_like.h
+++ b/libcxx/include/__tuple/tuple_like.h
@@ -16,7 +16,6 @@
#include <__fwd/tuple.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/__tuple/tuple_like_ext.h b/libcxx/include/__tuple/tuple_like_ext.h
index 36f5c4896ffeae5..693220d7583b34f 100644
--- a/libcxx/include/__tuple/tuple_like_ext.h
+++ b/libcxx/include/__tuple/tuple_like_ext.h
@@ -15,7 +15,6 @@
#include <__fwd/tuple.h>
#include <__tuple/tuple_types.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/__tuple/tuple_size.h b/libcxx/include/__tuple/tuple_size.h
index 26f9d9725d31645..19059bebf81ae59 100644
--- a/libcxx/include/__tuple/tuple_size.h
+++ b/libcxx/include/__tuple/tuple_size.h
@@ -12,9 +12,10 @@
#include <__config>
#include <__fwd/tuple.h>
#include <__tuple/tuple_types.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/integral_constant.h>
#include <__type_traits/is_const.h>
#include <__type_traits/is_volatile.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/aligned_storage.h b/libcxx/include/__type_traits/aligned_storage.h
index 46aae12832f8674..e87bc2f4c16507d 100644
--- a/libcxx/include/__type_traits/aligned_storage.h
+++ b/libcxx/include/__type_traits/aligned_storage.h
@@ -14,7 +14,6 @@
#include <__type_traits/integral_constant.h>
#include <__type_traits/nat.h>
#include <__type_traits/type_list.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/aligned_union.h b/libcxx/include/__type_traits/aligned_union.h
index 005ed9a096ea8eb..2b3d36a79c916df 100644
--- a/libcxx/include/__type_traits/aligned_union.h
+++ b/libcxx/include/__type_traits/aligned_union.h
@@ -12,7 +12,6 @@
#include <__config>
#include <__type_traits/aligned_storage.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/__type_traits/alignment_of.h b/libcxx/include/__type_traits/alignment_of.h
index f2d069bf2488f72..ae6855d6f45e8fb 100644
--- a/libcxx/include/__type_traits/alignment_of.h
+++ b/libcxx/include/__type_traits/alignment_of.h
@@ -11,7 +11,6 @@
#include <__config>
#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/__type_traits/datasizeof.h b/libcxx/include/__type_traits/datasizeof.h
index 5688e3293a69eb5..2069d5e066d6b05 100644
--- a/libcxx/include/__type_traits/datasizeof.h
+++ b/libcxx/include/__type_traits/datasizeof.h
@@ -12,7 +12,6 @@
#include <__config>
#include <__type_traits/is_class.h>
#include <__type_traits/is_final.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -51,7 +50,7 @@ struct __libcpp_datasizeof {
// the use as an extension.
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-offsetof")
- static const size_t value = offsetof(_FirstPaddingByte<>, __first_padding_byte_);
+ static const size_t value = __builtin_offsetof(_FirstPaddingByte<>, __first_padding_byte_);
_LIBCPP_DIAGNOSTIC_POP
};
diff --git a/libcxx/include/__type_traits/extent.h b/libcxx/include/__type_traits/extent.h
index bab03fe997eb6b0..da3bac0dd2092db 100644
--- a/libcxx/include/__type_traits/extent.h
+++ b/libcxx/include/__type_traits/extent.h
@@ -11,7 +11,6 @@
#include <__config>
#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/__type_traits/is_allocator.h b/libcxx/include/__type_traits/is_allocator.h
index 144ffac4d7ce5b0..810603cd7c13082 100644
--- a/libcxx/include/__type_traits/is_allocator.h
+++ b/libcxx/include/__type_traits/is_allocator.h
@@ -13,7 +13,6 @@
#include <__type_traits/integral_constant.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/__type_traits/is_array.h b/libcxx/include/__type_traits/is_array.h
index 5b0e0e6f46b8188..b2fcf5eeec09221 100644
--- a/libcxx/include/__type_traits/is_array.h
+++ b/libcxx/include/__type_traits/is_array.h
@@ -11,7 +11,6 @@
#include <__config>
#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/__type_traits/is_bounded_array.h b/libcxx/include/__type_traits/is_bounded_array.h
index 211403d638d08c8..ad17c5df883b199 100644
--- a/libcxx/include/__type_traits/is_bounded_array.h
+++ b/libcxx/include/__type_traits/is_bounded_array.h
@@ -11,7 +11,6 @@
#include <__config>
#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/__type_traits/is_convertible.h b/libcxx/include/__type_traits/is_convertible.h
index bc91d8b234308af..cc9956feff05719 100644
--- a/libcxx/include/__type_traits/is_convertible.h
+++ b/libcxx/include/__type_traits/is_convertible.h
@@ -16,7 +16,6 @@
#include <__type_traits/is_void.h>
#include <__type_traits/remove_reference.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/is_member_function_pointer.h b/libcxx/include/__type_traits/is_member_function_pointer.h
index 11c8a00c9975678..f2016208f584496 100644
--- a/libcxx/include/__type_traits/is_member_function_pointer.h
+++ b/libcxx/include/__type_traits/is_member_function_pointer.h
@@ -13,7 +13,6 @@
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_function.h>
#include <__type_traits/remove_cv.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/is_nothrow_constructible.h b/libcxx/include/__type_traits/is_nothrow_constructible.h
index 4949062433b783d..7032e7e58692a8c 100644
--- a/libcxx/include/__type_traits/is_nothrow_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_constructible.h
@@ -14,7 +14,6 @@
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_reference.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/is_nothrow_destructible.h b/libcxx/include/__type_traits/is_nothrow_destructible.h
index 370ba27ecd1f1cf..be0f9acbfde4329 100644
--- a/libcxx/include/__type_traits/is_nothrow_destructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_destructible.h
@@ -16,7 +16,6 @@
#include <__type_traits/is_scalar.h>
#include <__type_traits/remove_all_extents.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/is_null_pointer.h b/libcxx/include/__type_traits/is_null_pointer.h
index c666f5f24759c98..b4957d468318c59 100644
--- a/libcxx/include/__type_traits/is_null_pointer.h
+++ b/libcxx/include/__type_traits/is_null_pointer.h
@@ -12,7 +12,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/remove_cv.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
index ea8c03a8aaa0cd8..329388952a880eb 100644
--- a/libcxx/include/__type_traits/is_swappable.h
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -22,7 +22,6 @@
#include <__type_traits/is_void.h>
#include <__type_traits/nat.h>
#include <__utility/declval.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/rank.h b/libcxx/include/__type_traits/rank.h
index 7f6fad1c540245b..079378b7b17862e 100644
--- a/libcxx/include/__type_traits/rank.h
+++ b/libcxx/include/__type_traits/rank.h
@@ -11,7 +11,6 @@
#include <__config>
#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/__type_traits/remove_all_extents.h b/libcxx/include/__type_traits/remove_all_extents.h
index d5373b51f52215e..506f3cfd134c950 100644
--- a/libcxx/include/__type_traits/remove_all_extents.h
+++ b/libcxx/include/__type_traits/remove_all_extents.h
@@ -10,7 +10,6 @@
#define _LIBCPP___TYPE_TRAITS_REMOVE_ALL_EXTENTS_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/remove_extent.h b/libcxx/include/__type_traits/remove_extent.h
index fe37b5c7266c6ba..ffac071c55fc11a 100644
--- a/libcxx/include/__type_traits/remove_extent.h
+++ b/libcxx/include/__type_traits/remove_extent.h
@@ -10,7 +10,6 @@
#define _LIBCPP___TYPE_TRAITS_REMOVE_EXTENT_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/remove_reference.h b/libcxx/include/__type_traits/remove_reference.h
index fd66417bd84fedb..566246784cf348a 100644
--- a/libcxx/include/__type_traits/remove_reference.h
+++ b/libcxx/include/__type_traits/remove_reference.h
@@ -10,7 +10,6 @@
#define _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/type_list.h b/libcxx/include/__type_traits/type_list.h
index 02905707ee37a29..7cdf03c5025ea1e 100644
--- a/libcxx/include/__type_traits/type_list.h
+++ b/libcxx/include/__type_traits/type_list.h
@@ -10,7 +10,6 @@
#define _LIBCPP___TYPE_TRAITS_TYPE_LIST_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__utility/in_place.h b/libcxx/include/__utility/in_place.h
index 5b878529fb21a09..6e2971b159f5ed5 100644
--- a/libcxx/include/__utility/in_place.h
+++ b/libcxx/include/__utility/in_place.h
@@ -10,8 +10,8 @@
#define _LIBCPP___UTILITY_IN_PLACE_H
#include <__config>
+#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 633b387d02ed20b..47de237230337d3 100644
--- a/libcxx/include/__utility/integer_sequence.h
+++ b/libcxx/include/__utility/integer_sequence.h
@@ -11,7 +11,6 @@
#include <__config>
#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 535344eb1e2d63f..6daadbafc0de353 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -27,6 +27,7 @@
#include <__type_traits/common_type.h>
#include <__type_traits/conditional.h>
#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_constructible.h>
@@ -50,7 +51,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 e51ba6bfcc05045..3799b6592e8d986 100644
--- a/libcxx/include/__utility/priority_tag.h
+++ b/libcxx/include/__utility/priority_tag.h
@@ -10,7 +10,6 @@
#define _LIBCPP___UTILITY_PRIORITY_TAG_H
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__utility/swap.h b/libcxx/include/__utility/swap.h
index 91c928a9fdf1c5a..b71e2b1b10690de 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 <__type_traits/enable_if.h>
#include <__type_traits/is_move_assignable.h>
#include <__type_traits/is_move_constructible.h>
#include <__type_traits/is_nothrow_move_assignable.h>
@@ -17,7 +18,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 8fec34008f2d5d8..c5bb84b39746ec4 100644
--- a/libcxx/include/__variant/monostate.h
+++ b/libcxx/include/__variant/monostate.h
@@ -13,7 +13,6 @@
#include <__compare/ordering.h>
#include <__config>
#include <__functional/hash.h>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 7dcf396b683db4f..fda456f581b5e54 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -1754,7 +1754,6 @@ template <class BidirectionalIterator, class Compare>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
-#include <cstddef>
#include <version>
#include <__algorithm/adjacent_find.h>
@@ -1974,6 +1973,7 @@ template <class BidirectionalIterator, class Compare>
# include <atomic>
# include <bit>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <cstring>
# include <iterator>
diff --git a/libcxx/include/any b/libcxx/include/any
index b3ac5871c42fc2c..8efd87089e925c3 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -93,6 +93,7 @@ namespace std {
#include <__type_traits/alignment_of.h>
#include <__type_traits/conditional.h>
#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_copy_constructible.h>
#include <__type_traits/is_function.h>
@@ -722,6 +723,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <iosfwd>
# include <iterator>
diff --git a/libcxx/include/array b/libcxx/include/array
index c01d13ef358a550..0964659aaa4052e 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -546,6 +546,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <algorithm>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <iterator>
# include <type_traits>
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index 2f122a707bdc33a..63f49a3c957274f 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -551,6 +551,7 @@ template <class T>
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cmath>
# include <compare>
+# include <cstddef>
# include <cstring>
# include <type_traits>
#endif
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index e0d63fa59ffda7b..76dbe16218bfb18 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -54,7 +54,6 @@ namespace std
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>
#include <__utility/move.h>
-#include <cstddef>
#include <cstdint>
#include <limits>
#include <version>
@@ -355,6 +354,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <iterator>
# include <memory>
# include <stdexcept>
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index a3b1dc3a4535715..36d3f4fed414f84 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -132,7 +132,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>
@@ -1172,6 +1171,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <type_traits>
#endif
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index 92273b4ce4766b4..fc680d1de4ff36f 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -96,6 +96,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <cstring>
# include <iosfwd>
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index becf95c0d03e6d3..a741dbdc1466ff0 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -845,6 +845,7 @@ constexpr chrono::year operator ""y(unsigned lo
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <bit>
# include <concepts>
+# include <cstddef>
# include <cstring>
# include <forward_list>
# include <string>
diff --git a/libcxx/include/compare b/libcxx/include/compare
index 626c7435f5fd096..56e0bec2a83356f 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -162,6 +162,7 @@ namespace std {
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <type_traits>
#endif
diff --git a/libcxx/include/concepts b/libcxx/include/concepts
index 196fa2e0ea7069c..e6383bc79a14c5e 100644
--- a/libcxx/include/concepts
+++ b/libcxx/include/concepts
@@ -156,6 +156,7 @@ namespace std {
#include <version>
#if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES)
+# include <cstddef>
# include <type_traits>
#endif
diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable
index f6d72b48337187b..451ebb28aa5a98f 100644
--- a/libcxx/include/condition_variable
+++ b/libcxx/include/condition_variable
@@ -339,6 +339,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdint>
# include <cstdlib>
# include <cstring>
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index f264570128bb800..21a4227d76998da 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -56,6 +56,7 @@ struct suspend_always;
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <iosfwd>
# include <type_traits>
#endif
diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef
index 3844d4a373323db..3d040476a529513 100644
--- a/libcxx/include/cstddef
+++ b/libcxx/include/cstddef
@@ -56,9 +56,7 @@ Types:
_LIBCPP_BEGIN_NAMESPACE_STD
-using ::nullptr_t;
-using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS;
-using ::size_t _LIBCPP_USING_IF_EXISTS;
+// nullptr_t, ptrdiff_t and size_t are always provided by <__config>
#if !defined(_LIBCPP_CXX03_LANG)
using ::max_align_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/include/cwchar b/libcxx/include/cwchar
index 122af242880e045..5306dee3274bb26 100644
--- a/libcxx/include/cwchar
+++ b/libcxx/include/cwchar
@@ -255,4 +255,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_wmemchr(_Tp
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+#endif
+
#endif // _LIBCPP_CWCHAR
diff --git a/libcxx/include/exception b/libcxx/include/exception
index 97fee977690d0a5..e1b3875966e34a0 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -90,6 +90,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/expected b/libcxx/include/expected
index 486d0a21d087390..44d0ce6b00c81ea 100644
--- a/libcxx/include/expected
+++ b/libcxx/include/expected
@@ -51,4 +51,3 @@ namespace std {
#endif
#endif // _LIBCPP_EXPECTED
-
diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator
index a5e3dffba980bca..cd5bc9843a4c9df 100644
--- a/libcxx/include/experimental/iterator
+++ b/libcxx/include/experimental/iterator
@@ -120,6 +120,7 @@ _LIBCPP_END_NAMESPACE_LFTS
#endif // _LIBCPP_STD_VER >= 14
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <type_traits>
#endif
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 4fc8286465d971f..2a7e719528144c2 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -128,7 +128,6 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
-#include <cstddef>
#include <experimental/__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -600,6 +599,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/filesystem b/libcxx/include/filesystem
index 99ba713ad07ba88..cadba5c1f400ade 100644
--- a/libcxx/include/filesystem
+++ b/libcxx/include/filesystem
@@ -564,6 +564,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <system_error>
#endif
diff --git a/libcxx/include/format b/libcxx/include/format
index c48bcf6e8403930..72891b03298e90c 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -203,4 +203,8 @@ namespace std {
# pragma GCC system_header
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+#endif
+
#endif // _LIBCPP_FORMAT
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index 479d8ed198860c9..310a5fc70e8f39c 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -1749,6 +1749,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <iosfwd>
# include <limits>
diff --git a/libcxx/include/functional b/libcxx/include/functional
index 5f9e8fa82a891f8..ec46088f01893e5 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -553,6 +553,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <exception>
# include <tuple>
diff --git a/libcxx/include/future b/libcxx/include/future
index f372b8e6ad5d8d8..d3744f3037aea1e 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -2474,6 +2474,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
+# include <cstddef>
# include <cstdlib>
# include <exception>
# include <system_error>
diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list
index d97572214404ca0..9f129237f0f22ee 100644
--- a/libcxx/include/initializer_list
+++ b/libcxx/include/initializer_list
@@ -44,7 +44,6 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
-#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -115,4 +114,8 @@ end(initializer_list<_Ep> __il) _NOEXCEPT
} // namespace std
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+#endif
+
#endif // _LIBCPP_INITIALIZER_LIST
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 89370086106c5e6..76035f058e420d6 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1647,6 +1647,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/iterator b/libcxx/include/iterator
index dcba1e1c4fba05b..8b91fcac7a4fea9 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -716,7 +716,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
#include <__iterator/wrap_iter.h>
#include <__memory/addressof.h>
#include <__memory/pointer_traits.h>
-#include <cstddef>
#include <initializer_list>
#include <version>
@@ -731,6 +730,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 47538060eeca787..1ffebd10597133a 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -46,7 +46,6 @@ namespace std
#include <__atomic/memory_order.h>
#include <__availability>
#include <__config>
-#include <cstddef>
#include <limits>
#include <version>
@@ -133,6 +132,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/locale b/libcxx/include/locale
index bf52071374f82fb..cca81c81d775dc5 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -4346,6 +4346,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdarg>
# include <iterator>
# include <mutex>
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index ec110c8c07dede2..a01ba77f64a0f0d 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -563,6 +563,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <cstring>
# include <ctime>
diff --git a/libcxx/include/new b/libcxx/include/new
index 0a97c3e37add574..2aac302618e01f3 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -95,8 +95,6 @@ void operator delete[](void* ptr, void*) noexcept;
#include <__type_traits/is_same.h>
#include <__type_traits/remove_cv.h>
#include <__verbose_abort>
-#include <cstddef>
-#include <cstdlib>
#include <version>
#if defined(_LIBCPP_ABI_VCRUNTIME)
@@ -370,6 +368,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 <exception>
# include <type_traits>
#endif
diff --git a/libcxx/include/numeric b/libcxx/include/numeric
index 3fcf6cefdb4b884..8b50cbd4883296f 100644
--- a/libcxx/include/numeric
+++ b/libcxx/include/numeric
@@ -171,6 +171,7 @@ template<class T>
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <cstddef>
# include <functional>
# include <iterator>
# include <type_traits>
diff --git a/libcxx/include/optional b/libcxx/include/optional
index fc172c752582f00..134dfe123091c14 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -1682,6 +1682,7 @@ _LIBCPP_POP_MACROS
# include <atomic>
# include <climits>
# include <concepts>
+# include <cstddef>
# include <ctime>
# include <iterator>
# include <memory>
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index f30cfe26e75517b..5daaeb7041037be 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -1200,6 +1200,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <iterator>
# include <type_traits>
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 21c18ef43154714..23d13a6e1acc10d 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -1129,6 +1129,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <functional>
# include <type_traits>
diff --git a/libcxx/include/ranges b/libcxx/include/ranges
index db592fd5cb360c4..52a207db2931ef5 100644
--- a/libcxx/include/ranges
+++ b/libcxx/include/ranges
@@ -436,6 +436,7 @@ namespace std {
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <type_traits>
#endif
diff --git a/libcxx/include/regex b/libcxx/include/regex
index e8865ac1089d6f4..7ac39a20181c843 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -6949,6 +6949,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <iosfwd>
# include <iterator>
diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator
index 55f48bb4d1008c3..9a5f130a3243f96 100644
--- a/libcxx/include/scoped_allocator
+++ b/libcxx/include/scoped_allocator
@@ -707,6 +707,7 @@ _LIBCPP_POP_MACROS
# include <atomic>
# include <climits>
# include <concepts>
+# include <cstddef>
# include <cstring>
# include <ctime>
# include <iterator>
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index 53c9578b79f016b..970395f3403f335 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -55,7 +55,6 @@ using binary_semaphore = counting_semaphore<1>;
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>
#include <__threading_support>
-#include <cstddef>
#include <limits>
#include <version>
@@ -212,6 +211,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/shared_mutex b/libcxx/include/shared_mutex
index 350c841e11a0a7c..c71bfdbc77c4f37 100644
--- a/libcxx/include/shared_mutex
+++ b/libcxx/include/shared_mutex
@@ -460,6 +460,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <system_error>
#endif
diff --git a/libcxx/include/sstream b/libcxx/include/sstream
index 4fec465d5748009..2d544b93d8ed54b 100644
--- a/libcxx/include/sstream
+++ b/libcxx/include/sstream
@@ -1205,6 +1205,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES)
+# include <cstddef>
# include <type_traits>
#endif
diff --git a/libcxx/include/stack b/libcxx/include/stack
index 6d725a84b06a0f7..c08d407acadb313 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -433,6 +433,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <cstddef>
# include <functional>
# include <type_traits>
#endif
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 1a94ac09b99ee8a..4500b872aa2307d 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -227,7 +227,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>
@@ -1049,6 +1048,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <algorithm>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <iterator>
# include <type_traits>
diff --git a/libcxx/include/system_error b/libcxx/include/system_error
index a60c98492aacedf..bb004c439ff3f0a 100644
--- a/libcxx/include/system_error
+++ b/libcxx/include/system_error
@@ -163,6 +163,7 @@ template <> struct hash<std::error_condition>;
#endif
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdint>
# include <cstring>
# include <limits>
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 138c132ff15aecb..927462f7bfe5753 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -259,7 +259,6 @@ template <class... Types>
#include <__utility/pair.h>
#include <__utility/piecewise_construct.h>
#include <__utility/swap.h>
-#include <cstddef>
#include <version>
// standard-mandated includes
@@ -1674,6 +1673,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <exception>
# include <iosfwd>
# include <new>
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 466aeb6e0ddd716..2146b218fd79712 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -535,10 +535,12 @@ namespace std
#include <__type_traits/unwrap_ref.h>
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
-#include <cstddef>
-#include <cstdint>
#include <version>
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo
index 59bc291454c3d90..ee784e20b0da861 100644
--- a/libcxx/include/typeinfo
+++ b/libcxx/include/typeinfo
@@ -60,9 +60,9 @@ public:
#include <__availability>
#include <__config>
#include <__exception/exception.h>
+#include <__type_traits/integral_constant.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__verbose_abort>
-#include <cstddef>
#include <cstdint>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -417,6 +417,7 @@ void __throw_bad_cast()
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <cstdlib>
# include <exception>
# include <type_traits>
diff --git a/libcxx/include/utility b/libcxx/include/utility
index c5581d55e79bbb3..d981bd08308c89e 100644
--- a/libcxx/include/utility
+++ b/libcxx/include/utility
@@ -283,6 +283,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 7db1bba0182ae5a..9915db5e0384295 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -361,7 +361,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>
@@ -4206,6 +4205,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <algorithm>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <cstring>
# include <functional>
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 7df2e87cf3bf986..f8c25c13f160d50 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1834,6 +1834,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cstddef>
# include <exception>
# include <type_traits>
# include <typeinfo>
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 4ec6b602371eaee..b9ebc3550637fc4 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -3434,6 +3434,7 @@ _LIBCPP_POP_MACROS
# include <algorithm>
# include <atomic>
# include <concepts>
+# include <cstddef>
# include <cstdlib>
# include <type_traits>
# include <typeinfo>
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 63ea6c09b1f5083..ceec038bb13f925 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -229,9 +229,7 @@ exception cstddef
exception cstdlib
exception type_traits
exception version
-execution cstddef
execution version
-expected cstddef
expected initializer_list
expected new
expected version
@@ -534,7 +532,6 @@ map version
mdspan array
mdspan cinttypes
mdspan concepts
-mdspan cstddef
mdspan limits
mdspan span
mdspan version
@@ -812,7 +809,6 @@ stdexcept cstdlib
stdexcept exception
stdexcept iosfwd
stop_token atomic
-stop_token cstddef
stop_token cstdint
stop_token cstring
stop_token ctime
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 236dedd186c9268..72de9c2aace712c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -1,5 +1,4 @@
algorithm climits
-algorithm cstddef
algorithm cstdint
algorithm cstring
algorithm ctime
@@ -12,7 +11,6 @@ algorithm new
algorithm optional
algorithm ratio
algorithm version
-any cstddef
any cstdint
any cstring
any initializer_list
@@ -21,14 +19,12 @@ any new
any typeinfo
any version
array compare
-array cstddef
array cstdint
array initializer_list
array limits
array new
array stdexcept
array version
-atomic cstddef
atomic cstdint
atomic cstdlib
atomic cstring
@@ -36,7 +32,6 @@ atomic ctime
atomic limits
atomic ratio
atomic version
-barrier cstddef
barrier cstdint
barrier cstring
barrier ctime
@@ -48,7 +43,6 @@ bit cstdint
bit limits
bit version
bitset climits
-bitset cstddef
bitset cstdint
bitset cstring
bitset cwchar
@@ -63,7 +57,6 @@ bitset version
ccomplex complex
charconv cerrno
charconv cmath
-charconv cstddef
charconv cstdint
charconv initializer_list
charconv limits
@@ -71,7 +64,6 @@ charconv new
chrono array
chrono cmath
chrono compare
-chrono cstddef
chrono cstdint
chrono ctime
chrono forward_list
@@ -93,7 +85,6 @@ cmath limits
cmath version
codecvt cctype
codecvt clocale
-codecvt cstddef
codecvt cstdint
codecvt cstdlib
codecvt cstring
@@ -108,7 +99,6 @@ codecvt tuple
codecvt typeinfo
codecvt version
compare cmath
-compare cstddef
compare cstdint
compare limits
compare version
@@ -117,11 +107,9 @@ complex iosfwd
complex sstream
complex stdexcept
complex version
-concepts cstddef
concepts version
condition_variable atomic
condition_variable cerrno
-condition_variable cstddef
condition_variable cstdint
condition_variable cstring
condition_variable ctime
@@ -134,7 +122,6 @@ condition_variable string
condition_variable typeinfo
condition_variable version
coroutine compare
-coroutine cstddef
coroutine cstdint
coroutine cstring
coroutine limits
@@ -142,7 +129,6 @@ coroutine version
cstddef version
ctgmath ccomplex
ctgmath cmath
-cwchar cstddef
cwchar cwctype
cwctype cctype
deque compare
@@ -156,12 +142,9 @@ deque new
deque stdexcept
deque tuple
deque version
-exception cstddef
exception cstdlib
exception version
-execution cstddef
execution version
-expected cstddef
expected initializer_list
expected new
expected version
@@ -169,7 +152,6 @@ experimental/deque deque
experimental/deque experimental/memory_resource
experimental/forward_list experimental/memory_resource
experimental/forward_list forward_list
-experimental/iterator cstddef
experimental/iterator iosfwd
experimental/iterator iterator
experimental/list experimental/memory_resource
@@ -182,7 +164,6 @@ experimental/memory_resource limits
experimental/memory_resource new
experimental/memory_resource stdexcept
experimental/memory_resource tuple
-experimental/propagate_const cstddef
experimental/regex experimental/memory_resource
experimental/regex experimental/string
experimental/regex regex
@@ -203,7 +184,6 @@ experimental/utility utility
experimental/vector experimental/memory_resource
experimental/vector vector
filesystem compare
-filesystem cstddef
filesystem cstdint
filesystem cstring
filesystem ctime
@@ -218,7 +198,6 @@ filesystem string_view
filesystem version
format array
format cmath
-format cstddef
format cstdint
format initializer_list
format limits
@@ -242,7 +221,6 @@ forward_list tuple
forward_list version
fstream cctype
fstream clocale
-fstream cstddef
fstream cstdint
fstream cstdio
fstream cstdlib
@@ -261,7 +239,6 @@ fstream tuple
fstream typeinfo
fstream version
functional array
-functional cstddef
functional cstdint
functional cstring
functional initializer_list
@@ -276,7 +253,6 @@ functional unordered_map
functional vector
functional version
future cerrno
-future cstddef
future cstdint
future cstdlib
future cstring
@@ -291,13 +267,11 @@ future string
future thread
future typeinfo
future version
-initializer_list cstddef
iomanip istream
iomanip version
ios cctype
ios cerrno
ios clocale
-ios cstddef
ios cstdint
ios cstdlib
ios cstring
@@ -319,19 +293,16 @@ iostream istream
iostream ostream
iostream streambuf
iostream version
-istream cstddef
istream iosfwd
istream ostream
istream version
iterator compare
iterator concepts
-iterator cstddef
iterator initializer_list
iterator iosfwd
iterator limits
iterator variant
iterator version
-latch cstddef
latch cstdint
latch cstring
latch ctime
@@ -352,7 +323,6 @@ list version
locale cctype
locale cerrno
locale clocale
-locale cstddef
locale cstdint
locale cstdio
locale cstdlib
@@ -383,12 +353,10 @@ map version
mdspan array
mdspan cinttypes
mdspan concepts
-mdspan cstddef
mdspan limits
mdspan span
mdspan version
memory compare
-memory cstddef
memory cstdint
memory cstring
memory initializer_list
@@ -408,7 +376,6 @@ memory_resource stdexcept
memory_resource tuple
memory_resource version
mutex cerrno
-mutex cstddef
mutex cstdint
mutex ctime
mutex iosfwd
@@ -420,13 +387,11 @@ mutex string
mutex tuple
mutex typeinfo
mutex version
-new cstddef
new cstdlib
new version
numbers version
numeric climits
numeric cmath
-numeric cstddef
numeric cstdint
numeric cstring
numeric ctime
@@ -438,7 +403,6 @@ numeric optional
numeric ratio
numeric version
optional compare
-optional cstddef
optional cstdint
optional cstring
optional initializer_list
@@ -448,7 +412,6 @@ optional stdexcept
optional version
ostream bitset
ostream cerrno
-ostream cstddef
ostream cstdint
ostream cstring
ostream initializer_list
@@ -465,7 +428,6 @@ ostream version
print array
print cerrno
print cmath
-print cstddef
print cstdint
print cstdio
print initializer_list
@@ -479,7 +441,6 @@ print string_view
print tuple
print version
queue compare
-queue cstddef
queue cstdint
queue deque
queue initializer_list
@@ -488,7 +449,6 @@ queue new
queue vector
queue version
random cmath
-random cstddef
random cstdint
random initializer_list
random iosfwd
@@ -498,7 +458,6 @@ random string
random vector
random version
ranges compare
-ranges cstddef
ranges cwchar
ranges initializer_list
ranges iosfwd
@@ -516,7 +475,6 @@ ratio version
regex cctype
regex clocale
regex compare
-regex cstddef
regex cstdint
regex cstdlib
regex cstring
@@ -532,12 +490,10 @@ regex tuple
regex typeinfo
regex vector
regex version
-scoped_allocator cstddef
scoped_allocator limits
scoped_allocator new
scoped_allocator tuple
scoped_allocator version
-semaphore cstddef
semaphore cstdint
semaphore cstring
semaphore ctime
@@ -555,7 +511,6 @@ set stdexcept
set tuple
set version
shared_mutex cerrno
-shared_mutex cstddef
shared_mutex ctime
shared_mutex limits
shared_mutex ratio
@@ -569,13 +524,11 @@ span cstddef
span initializer_list
span limits
span version
-sstream cstddef
sstream istream
sstream ostream
sstream string
sstream version
stack compare
-stack cstddef
stack cstdint
stack deque
stack initializer_list
@@ -584,7 +537,6 @@ stack new
stack version
stdexcept iosfwd
stop_token atomic
-stop_token cstddef
stop_token cstdint
stop_token cstring
stop_token ctime
@@ -612,7 +564,6 @@ string string_view
string tuple
string version
string_view compare
-string_view cstddef
string_view cstdint
string_view cstdio
string_view cstring
@@ -628,7 +579,6 @@ strstream ostream
strstream version
system_error cerrno
system_error compare
-system_error cstddef
system_error stdexcept
system_error string
system_error version
@@ -652,15 +602,12 @@ thread string_view
thread tuple
thread version
tuple compare
-tuple cstddef
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex compare
typeindex typeinfo
typeindex version
-typeinfo cstddef
typeinfo cstdint
unordered_map cmath
unordered_map compare
@@ -687,19 +634,16 @@ unordered_set stdexcept
unordered_set tuple
unordered_set version
utility compare
-utility cstddef
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
@@ -711,7 +655,6 @@ vector array
vector cerrno
vector climits
vector compare
-vector cstddef
vector cstdint
vector cstring
vector cwchar
diff --git a/libcxx/test/std/numerics/bit/byteswap.pass.cpp b/libcxx/test/std/numerics/bit/byteswap.pass.cpp
index b87faf150177f37..9d4e328ed9d0f7b 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>
More information about the libcxx-commits
mailing list