[libc++] Remove <type_traits> includes from <atomic> and <ratio>
authorNikolas Klauser <nikolasklauser@berlin.de>
Sun, 15 Jan 2023 18:53:49 +0000 (19:53 +0100)
committerNikolas Klauser <nikolasklauser@berlin.de>
Mon, 16 Jan 2023 18:38:33 +0000 (19:38 +0100)
Reviewed By: Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D141799

libcxx/include/__chrono/duration.h
libcxx/include/__chrono/time_point.h
libcxx/include/atomic
libcxx/include/ratio
libcxx/test/libcxx/transitive_includes/cxx03.csv
libcxx/test/libcxx/transitive_includes/cxx11.csv
libcxx/test/libcxx/transitive_includes/cxx14.csv
libcxx/test/libcxx/transitive_includes/cxx17.csv
libcxx/test/libcxx/transitive_includes/cxx20.csv
libcxx/test/libcxx/transitive_includes/cxx2b.csv
libcxx/test/std/atomics/atomics.types.generic/constexpr_noexcept.compile.pass.cpp

index 7e47b6c..afcc38b 100644 (file)
 #define _LIBCPP___CHRONO_DURATION_H
 
 #include <__config>
+#include <__type_traits/common_type.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_floating_point.h>
 #include <limits>
 #include <ratio>
-#include <type_traits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -612,4 +615,8 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <type_traits>
+#endif
+
 #endif // _LIBCPP___CHRONO_DURATION_H
index 5278670..8a8fa21 100644 (file)
 
 #include <__chrono/duration.h>
 #include <__config>
+#include <__type_traits/common_type.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_convertible.h>
 #include <limits>
-#include <type_traits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index 8914f19..d0d682d 100644 (file)
@@ -524,10 +524,19 @@ template <class T>
 #include <__config>
 #include <__thread/poll_with_backoff.h>
 #include <__thread/timed_backoff_policy.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_assignable.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_nothrow_default_constructible.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_trivially_copyable.h>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_pointer.h>
+#include <__type_traits/underlying_type.h>
 #include <cstddef>
 #include <cstdint>
 #include <cstring>
-#include <type_traits>
 #include <version>
 
 #ifndef _LIBCPP_HAS_NO_THREADS
@@ -2658,6 +2667,7 @@ _LIBCPP_END_NAMESPACE_STD
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cmath>
 #  include <compare>
+#  include <type_traits>
 #endif
 
 #endif // _LIBCPP_ATOMIC
index 5d7af88..3969a39 100644 (file)
@@ -79,9 +79,9 @@ typedef ratio<1000000000000000000000000, 1> yotta;  // not supported
 
 #include <__assert> // all public C++ headers provide the assertion handler
 #include <__config>
+#include <__type_traits/integral_constant.h>
 #include <climits>
 #include <cstdint>
-#include <type_traits>
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -525,4 +525,8 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <type_traits>
+#endif
+
 #endif // _LIBCPP_RATIO
index b67b167..08f449b 100644 (file)
@@ -722,6 +722,7 @@ scoped_allocator type_traits
 scoped_allocator variant
 scoped_allocator version
 semaphore atomic
+semaphore cstddef
 semaphore ctime
 semaphore iosfwd
 semaphore limits
index ebe07a4..6ecca62 100644 (file)
@@ -723,6 +723,7 @@ scoped_allocator type_traits
 scoped_allocator variant
 scoped_allocator version
 semaphore atomic
+semaphore cstddef
 semaphore ctime
 semaphore iosfwd
 semaphore limits
index dbbf4f7..fb50933 100644 (file)
@@ -725,6 +725,7 @@ scoped_allocator type_traits
 scoped_allocator variant
 scoped_allocator version
 semaphore atomic
+semaphore cstddef
 semaphore ctime
 semaphore iosfwd
 semaphore limits
@@ -745,6 +746,7 @@ set stdexcept
 set tuple
 set type_traits
 set version
+shared_mutex cstddef
 shared_mutex ctime
 shared_mutex iosfwd
 shared_mutex limits
index dbbf4f7..fb50933 100644 (file)
@@ -725,6 +725,7 @@ scoped_allocator type_traits
 scoped_allocator variant
 scoped_allocator version
 semaphore atomic
+semaphore cstddef
 semaphore ctime
 semaphore iosfwd
 semaphore limits
@@ -745,6 +746,7 @@ set stdexcept
 set tuple
 set type_traits
 set version
+shared_mutex cstddef
 shared_mutex ctime
 shared_mutex iosfwd
 shared_mutex limits
index 410fced..7e7661d 100644 (file)
@@ -732,6 +732,7 @@ scoped_allocator type_traits
 scoped_allocator variant
 scoped_allocator version
 semaphore atomic
+semaphore cstddef
 semaphore ctime
 semaphore iosfwd
 semaphore limits
@@ -752,6 +753,7 @@ set stdexcept
 set tuple
 set type_traits
 set version
+shared_mutex cstddef
 shared_mutex ctime
 shared_mutex iosfwd
 shared_mutex limits
index 8599bb7..21b32bf 100644 (file)
@@ -36,7 +36,6 @@ atomic ctime
 atomic iosfwd
 atomic limits
 atomic ratio
-atomic type_traits
 atomic version
 barrier atomic
 barrier cstddef
@@ -47,7 +46,6 @@ barrier iosfwd
 barrier limits
 barrier new
 barrier ratio
-barrier type_traits
 bit cstdint
 bit cstdlib
 bit limits
@@ -333,7 +331,6 @@ future new
 future ratio
 future system_error
 future thread
-future type_traits
 future version
 initializer_list cstddef
 iomanip istream
@@ -522,7 +519,6 @@ ranges variant
 ranges version
 ratio climits
 ratio cstdint
-ratio type_traits
 ratio version
 regex cctype
 regex compare
@@ -545,11 +541,11 @@ scoped_allocator new
 scoped_allocator tuple
 scoped_allocator version
 semaphore atomic
+semaphore cstddef
 semaphore ctime
 semaphore iosfwd
 semaphore limits
 semaphore ratio
-semaphore type_traits
 semaphore version
 set compare
 set cstddef
@@ -562,12 +558,12 @@ set stdexcept
 set tuple
 set type_traits
 set version
+shared_mutex cstddef
 shared_mutex ctime
 shared_mutex iosfwd
 shared_mutex limits
 shared_mutex ratio
 shared_mutex system_error
-shared_mutex type_traits
 shared_mutex version
 source_location cstdint
 source_location version