Commit d67dd0be by Jonathan Wakely Committed by Jonathan Wakely

Avoid #include <functional> in other headers

	* 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
parent 40799fe5
2016-10-13 Jonathan Wakely <jwakely@redhat.com> 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. * testsuite/experimental/algorithm/sample.cc: Add missing header.
* include/experimental/propagate_const (element_type): Qualify * include/experimental/propagate_const (element_type): Qualify
......
...@@ -49,7 +49,10 @@ ...@@ -49,7 +49,10 @@
#ifndef _SHARED_PTR_BASE_H #ifndef _SHARED_PTR_BASE_H
#define _SHARED_PTR_BASE_H 1 #define _SHARED_PTR_BASE_H 1
#include <typeinfo> #include <functional>
#if __cpp_rtti
# include <typeinfo>
#endif
#include <bits/allocated_ptr.h> #include <bits/allocated_ptr.h>
#include <ext/aligned_buffer.h> #include <ext/aligned_buffer.h>
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#else #else
#include <array> #include <array>
#include <functional>
#include <experimental/type_traits> #include <experimental/type_traits>
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <functional>
#include <experimental/bits/shared_ptr.h> #include <experimental/bits/shared_ptr.h>
#include <bits/functional_hash.h>
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
{ {
......
...@@ -36,7 +36,9 @@ ...@@ -36,7 +36,9 @@
#else #else
#include <type_traits> #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> #include <experimental/bits/lfts_config.h>
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#else #else
#include <tuple> #include <tuple>
#include <functional>
#include <bits/invoke.h> #include <bits/invoke.h>
#include <experimental/bits/lfts_config.h> #include <experimental/bits/lfts_config.h>
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <condition_variable> #include <condition_variable>
#include <system_error> #include <system_error>
#include <atomic> #include <atomic>
#include <functional>
#include <bits/atomic_futex.h> #include <bits/atomic_futex.h>
#include <bits/functexcept.h> #include <bits/functexcept.h>
#include <bits/invoke.h> #include <bits/invoke.h>
......
...@@ -76,7 +76,6 @@ ...@@ -76,7 +76,6 @@
# include <bits/stl_function.h> // std::less # include <bits/stl_function.h> // std::less
# include <bits/uses_allocator.h> # include <bits/uses_allocator.h>
# include <type_traits> # include <type_traits>
# include <functional>
# include <debug/debug.h> # include <debug/debug.h>
# include <bits/unique_ptr.h> # include <bits/unique_ptr.h>
# include <bits/shared_ptr.h> # include <bits/shared_ptr.h>
......
...@@ -39,13 +39,15 @@ ...@@ -39,13 +39,15 @@
#include <chrono> #include <chrono>
#include <exception> #include <exception>
#include <type_traits> #include <type_traits>
#include <functional>
#include <system_error> #include <system_error>
#include <bits/std_mutex.h> #include <bits/std_mutex.h>
#if ! _GTHREAD_USE_MUTEX_TIMEDLOCK #if ! _GTHREAD_USE_MUTEX_TIMEDLOCK
# include <condition_variable> # include <condition_variable>
# include <thread> # include <thread>
#endif #endif
#ifndef _GLIBCXX_HAVE_TLS
# include <functional>
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <cstdlib> #include <cstdlib>
#include <thread> #include <thread>
#include <atomic> #include <atomic>
#include <functional>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#ifdef _GLIBCXX_HAVE_UNISTD_H #ifdef _GLIBCXX_HAVE_UNISTD_H
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <cstdlib> #include <cstdlib>
#include <thread> #include <thread>
#include <atomic> #include <atomic>
#include <functional>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#ifdef _GLIBCXX_HAVE_UNISTD_H #ifdef _GLIBCXX_HAVE_UNISTD_H
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
#include <string> #include <string>
#include <array> #include <array>
#include <vector>
#include <sstream> #include <sstream>
int del_count = 0; int del_count = 0;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <mutex> #include <mutex>
#include <memory> #include <memory>
#include <functional>
struct A; struct A;
template<typename T> struct B { T t; }; template<typename T> struct B { T t; };
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <functional>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
void locker(std::mutex& m1, std::mutex& m2, std::mutex& m3) void locker(std::mutex& m1, std::mutex& m2, std::mutex& m3)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <pthread.h> #include <pthread.h>
#include <thread> #include <thread>
#include <atomic> #include <atomic>
#include <functional>
void f(std::atomic<bool>& started) void f(std::atomic<bool>& started)
{ {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <forward_list> #include <forward_list>
#include <vector> #include <vector>
#include <random> #include <random>
#include <algorithm>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
std::mt19937 rng; std::mt19937 rng;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <experimental/array> #include <experimental/array>
#include <functional>
struct MoveOnly struct MoveOnly
{ {
......
...@@ -18,10 +18,11 @@ ...@@ -18,10 +18,11 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include <experimental/array> #include <experimental/array>
#include <functional>
int main() int main()
{ {
int dummy; int dummy;
auto bad = std::experimental::make_array(std::ref(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 }
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
using std::experimental::propagate_const; using std::experimental::propagate_const;
using std::unique_ptr; using std::unique_ptr;
// { dg-error "no type" "" { target *-*-* } 159 } // { dg-error "no type" "" { target *-*-* } 161 }
int main() int main()
{ {
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
using std::experimental::propagate_const; using std::experimental::propagate_const;
using std::unique_ptr; using std::unique_ptr;
// { dg-error "no type" "" { target *-*-* } 118 } // { dg-error "no type" "" { target *-*-* } 120 }
// { dg-error "no type" "" { target *-*-* } 125 } // { dg-error "no type" "" { target *-*-* } 127 }
// { dg-error "no type" "" { target *-*-* } 134 } // { dg-error "no type" "" { target *-*-* } 136 }
// { dg-error "no type" "" { target *-*-* } 143 } // { dg-error "no type" "" { target *-*-* } 145 }
int main() int main()
{ {
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
using std::experimental::propagate_const; 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 }
// { dg-error "not a pointer-to-object type" "" { target *-*-* } 66 } // { dg-error "not a pointer-to-object type" "" { target *-*-* } 68 }
// { dg-error "forming pointer to reference type" "" { target *-*-* } 185 } // { dg-error "forming pointer to reference type" "" { target *-*-* } 187 }
// { dg-error "forming pointer to reference type" "" { target *-*-* } 211 } // { dg-error "forming pointer to reference type" "" { target *-*-* } 213 }
propagate_const<void*> test1; propagate_const<void*> test1;
...@@ -21,6 +21,6 @@ ...@@ -21,6 +21,6 @@
using std::experimental::propagate_const; 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; propagate_const<void (*)()> test1;
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
using std::experimental::propagate_const; 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 }
// { dg-error "invalid type" "" { target *-*-* } 66 } // { dg-error "invalid type" "" { target *-*-* } 68 }
// { dg-error "uninitialized reference member" "" { target *-*-* } 112 } // { dg-error "uninitialized reference member" "" { target *-*-* } 114 }
propagate_const<int&> test1; // { dg-error "use of deleted function" } propagate_const<int&> test1; // { dg-error "use of deleted function" }
...@@ -21,6 +21,6 @@ ...@@ -21,6 +21,6 @@
using std::experimental::propagate_const; 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; propagate_const<int[1]> test1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment