[libc++] Granularize <exception> includes

Reviewed By: ldionne, #libc

Spies: mikhail.ramalho, smeenai, libcxx-commits

Differential Revision: https://reviews.llvm.org/D146097
This commit is contained in:
Nikolas Klauser 2023-03-01 20:49:22 +01:00
parent 5b1145bc46
commit c9d36bd807
21 changed files with 33 additions and 31 deletions

View File

@ -10,10 +10,9 @@
#define _LIBCPP___EXPECTED_BAD_EXPECTED_ACCESS_H
#include <__config>
#include <__exception/exception.h>
#include <__utility/move.h>
#include <exception>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

View File

@ -27,6 +27,7 @@
#include <__iterator/incrementable_traits.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/wrap_iter.h>
#include <__memory/addressof.h>
#include <__type_traits/add_pointer.h>
#include <__utility/move.h>
#include <cstddef>

View File

@ -12,6 +12,7 @@
#include <__assert>
#include <__config>
#include <__exception/exception.h>
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
#include <__functional/unary_function.h>
@ -32,7 +33,6 @@
#include <__utility/piecewise_construct.h>
#include <__utility/swap.h>
#include <__verbose_abort>
#include <exception>
#include <new>
#include <tuple>
#include <typeinfo>

View File

@ -22,6 +22,7 @@
#include <__iterator/iterator_traits.h>
#include <__iterator/iterator_with_data.h>
#include <__iterator/segmented_iterator.h>
#include <__memory/addressof.h>
#include <__ranges/access.h>
#include <__ranges/all.h>
#include <__ranges/concepts.h>

View File

@ -543,7 +543,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#include <__functional/unary_negate.h>
#include <__functional/unwrap_ref.h>
#include <__utility/forward.h>
#include <exception>
#include <memory> // TODO: find out why removing this breaks the modules build
#include <typeinfo>
#include <version>
@ -555,6 +554,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 <exception>
# include <tuple>
# include <type_traits>
# include <utility>

View File

@ -366,6 +366,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
#include <__chrono/duration.h>
#include <__chrono/time_point.h>
#include <__config>
#include <__exception/exception_ptr.h>
#include <__memory/allocator_arg_t.h>
#include <__memory/allocator_destructor.h>
#include <__memory/shared_ptr.h>
@ -377,8 +378,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
#include <__utility/auto_cast.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__verbose_abort>
#include <exception>
#include <mutex>
#include <new>
#include <system_error>
@ -2461,6 +2460,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <atomic>
# include <exception>
#endif
#endif // _LIBCPP_FUTURE

View File

@ -549,6 +549,7 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
#include <__iterator/erase_if_container.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/reverse_iterator.h>
#include <__memory/addressof.h>
#include <__memory/allocator.h>
#include <__memory_resource/polymorphic_allocator.h>
#include <__node_handle>

View File

@ -89,13 +89,14 @@ void operator delete[](void* ptr, void*) noexcept;
#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__config>
#include <__exception/exception.h>
#include <__type_traits/alignment_of.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_same.h>
#include <__type_traits/remove_cv.h>
#include <__verbose_abort>
#include <cstddef>
#include <cstdlib>
#include <exception>
#include <version>
#if defined(_LIBCPP_ABI_VCRUNTIME)
@ -365,6 +366,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 <exception>
# include <type_traits>
#endif

View File

@ -165,6 +165,7 @@ basic_ostream<wchar_t, traits>& operator<<(basic_ostream<wchar_t, traits>&, cons
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__exception/operations.h>
#include <__memory/shared_ptr.h>
#include <__memory/unique_ptr.h>
#include <__type_traits/conjunction.h>

View File

@ -43,9 +43,8 @@ public:
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__verbose_abort>
#include <__exception/exception.h>
#include <cstdlib>
#include <exception>
#include <iosfwd> // for string forward decl
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@ -300,4 +299,8 @@ void __throw_underflow_error(const char*__msg)
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <exception>
#endif
#endif // _LIBCPP_STDEXCEPT

View File

@ -85,7 +85,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__exception/terminate.h>
#include <__functional/hash.h>
#include <__memory/addressof.h>
#include <__memory/unique_ptr.h>
#include <__mutex_base>
#include <__thread/poll_with_backoff.h>

View File

@ -59,12 +59,12 @@ public:
#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__config>
#include <__exception/exception.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__verbose_abort>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <exception>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -415,6 +415,7 @@ void __throw_bad_cast()
_LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <exception>
# include <type_traits>
#endif

View File

@ -210,6 +210,7 @@ namespace std {
#include <__compare/compare_three_way_result.h>
#include <__compare/three_way_comparable.h>
#include <__config>
#include <__exception/exception.h>
#include <__functional/hash.h>
#include <__functional/invoke.h>
#include <__functional/operations.h>
@ -239,7 +240,6 @@ namespace std {
#include <__utility/swap.h>
#include <__variant/monostate.h>
#include <__verbose_abort>
#include <exception>
#include <initializer_list>
#include <limits>
#include <new>
@ -1834,6 +1834,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <exception>
# include <type_traits>
# include <typeinfo>
# include <utility>

View File

@ -213,7 +213,6 @@ exception version
execution version
expected cstddef
expected cstdlib
expected exception
expected initializer_list
expected new
expected version

1 algorithm atomic
213 execution version
214 expected cstddef
215 expected cstdlib
expected exception
216 expected initializer_list
217 expected new
218 expected version

View File

@ -213,7 +213,6 @@ exception version
execution version
expected cstddef
expected cstdlib
expected exception
expected initializer_list
expected new
expected version

1 algorithm atomic
213 execution version
214 expected cstddef
215 expected cstdlib
expected exception
216 expected initializer_list
217 expected new
218 expected version

View File

@ -213,7 +213,6 @@ exception version
execution version
expected cstddef
expected cstdlib
expected exception
expected initializer_list
expected new
expected version

1 algorithm atomic
213 execution version
214 expected cstddef
215 expected cstdlib
expected exception
216 expected initializer_list
217 expected new
218 expected version

View File

@ -213,7 +213,6 @@ exception version
execution version
expected cstddef
expected cstdlib
expected exception
expected initializer_list
expected new
expected version

1 algorithm atomic
213 execution version
214 expected cstddef
215 expected cstdlib
expected exception
216 expected initializer_list
217 expected new
218 expected version

View File

@ -220,7 +220,6 @@ exception version
execution version
expected cstddef
expected cstdlib
expected exception
expected initializer_list
expected new
expected version

1 algorithm atomic
220 execution version
221 expected cstddef
222 expected cstdlib
expected exception
223 expected initializer_list
224 expected new
225 expected version

View File

@ -151,7 +151,6 @@ exception version
execution version
expected cstddef
expected cstdlib
expected exception
expected initializer_list
expected new
expected version
@ -277,7 +276,6 @@ functional cstddef
functional cstdint
functional cstdlib
functional cstring
functional exception
functional initializer_list
functional iosfwd
functional limits
@ -293,7 +291,6 @@ future cstddef
future cstdint
future cstdlib
future cstring
future exception
future initializer_list
future iosfwd
future limits
@ -420,7 +417,6 @@ mutex typeinfo
mutex version
new cstddef
new cstdlib
new exception
new version
numbers version
numeric cmath
@ -548,7 +544,6 @@ stack deque
stack initializer_list
stack version
stdexcept cstdlib
stdexcept exception
stdexcept iosfwd
streambuf cstdint
streambuf ios
@ -618,7 +613,6 @@ typeindex version
typeinfo cstddef
typeinfo cstdint
typeinfo cstdlib
typeinfo exception
unordered_map cmath
unordered_map compare
unordered_map cstddef
@ -663,7 +657,6 @@ variant compare
variant cstddef
variant cstdint
variant cstring
variant exception
variant initializer_list
variant limits
variant new

1 algorithm climits
151 execution version
152 expected cstddef
153 expected cstdlib
expected exception
154 expected initializer_list
155 expected new
156 expected version
276 functional cstdint
277 functional cstdlib
278 functional cstring
functional exception
279 functional initializer_list
280 functional iosfwd
281 functional limits
291 future cstdint
292 future cstdlib
293 future cstring
future exception
294 future initializer_list
295 future iosfwd
296 future limits
417 mutex version
418 new cstddef
419 new cstdlib
new exception
420 new version
421 numbers version
422 numeric cmath
544 stack initializer_list
545 stack version
546 stdexcept cstdlib
stdexcept exception
547 stdexcept iosfwd
548 streambuf cstdint
549 streambuf ios
613 typeinfo cstddef
614 typeinfo cstdint
615 typeinfo cstdlib
typeinfo exception
616 unordered_map cmath
617 unordered_map compare
618 unordered_map cstddef
657 variant cstddef
658 variant cstdint
659 variant cstring
variant exception
660 variant initializer_list
661 variant limits
662 variant new

View File

@ -55,13 +55,14 @@
// that terminate has been called)
#include <condition_variable>
#include <atomic>
#include <thread>
#include <chrono>
#include <string>
#include <cstdlib>
#include <cassert>
#include <chrono>
#include <condition_variable>
#include <cstdlib>
#include <exception>
#include <string>
#include <thread>
#include "make_test_thread.h"

View File

@ -15,10 +15,11 @@
// ~thread();
#include <thread>
#include <new>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <exception>
#include <new>
#include <thread>
#include "make_test_thread.h"
#include "test_macros.h"