Avoid #include <functional> in other headers
authorJonathan Wakely <jwakely@redhat.com>
Thu, 13 Oct 2016 16:59:19 +0000 (17:59 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 13 Oct 2016 16:59:19 +0000 (17:59 +0100)
* include/bits/shared_ptr_base.h: Include <functional>.
[!__cpp_rtti]: Do not include <typeinfo>.
* include/experimental/array: Do not include <functional>.
* include/experimental/memory: Include <bits/functional_hash.h>
instead of <functional>.
* include/experimental/propagate_const: Include <bits/stl_function.h>,
<bits/functional_hash.h>, and <bits/move.h> instead of <functional>.
* include/experimental/tuple: Do not include <functional>.
* include/std/future: Include <functional>.
* include/std/memory: Do not include <functional>.
* 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

24 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/shared_ptr_base.h
libstdc++-v3/include/experimental/array
libstdc++-v3/include/experimental/memory
libstdc++-v3/include/experimental/propagate_const
libstdc++-v3/include/experimental/tuple
libstdc++-v3/include/std/future
libstdc++-v3/include/std/memory
libstdc++-v3/include/std/mutex
libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
libstdc++-v3/testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc
libstdc++-v3/testsuite/30_threads/call_once/60497.cc
libstdc++-v3/testsuite/30_threads/lock/2.cc
libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc
libstdc++-v3/testsuite/experimental/algorithm/sample.cc
libstdc++-v3/testsuite/experimental/array/make_array.cc
libstdc++-v3/testsuite/experimental/array/neg.cc
libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc
libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc
libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc
libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc
libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc

index f179fc90b1966ecf06423c511ac97294d4a85b29..c421111daac1fc1dac7ab5487746e3855e9b1ee6 100644 (file)
@@ -1,5 +1,35 @@
 2016-10-13  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/bits/shared_ptr_base.h: Include <functional>.
+       [!__cpp_rtti]: Do not include <typeinfo>.
+       * include/experimental/array: Do not include <functional>.
+       * include/experimental/memory: Include <bits/functional_hash.h>
+       instead of <functional>.
+       * include/experimental/propagate_const: Include <bits/stl_function.h>,
+       <bits/functional_hash.h>, and <bits/move.h> instead of <functional>.
+       * include/experimental/tuple: Do not include <functional>.
+       * include/std/future: Include <functional>.
+       * include/std/memory: Do not include <functional>.
+       * 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
index e8820a148c3781892cf99678f1b8cc5ff4d2e724..422e3b5b9594bbc15b7c1d67c86318382574247d 100644 (file)
 #ifndef _SHARED_PTR_BASE_H
 #define _SHARED_PTR_BASE_H 1
 
-#include <typeinfo>
+#include <functional>
+#if __cpp_rtti
+# include <typeinfo>
+#endif
 #include <bits/allocated_ptr.h>
 #include <ext/aligned_buffer.h>
 
index 31a066b3ce804537035f5bc741dd578e17296c22..34d75cc2017933df2046aabd1964a725469ddf25 100644 (file)
@@ -36,7 +36,6 @@
 #else
 
 #include <array>
-#include <functional>
 #include <experimental/type_traits>
 
 namespace std _GLIBCXX_VISIBILITY(default)
index 885d11cb351ac860aeadc5ce5e4fa04e2cb36a3d..81def241515a37d018a6a7d527065ab6beaf7da2 100644 (file)
@@ -42,8 +42,8 @@
 #include <memory>
 #include <type_traits>
 #include <utility>
-#include <functional>
 #include <experimental/bits/shared_ptr.h>
+#include <bits/functional_hash.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
index e1fb4e49198bca7dbfaec0f482a53b2cf2a3e75c..5f32111fbba241105f7a581cb6bf0f41a3e94867 100644 (file)
@@ -36,7 +36,9 @@
 #else
 
 #include <type_traits>
-#include <functional>
+#include <bits/functional_hash.h>
+#include <bits/move.h>
+#include <bits/stl_function.h>
 #include <experimental/bits/lfts_config.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
index dc158e8834224c35fc106c6445e128fc92d7a7bc..e83a0ed9b637226c34a9be048f49bf6a5ed0c570 100644 (file)
@@ -36,7 +36,6 @@
 #else
 
 #include <tuple>
-#include <functional>
 #include <bits/invoke.h>
 #include <experimental/bits/lfts_config.h>
 
index fffbdbb70520e11c13922291b573646fcf87c5ff..31a21f976eed4126bce1f16fd9e24d79eb1ea8dd 100644 (file)
@@ -40,6 +40,7 @@
 #include <condition_variable>
 #include <system_error>
 #include <atomic>
+#include <functional>
 #include <bits/atomic_futex.h>
 #include <bits/functexcept.h>
 #include <bits/invoke.h>
index beee91a79ada5acd7348bca9aaaba28709f6abbe..0f6d8bc945f72113cfded1d3fc621c1eb9538e39 100644 (file)
@@ -76,7 +76,6 @@
 #  include <bits/stl_function.h>  // std::less
 #  include <bits/uses_allocator.h>
 #  include <type_traits>
-#  include <functional>
 #  include <debug/debug.h>
 #  include <bits/unique_ptr.h>
 #  include <bits/shared_ptr.h>
index e90006f43a0dddfb6c7389718d5858b49c81dbb7..0e1bc7fd412f44b26aa2e8e44b9369bc6b4450ae 100644 (file)
 #include <chrono>
 #include <exception>
 #include <type_traits>
-#include <functional>
 #include <system_error>
 #include <bits/std_mutex.h>
 #if ! _GTHREAD_USE_MUTEX_TIMEDLOCK
 # include <condition_variable>
 # include <thread>
 #endif
+#ifndef _GLIBCXX_HAVE_TLS
+# include <functional>
+#endif
 
 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
index 5014898b2b9fc8598837ab3cceecfbb13ac37d78..e78093fe4bf4fb132bd6b4958c73ec0c91f3ba15 100644 (file)
@@ -28,6 +28,7 @@
 #include <cstdlib>
 #include <thread>
 #include <atomic>
+#include <functional>
 #include <testsuite_hooks.h>
 
 #ifdef _GLIBCXX_HAVE_UNISTD_H
index eaa72c42a73e26bbae2d5c13d75f88e91d4a98d7..96a5cf86653942decdaf4f14eb9ea14bb7f39ec0 100644 (file)
@@ -28,6 +28,7 @@
 #include <cstdlib>
 #include <thread>
 #include <atomic>
+#include <functional>
 #include <testsuite_hooks.h>
 
 #ifdef _GLIBCXX_HAVE_UNISTD_H
index a86e61a2234f21e8413a49bf816364e06b8b453c..a84776751a71b4964996e5c09364f63158fc31b7 100644 (file)
@@ -21,6 +21,7 @@
 #include <testsuite_hooks.h>
 #include <string>
 #include <array>
+#include <vector>
 #include <sstream>
 
 int del_count = 0;
index 43dc917f5e49d714f2c96d2b0792970d12dd4d5e..a9e6449080e3cc348adc3358b6e7323f0ea89c90 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <mutex>
 #include <memory>
+#include <functional>
 
 struct A;
 template<typename T> struct B { T t; };
index d3692a0600efcc575cbe577787c61d7fe567b3fa..c17442081e6f73833bec6575b09b46721f5dba3f 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <mutex>
 #include <thread>
+#include <functional>
 #include <testsuite_hooks.h>
 
 void locker(std::mutex& m1, std::mutex& m2, std::mutex& m3)
index 9b5417c88dcf55d7f114bc11ce1ab9c1c8e81e23..db04b0521e654bda3fe6b493ee464bba90e30dcd 100644 (file)
@@ -24,6 +24,7 @@
 #include <pthread.h>
 #include <thread>
 #include <atomic>
+#include <functional>
 
 void f(std::atomic<bool>& started)
 {
index 0d84e9dd7f42bfb87d79bc6b6019299b58dd268b..16e6a74f38cf53cdde879eed3d64a28b370e2157 100644 (file)
@@ -23,6 +23,7 @@
 #include <forward_list>
 #include <vector>
 #include <random>
+#include <algorithm>
 #include <testsuite_hooks.h>
 
 std::mt19937 rng;
index 56611df505b0c8c82f6b2b1b55140bc5bb43aa97..e91a5d826e71d106bb4d7d7fce3bcd29d24ee203 100644 (file)
@@ -18,6 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 #include <experimental/array>
+#include <functional>
 
 struct MoveOnly
 {
index e91a5c5b0e2140d81ea0af180ddfe3b33a72294a..cd086577657f72dac0070eccea283e5b2d8b4bd7 100644 (file)
 // <http://www.gnu.org/licenses/>.
 
 #include <experimental/array>
+#include <functional>
 
 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 }
 }
index 1b0366d756a2a1589fef638eb7223b2c80ba982f..6dc0e2e5ed969577bad6b9b3c078855a43d0a46d 100644 (file)
@@ -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()
 {
index ffdc756569128914478233f2ca245ce9831ef600..abfc62dc0096cd658a5c30f302a18a779f3120d6 100644 (file)
 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()
 {
index de2d293453de3b4cbfc9f6cff3cf93041f498f5d..5f46dc4052b91f4b26a684554a4fe832d8614d88 100644 (file)
@@ -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<void*> test1;
index fd25204efb1e0325f51a34a191dc6ae3ad5a3202..abc48391ff8aa8af0ef6f5a61446942b3889dc61 100644 (file)
@@ -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<void (*)()> test1;
index 3cea93d4f38b41a879c074a7431c1c3c5e1de86e..1c3c653a9a18fd21fec06ea1d42e96061855a437 100644 (file)
@@ -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<int&> test1; // { dg-error "use of deleted function" }
index 9740fc31d8cb80fcb2fad4a4d0cd9cd08927c881..72844fa2a2efabecb2f367029ed39cbb34bfb180 100644 (file)
@@ -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<int[1]> test1;