From: Jonathan Wakely Date: Thu, 13 Oct 2016 16:59:19 +0000 (+0100) Subject: Avoid #include in other headers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d67dd0be9467f0a2842abf163254abf1c6cabaab;p=gcc.git Avoid #include in other headers * include/bits/shared_ptr_base.h: Include . [!__cpp_rtti]: Do not include . * include/experimental/array: Do not include . * include/experimental/memory: Include instead of . * include/experimental/propagate_const: Include , , and instead of . * include/experimental/tuple: Do not include . * include/std/future: Include . * include/std/memory: Do not include . * include/std/mutex: [_GLIBCXX_HAVE_TLS]: Likewise. * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Add missing includes. * testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise. * testsuite/20_util/specialized_algorithms/memory_management_tools/ 1.cc: Likewise. * testsuite/30_threads/call_once/60497.cc: Likewise. * testsuite/30_threads/lock/2.cc: Likewise. * testsuite/30_threads/thread/native_handle/cancel.cc: Likewise. * testsuite/experimental/algorithm/sample.cc: Likewise. * testsuite/experimental/array/make_array.cc: Likewise. * testsuite/experimental/array/neg.cc: Likewise. Adjust dg-error line. * testsuite/experimental/propagate_const/assignment/move_neg.cc: Adjust dg-error lines. * testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise. * testsuite/experimental/propagate_const/requirements2.cc: Likewise. * testsuite/experimental/propagate_const/requirements3.cc: Likewise. * testsuite/experimental/propagate_const/requirements4.cc: Likewise. * testsuite/experimental/propagate_const/requirements5.cc: Likewise. From-SVN: r241131 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f179fc90b19..c421111daac 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,35 @@ 2016-10-13 Jonathan Wakely + * include/bits/shared_ptr_base.h: Include . + [!__cpp_rtti]: Do not include . + * include/experimental/array: Do not include . + * include/experimental/memory: Include + instead of . + * include/experimental/propagate_const: Include , + , and instead of . + * include/experimental/tuple: Do not include . + * include/std/future: Include . + * include/std/memory: Do not include . + * include/std/mutex: [_GLIBCXX_HAVE_TLS]: Likewise. + * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Add + missing includes. + * testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise. + * testsuite/20_util/specialized_algorithms/memory_management_tools/ + 1.cc: Likewise. + * testsuite/30_threads/call_once/60497.cc: Likewise. + * testsuite/30_threads/lock/2.cc: Likewise. + * testsuite/30_threads/thread/native_handle/cancel.cc: Likewise. + * testsuite/experimental/algorithm/sample.cc: Likewise. + * testsuite/experimental/array/make_array.cc: Likewise. + * testsuite/experimental/array/neg.cc: Likewise. Adjust dg-error line. + * testsuite/experimental/propagate_const/assignment/move_neg.cc: + Adjust dg-error lines. + * testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise. + * testsuite/experimental/propagate_const/requirements2.cc: Likewise. + * testsuite/experimental/propagate_const/requirements3.cc: Likewise. + * testsuite/experimental/propagate_const/requirements4.cc: Likewise. + * testsuite/experimental/propagate_const/requirements5.cc: Likewise. + * testsuite/experimental/algorithm/sample.cc: Add missing header. * include/experimental/propagate_const (element_type): Qualify diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index e8820a148c3..422e3b5b959 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -49,7 +49,10 @@ #ifndef _SHARED_PTR_BASE_H #define _SHARED_PTR_BASE_H 1 -#include +#include +#if __cpp_rtti +# include +#endif #include #include diff --git a/libstdc++-v3/include/experimental/array b/libstdc++-v3/include/experimental/array index 31a066b3ce8..34d75cc2017 100644 --- a/libstdc++-v3/include/experimental/array +++ b/libstdc++-v3/include/experimental/array @@ -36,7 +36,6 @@ #else #include -#include #include namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/experimental/memory b/libstdc++-v3/include/experimental/memory index 885d11cb351..81def241515 100644 --- a/libstdc++-v3/include/experimental/memory +++ b/libstdc++-v3/include/experimental/memory @@ -42,8 +42,8 @@ #include #include #include -#include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/experimental/propagate_const b/libstdc++-v3/include/experimental/propagate_const index e1fb4e49198..5f32111fbba 100644 --- a/libstdc++-v3/include/experimental/propagate_const +++ b/libstdc++-v3/include/experimental/propagate_const @@ -36,7 +36,9 @@ #else #include -#include +#include +#include +#include #include namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/experimental/tuple b/libstdc++-v3/include/experimental/tuple index dc158e88342..e83a0ed9b63 100644 --- a/libstdc++-v3/include/experimental/tuple +++ b/libstdc++-v3/include/experimental/tuple @@ -36,7 +36,6 @@ #else #include -#include #include #include diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index fffbdbb7052..31a21f976ee 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory index beee91a79ad..0f6d8bc945f 100644 --- a/libstdc++-v3/include/std/memory +++ b/libstdc++-v3/include/std/memory @@ -76,7 +76,6 @@ # include // std::less # include # include -# include # include # include # include diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index e90006f43a0..0e1bc7fd412 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -39,13 +39,15 @@ #include #include #include -#include #include #include #if ! _GTHREAD_USE_MUTEX_TIMEDLOCK # include # include #endif +#ifndef _GLIBCXX_HAVE_TLS +# include +#endif #ifdef _GLIBCXX_USE_C99_STDINT_TR1 diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc index 5014898b2b9..e78093fe4bf 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include #ifdef _GLIBCXX_HAVE_UNISTD_H diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc index eaa72c42a73..96a5cf86653 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include #ifdef _GLIBCXX_HAVE_UNISTD_H diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc index a86e61a2234..a84776751a7 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include int del_count = 0; diff --git a/libstdc++-v3/testsuite/30_threads/call_once/60497.cc b/libstdc++-v3/testsuite/30_threads/call_once/60497.cc index 43dc917f5e4..a9e6449080e 100644 --- a/libstdc++-v3/testsuite/30_threads/call_once/60497.cc +++ b/libstdc++-v3/testsuite/30_threads/call_once/60497.cc @@ -25,6 +25,7 @@ #include #include +#include struct A; template struct B { T t; }; diff --git a/libstdc++-v3/testsuite/30_threads/lock/2.cc b/libstdc++-v3/testsuite/30_threads/lock/2.cc index d3692a0600e..c17442081e6 100644 --- a/libstdc++-v3/testsuite/30_threads/lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/lock/2.cc @@ -24,6 +24,7 @@ #include #include +#include #include void locker(std::mutex& m1, std::mutex& m2, std::mutex& m3) diff --git a/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc b/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc index 9b5417c88dc..db04b0521e6 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc @@ -24,6 +24,7 @@ #include #include #include +#include void f(std::atomic& started) { diff --git a/libstdc++-v3/testsuite/experimental/algorithm/sample.cc b/libstdc++-v3/testsuite/experimental/algorithm/sample.cc index 0d84e9dd7f4..16e6a74f38c 100644 --- a/libstdc++-v3/testsuite/experimental/algorithm/sample.cc +++ b/libstdc++-v3/testsuite/experimental/algorithm/sample.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include std::mt19937 rng; diff --git a/libstdc++-v3/testsuite/experimental/array/make_array.cc b/libstdc++-v3/testsuite/experimental/array/make_array.cc index 56611df505b..e91a5d826e7 100644 --- a/libstdc++-v3/testsuite/experimental/array/make_array.cc +++ b/libstdc++-v3/testsuite/experimental/array/make_array.cc @@ -18,6 +18,7 @@ // . #include +#include struct MoveOnly { diff --git a/libstdc++-v3/testsuite/experimental/array/neg.cc b/libstdc++-v3/testsuite/experimental/array/neg.cc index e91a5c5b0e2..cd086577657 100644 --- a/libstdc++-v3/testsuite/experimental/array/neg.cc +++ b/libstdc++-v3/testsuite/experimental/array/neg.cc @@ -18,10 +18,11 @@ // . #include +#include int main() { int dummy; auto bad = std::experimental::make_array(std::ref(dummy)); - // { dg-error "make_array cannot be used without an explicit target type if any of the types given is a reference_wrapper" "" { target *-*-* } 77 } + // { dg-error "make_array cannot be used without an explicit target type if any of the types given is a reference_wrapper" "" { target *-*-* } 76 } } diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc b/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc index 1b0366d756a..6dc0e2e5ed9 100644 --- a/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc +++ b/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc @@ -25,7 +25,7 @@ using std::experimental::propagate_const; using std::unique_ptr; -// { dg-error "no type" "" { target *-*-* } 159 } +// { dg-error "no type" "" { target *-*-* } 161 } int main() { diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc b/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc index ffdc7565691..abfc62dc009 100644 --- a/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc +++ b/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc @@ -25,10 +25,10 @@ using std::experimental::propagate_const; using std::unique_ptr; -// { dg-error "no type" "" { target *-*-* } 118 } -// { dg-error "no type" "" { target *-*-* } 125 } -// { dg-error "no type" "" { target *-*-* } 134 } -// { dg-error "no type" "" { target *-*-* } 143 } +// { dg-error "no type" "" { target *-*-* } 120 } +// { dg-error "no type" "" { target *-*-* } 127 } +// { dg-error "no type" "" { target *-*-* } 136 } +// { dg-error "no type" "" { target *-*-* } 145 } int main() { diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc index de2d293453d..5f46dc4052b 100644 --- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc +++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc @@ -21,9 +21,9 @@ using std::experimental::propagate_const; -// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 } -// { dg-error "not a pointer-to-object type" "" { target *-*-* } 66 } -// { dg-error "forming pointer to reference type" "" { target *-*-* } 185 } -// { dg-error "forming pointer to reference type" "" { target *-*-* } 211 } +// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 } +// { dg-error "not a pointer-to-object type" "" { target *-*-* } 68 } +// { dg-error "forming pointer to reference type" "" { target *-*-* } 187 } +// { dg-error "forming pointer to reference type" "" { target *-*-* } 213 } propagate_const test1; diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc index fd25204efb1..abc48391ff8 100644 --- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc +++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc @@ -21,6 +21,6 @@ using std::experimental::propagate_const; -// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 } +// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 } propagate_const test1; diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc index 3cea93d4f38..1c3c653a9a1 100644 --- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc +++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc @@ -21,8 +21,8 @@ using std::experimental::propagate_const; -// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 } -// { dg-error "invalid type" "" { target *-*-* } 66 } -// { dg-error "uninitialized reference member" "" { target *-*-* } 112 } +// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 } +// { dg-error "invalid type" "" { target *-*-* } 68 } +// { dg-error "uninitialized reference member" "" { target *-*-* } 114 } propagate_const test1; // { dg-error "use of deleted function" } diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc index 9740fc31d8c..72844fa2a2e 100644 --- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc +++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc @@ -21,6 +21,6 @@ using std::experimental::propagate_const; -// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 } +// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 } propagate_const test1;