[libcxx-commits] [libcxx] e31c2a1 - [NFC][libc++] Moves transitive includes location.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Sep 3 01:06:25 PDT 2022
Author: Mark de Wever
Date: 2022-09-03T10:06:16+02:00
New Revision: e31c2a1b1a643861f25ba0145cb4701c999fc6c2
URL: https://github.com/llvm/llvm-project/commit/e31c2a1b1a643861f25ba0145cb4701c999fc6c2
DIFF: https://github.com/llvm/llvm-project/commit/e31c2a1b1a643861f25ba0145cb4701c999fc6c2.diff
LOG: [NFC][libc++] Moves transitive includes location.
As discussed in D132284 they will be moved to the end.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D133212
Added:
Modified:
libcxx/include/algorithm
libcxx/include/any
libcxx/include/array
libcxx/include/atomic
libcxx/include/bit
libcxx/include/charconv
libcxx/include/coroutine
libcxx/include/deque
libcxx/include/experimental/simd
libcxx/include/experimental/unordered_map
libcxx/include/ext/hash_map
libcxx/include/ext/hash_set
libcxx/include/forward_list
libcxx/include/functional
libcxx/include/future
libcxx/include/iterator
libcxx/include/list
libcxx/include/locale
libcxx/include/map
libcxx/include/memory
libcxx/include/mutex
libcxx/include/numeric
libcxx/include/optional
libcxx/include/ostream
libcxx/include/queue
libcxx/include/random
libcxx/include/regex
libcxx/include/set
libcxx/include/span
libcxx/include/stack
libcxx/include/string
libcxx/include/string_view
libcxx/include/thread
libcxx/include/tuple
libcxx/include/typeindex
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/utility
libcxx/include/valarray
libcxx/include/variant
libcxx/include/vector
Removed:
################################################################################
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 0b54fb9a8a940..f036fd00dd164 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -1899,15 +1899,6 @@ template <class BidirectionalIterator, class Compare>
#include <__algorithm/unwrap_iter.h>
#include <__algorithm/upper_bound.h>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <chrono> // IGNORE-CYCLE due to <format>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iterator>
-# include <utility>
-#endif
-
// standard-mandated includes
#include <initializer_list>
@@ -1919,4 +1910,13 @@ template <class BidirectionalIterator, class Compare>
# include <__pstl_algorithm>
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+# include <chrono> // IGNORE-CYCLE due to <format>
+#endif
+
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iterator>
+# include <utility>
+#endif
+
#endif // _LIBCPP_ALGORITHM
diff --git a/libcxx/include/any b/libcxx/include/any
index a70c6f11f37e3..ec12cfa9c2e99 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -94,10 +94,6 @@ namespace std {
#include <typeinfo>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <chrono> // IGNORE-CYCLE due to <format>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -695,4 +691,8 @@ any_cast(any * __any) _NOEXCEPT
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+# include <chrono> // IGNORE-CYCLE due to <format>
+#endif
+
#endif // _LIBCPP_ANY
diff --git a/libcxx/include/array b/libcxx/include/array
index 415ac162c89d8..4b91569514ead 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -123,12 +123,6 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <iterator>
-# include <utility>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -535,4 +529,10 @@ to_array(_Tp(&&__arr)[_Size]) noexcept(is_nothrow_move_constructible_v<_Tp>) {
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <iterator>
+# include <utility>
+#endif
+
#endif // _LIBCPP_ARRAY
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index 2e920889dcdce..571e34be60ce0 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -534,15 +534,6 @@ template <class T>
# include <__threading_support>
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <chrono> // IGNORE-CYCLE due to <format>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <cmath>
-# include <compare>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -2707,4 +2698,13 @@ typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free;
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+# include <chrono> // IGNORE-CYCLE due to <format>
+#endif
+
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cmath>
+# include <compare>
+#endif
+
#endif // _LIBCPP_ATOMIC
diff --git a/libcxx/include/bit b/libcxx/include/bit
index 1505c9bd7f02f..e3fb6e336b2be 100644
--- a/libcxx/include/bit
+++ b/libcxx/include/bit
@@ -71,10 +71,6 @@ namespace std {
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iosfwd>
-#endif
-
#if defined(_LIBCPP_COMPILER_MSVC)
# include <intrin.h>
#endif
@@ -256,4 +252,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iosfwd>
+#endif
+
#endif // _LIBCPP_BIT
diff --git a/libcxx/include/charconv b/libcxx/include/charconv
index d77cf3a05156c..6d6a7db9310ac 100644
--- a/libcxx/include/charconv
+++ b/libcxx/include/charconv
@@ -97,10 +97,6 @@ namespace std {
#include <limits>
#include <type_traits>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iosfwd>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -824,4 +820,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iosfwd>
+#endif
+
#endif // _LIBCPP_CHARCONV
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index d7ed44ee75e20..a81d68f394806 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -46,10 +46,6 @@ struct suspend_always;
#include <__coroutine/trivial_awaitables.h>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iosfwd>
-#endif
-
// standard-mandated includes
#include <compare>
@@ -57,4 +53,8 @@ struct suspend_always;
# pragma GCC system_header
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iosfwd>
+#endif
+
#endif // _LIBCPP_COROUTINE
diff --git a/libcxx/include/deque b/libcxx/include/deque
index c38b544444ed9..9a26f16bc0fe0 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -185,12 +185,6 @@ template <class T, class Allocator, class Predicate>
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -2932,4 +2926,10 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_DEQUE
diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index 532bc644a5029..4a52358ce144f 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -656,11 +656,6 @@ public:
#include <experimental/__config>
#include <tuple>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <functional>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -1581,4 +1576,9 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <functional>
+#endif
+
#endif /* _LIBCPP_EXPERIMENTAL_SIMD */
diff --git a/libcxx/include/experimental/unordered_map b/libcxx/include/experimental/unordered_map
index db114dc1d115c..d2801822a56fa 100644
--- a/libcxx/include/experimental/unordered_map
+++ b/libcxx/include/experimental/unordered_map
@@ -45,14 +45,6 @@ namespace pmr {
#include <experimental/memory_resource>
#include <unordered_map>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <array>
-# include <bit>
-# include <functional>
-# include <vector>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -75,4 +67,12 @@ using unordered_multimap = _VSTD::unordered_multimap<_Key, _Value, _Hash, _Pred,
_LIBCPP_END_NAMESPACE_LFTS_PMR
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <array>
+# include <bit>
+# include <functional>
+# include <vector>
+#endif
+
#endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_MAP */
diff --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map
index ab5a896dd5569..b7830e848a6aa 100644
--- a/libcxx/include/ext/hash_map
+++ b/libcxx/include/ext/hash_map
@@ -210,10 +210,6 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <stdexcept>
#include <type_traits>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iterator>
-#endif
-
#if defined(__DEPRECATED) && __DEPRECATED
#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
@@ -987,4 +983,8 @@ operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
} // namespace __gnu_cxx
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iterator>
+#endif
+
#endif // _LIBCPP_HASH_MAP
diff --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set
index 332d6091065cb..68b449d6b867a 100644
--- a/libcxx/include/ext/hash_set
+++ b/libcxx/include/ext/hash_set
@@ -199,10 +199,6 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <ext/__hash>
#include <functional>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iterator>
-#endif
-
#if defined(__DEPRECATED) && __DEPRECATED
#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
@@ -666,4 +662,8 @@ operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
} // namespace __gnu_cxx
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iterator>
+#endif
+
#endif // _LIBCPP_HASH_SET
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index c9fc20b30f1c6..d5ea3ecd035b4 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -195,12 +195,6 @@ template <class T, class Allocator, class Predicate>
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -1788,4 +1782,10 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_FORWARD_LIST
diff --git a/libcxx/include/functional b/libcxx/include/functional
index c969d7f70e3fc..60f65141c7cd2 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -539,12 +539,12 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#include <typeinfo>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <utility>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <utility>
+#endif
+
#endif // _LIBCPP_FUNCTIONAL
diff --git a/libcxx/include/future b/libcxx/include/future
index 643600a75ba0f..716daa7e532c5 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -378,10 +378,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
#include <thread>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <chrono> // IGNORE-CYCLE due to <format>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -2436,4 +2432,8 @@ future<void>::share() _NOEXCEPT
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+# include <chrono> // IGNORE-CYCLE due to <format>
+#endif
+
#endif // _LIBCPP_FUTURE
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index 6555b6d005293..be544b8b3ee60 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -724,6 +724,10 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
#include <type_traits>
#include <version>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <exception>
# include <new>
@@ -731,8 +735,4 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
# include <utility>
#endif
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
#endif // _LIBCPP_ITERATOR
diff --git a/libcxx/include/list b/libcxx/include/list
index 668875bef7170..a4e6defea8ce4 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -203,12 +203,6 @@ template <class T, class Allocator, class Predicate>
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -2364,4 +2358,10 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_LIST
diff --git a/libcxx/include/locale b/libcxx/include/locale
index c7da7836384e4..3fe8f5dd0e3b7 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -211,10 +211,6 @@ template <class charT> class messages_byname;
#include <streambuf>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iterator>
-#endif
-
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
// Most unix variants have catopen. These are the specific ones that don't.
# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__)
@@ -4356,4 +4352,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iterator>
+#endif
+
#endif // _LIBCPP_LOCALE
diff --git a/libcxx/include/map b/libcxx/include/map
index 1e619b9132eba..20e6126918d6a 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -546,12 +546,6 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-# include <iterator>
-# include <utility>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -2335,4 +2329,10 @@ inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+# include <iterator>
+# include <utility>
+#endif
+
#endif // _LIBCPP_MAP
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 47134a052c0a7..0da19ee2d8135 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -887,11 +887,6 @@ template<size_t N, class T>
#include <typeinfo>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iterator>
-# include <utility>
-#endif
-
// standard-mandated includes
#include <compare>
@@ -1044,4 +1039,9 @@ _LIBCPP_END_NAMESPACE_STD
# include <__pstl_memory>
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iterator>
+# include <utility>
+#endif
+
#endif // _LIBCPP_MEMORY
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index a8334ba341805..3aea375ba16d1 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -198,10 +198,6 @@ template<class Callable, class ...Args>
#endif
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -706,4 +702,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+#endif
+
#endif // _LIBCPP_MUTEX
diff --git a/libcxx/include/numeric b/libcxx/include/numeric
index ba030aadbfef5..64cd45b430828 100644
--- a/libcxx/include/numeric
+++ b/libcxx/include/numeric
@@ -163,11 +163,6 @@ template<class T>
#include <__numeric/transform_inclusive_scan.h>
#include <__numeric/transform_reduce.h>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-# include <iterator>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -176,4 +171,9 @@ template<class T>
# include <__pstl_numeric>
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_NUMERIC
diff --git a/libcxx/include/optional b/libcxx/include/optional
index d75b1fefde77f..38412afcc7b4e 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -177,24 +177,6 @@ template<class T>
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <chrono> // IGNORE-CYCLE due to <format>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <atomic>
-# include <climits>
-# include <concepts>
-# include <ctime>
-# include <iterator>
-# include <memory>
-# include <ratio>
-# include <tuple>
-# include <typeinfo>
-# include <utility>
-# include <variant>
-#endif
-
// standard-mandated includes
#include <compare>
@@ -1590,4 +1572,22 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 14
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+# include <chrono> // IGNORE-CYCLE due to <format>
+#endif
+
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <atomic>
+# include <climits>
+# include <concepts>
+# include <ctime>
+# include <iterator>
+# include <memory>
+# include <ratio>
+# include <tuple>
+# include <typeinfo>
+# include <utility>
+# include <variant>
+#endif
+
#endif // _LIBCPP_OPTIONAL
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 216e58317db4a..19fe7b0daa929 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -171,10 +171,6 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
#include <streambuf>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iterator>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@@ -1189,4 +1185,8 @@ extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>;
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iterator>
+#endif
+
#endif // _LIBCPP_OSTREAM
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 9a5cfb39f24ee..5e4b6bad17a36 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -231,10 +231,6 @@ template <class T, class Container, class Compare>
#include <vector>
#include <version>
-#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
-# include <functional>
-#endif
-
// standard-mandated includes
#include <compare>
#include <initializer_list>
@@ -960,4 +956,8 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Comp
_LIBCPP_END_NAMESPACE_STD
+#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
+# include <functional>
+#endif
+
#endif // _LIBCPP_QUEUE
diff --git a/libcxx/include/random b/libcxx/include/random
index 1193d0d1d4a31..cc246f96a3d73 100644
--- a/libcxx/include/random
+++ b/libcxx/include/random
@@ -1718,10 +1718,6 @@ class piecewise_linear_distribution
#include <__random/weibull_distribution.h>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-#endif
-
// standard-mandated includes
#include <initializer_list>
@@ -1739,4 +1735,8 @@ class piecewise_linear_distribution
# pragma GCC system_header
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+#endif
+
#endif // _LIBCPP_RANDOM
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 38998924c6b2a..95a211fc3de04 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -778,11 +778,6 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <vector>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iterator>
-# include <utility>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -6844,4 +6839,9 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iterator>
+# include <utility>
+#endif
+
#endif // _LIBCPP_REGEX
diff --git a/libcxx/include/set b/libcxx/include/set
index f97ae2ab099e4..e25185717a8a8 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -485,11 +485,6 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20
#include <__utility/forward.h>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -1578,4 +1573,9 @@ inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_SET
diff --git a/libcxx/include/span b/libcxx/include/span
index 42fbd9165259c..337a67434ec4c 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -148,11 +148,6 @@ template<class R>
#include <type_traits> // for remove_cv, etc
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -594,4 +589,9 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_SPAN
diff --git a/libcxx/include/stack b/libcxx/include/stack
index a4a76e5178b40..8f0a997156d61 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -107,10 +107,6 @@ template <class T, class Container>
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-#endif
-
// standard-mandated includes
#include <compare>
#include <initializer_list>
@@ -363,4 +359,8 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc>
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+#endif
+
#endif // _LIBCPP_STACK
diff --git a/libcxx/include/string b/libcxx/include/string
index 6010177ab5845..26e55ce444057 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -569,16 +569,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );
# include <cwchar>
#endif
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <functional>
-# include <iterator>
-# include <new>
-# include <typeinfo>
-# include <utility>
-# include <vector>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -4765,4 +4755,14 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <functional>
+# include <iterator>
+# include <new>
+# include <typeinfo>
+# include <utility>
+# include <vector>
+#endif
+
#endif // _LIBCPP_STRING
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 1e1abc780f884..c3df8c4926024 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -224,12 +224,6 @@ namespace std {
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -1034,4 +1028,10 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_STRING_VIEW
diff --git a/libcxx/include/thread b/libcxx/include/thread
index 85a845c2b223a..85e9275253122 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -99,14 +99,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
-# include <chrono> // IGNORE-CYCLE due to <format>
-#endif
-
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-#endif
-
// standard-mandated includes
#include <compare>
@@ -416,4 +408,12 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+# include <chrono> // IGNORE-CYCLE due to <format>
+#endif
+
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+#endif
+
#endif // _LIBCPP_THREAD
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 01c59b3b3ea3a..7bf2f91d06b46 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -220,14 +220,6 @@ template <class... Types>
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <exception>
-# include <iosfwd>
-# include <new>
-# include <typeinfo>
-# include <utility>
-#endif
-
// standard-mandated includes
#include <compare>
@@ -1825,4 +1817,12 @@ _LIBCPP_NOEXCEPT_RETURN(
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <exception>
+# include <iosfwd>
+# include <new>
+# include <typeinfo>
+# include <utility>
+#endif
+
#endif // _LIBCPP_TUPLE
diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex
index d1b750d334b30..e3132c8cb8564 100644
--- a/libcxx/include/typeindex
+++ b/libcxx/include/typeindex
@@ -51,12 +51,6 @@ struct hash<type_index>
#include <typeinfo>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iosfwd>
-# include <new>
-# include <utility>
-#endif
-
// standard-mandated includes
#include <compare>
@@ -123,4 +117,10 @@ struct _LIBCPP_TEMPLATE_VIS hash<type_index>
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iosfwd>
+# include <new>
+# include <utility>
+#endif
+
#endif // _LIBCPP_TYPEINDEX
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index e0d659a0615e7..38de4d834b0c9 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -531,12 +531,6 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <tuple>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <bit>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -2625,4 +2619,10 @@ operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <bit>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_UNORDERED_MAP
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index e294885253012..2440450aa3df0 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -474,11 +474,6 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__utility/forward.h>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <functional>
-# include <iterator>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -1801,4 +1796,9 @@ operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <functional>
+# include <iterator>
+#endif
+
#endif // _LIBCPP_UNORDERED_SET
diff --git a/libcxx/include/utility b/libcxx/include/utility
index d3a9aa492d4e8..41bcaf3d19465 100644
--- a/libcxx/include/utility
+++ b/libcxx/include/utility
@@ -248,10 +248,6 @@ template <class T>
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <iosfwd>
-#endif
-
// standard-mandated includes
#include <compare>
#include <initializer_list>
@@ -260,4 +256,8 @@ template <class T>
# pragma GCC system_header
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <iosfwd>
+#endif
+
#endif // _LIBCPP_UTILITY
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index b47807cc69dd5..ff745d30122d6 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -360,11 +360,6 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <new>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <functional>
-#endif
-
// standard-mandated includes
#include <initializer_list>
@@ -4932,4 +4927,9 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <functional>
+#endif
+
#endif // _LIBCPP_VALARRAY
diff --git a/libcxx/include/variant b/libcxx/include/variant
index a4a3c5bfa868e..f1d36e21ce788 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -228,11 +228,6 @@ namespace std {
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <typeinfo>
-# include <utility>
-#endif
-
// standard-mandated includes
#include <compare>
@@ -1818,4 +1813,9 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <typeinfo>
+# include <utility>
+#endif
+
#endif // _LIBCPP_VARIANT
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 0786a516b3b8e..8b27eaaeeec0c 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -307,12 +307,6 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20
#include <type_traits>
#include <version>
-#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
-# include <algorithm>
-# include <typeinfo>
-# include <utility>
-#endif
-
// standard-mandated includes
// [iterator.range]
@@ -3324,4 +3318,10 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <algorithm>
+# include <typeinfo>
+# include <utility>
+#endif
+
#endif // _LIBCPP_VECTOR
More information about the libcxx-commits
mailing list