aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-07-17 14:16:51 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-07-17 14:16:51 +0100
commit79a88477ad431b7368b98f80f91077177383012d (patch)
tree402a8c4308d672babc7593faad188731e6cd3e3e
parent3f4453745ecf9ff1730567c665f4b1847bd3d33f (diff)
downloadgcc-79a88477ad431b7368b98f80f91077177383012d.zip
gcc-79a88477ad431b7368b98f80f91077177383012d.tar.gz
gcc-79a88477ad431b7368b98f80f91077177383012d.tar.bz2
Remove unused explicit instantiation of __bind_simple
The explicit instantiation of std::call_once used to require an instantiation of __bind_simple, but call_once was changed by r241031 to not use __bind_simple. The instantiation of __bind_simple (and the definitions it uses) are not needed. They should have been removed instead of doing the changes in r241111 that kept them compiling. The use of std::call_once by _Async_state_common::_M_join can be simplified to use a pointer instead of reference wrapper. The call_once symbol isn't exported so the change isn't visible outside the library. * src/c++11/compatibility-thread-c++0x.cc [_GLIBCXX_SHARED] (_Async_state_common::_M_join): Simplify use of std::call_once and corresponding explicit instantiation. (_Maybe_wrap_member_pointer, _Bind_simple, _Bind_simple_helper) (__bind_simple): Remove definitions and explicit instantiation that are not required by exported symbols. From-SVN: r262823
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc82
2 files changed, 12 insertions, 79 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index dc5dc47..33b2eea 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2018-07-17 Jonathan Wakely <jwakely@redhat.com>
+
+ * src/c++11/compatibility-thread-c++0x.cc [_GLIBCXX_SHARED]
+ (_Async_state_common::_M_join): Simplify use of std::call_once and
+ corresponding explicit instantiation.
+ (_Maybe_wrap_member_pointer, _Bind_simple, _Bind_simple_helper)
+ (__bind_simple): Remove definitions and explicit instantiation that
+ are not required by exported symbols.
+
2018-07-16 Jonathan Wakely <jwakely@redhat.com>
* scripts/create_testsuite_files: Fix typo in comment.
diff --git a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
index 7abbb59..e60c8f9 100644
--- a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
+++ b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
@@ -109,7 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
protected:
~_Async_state_common();
virtual void _M_run_deferred() { _M_join(); }
- void _M_join() { std::call_once(_M_once, &thread::join, ref(_M_thread)); }
+ void _M_join() { std::call_once(_M_once, &thread::join, &_M_thread); }
thread _M_thread;
once_flag _M_once;
};
@@ -117,84 +117,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Replaced with inline definition in gcc-4.8.0
__future_base::_Async_state_common::~_Async_state_common() { _M_join(); }
- template<typename _Tp>
- struct _Maybe_wrap_member_pointer;
-
- template<typename _Tp, typename _Class>
- struct _Maybe_wrap_member_pointer<_Tp _Class::*>
- {
- typedef _Mem_fn<_Tp _Class::*> type;
-
- static constexpr type
- __do_wrap(_Tp _Class::* __pm)
- { return type(__pm); }
- };
-
- template<typename _Signature>
- struct _Bind_simple;
-
- template<typename _Callable, typename... _Args>
- struct _Bind_simple<_Callable(_Args...)>
- {
- typedef typename result_of<_Callable(_Args...)>::type result_type;
-
- template<typename _Tp, typename... _Up>
- explicit
- _Bind_simple(_Tp&& __f, _Up&&... __args)
- : _M_bound(std::forward<_Tp>(__f), std::forward<_Up>(__args)...)
- { }
-
- _Bind_simple(const _Bind_simple&) = default;
- _Bind_simple(_Bind_simple&&) = default;
-
- result_type
- operator()()
- {
- typedef typename _Build_index_tuple<sizeof...(_Args)>::__type _Indices;
- return _M_invoke(_Indices());
- }
-
- private:
- template<std::size_t... _Indices>
- typename result_of<_Callable(_Args...)>::type
- _M_invoke(_Index_tuple<_Indices...>)
- {
- // std::bind always forwards bound arguments as lvalues,
- // but this type can call functions which only accept rvalues.
- return std::forward<_Callable>(std::get<0>(_M_bound))(
- std::forward<_Args>(std::get<_Indices+1>(_M_bound))...);
- }
-
- std::tuple<_Callable, _Args...> _M_bound;
- };
-
- template<typename _Func, typename... _BoundArgs>
- struct _Bind_simple_helper
- {
- typedef _Maybe_wrap_member_pointer<typename decay<_Func>::type>
- __maybe_type;
- typedef typename __maybe_type::type __func_type;
- typedef _Bind_simple<__func_type(typename decay<_BoundArgs>::type...)>
- __type;
- };
-
- // Simplified version of std::bind for internal use, without support for
- // unbound arguments, placeholders or nested bind expressions.
- template<typename _Callable, typename... _Args>
- typename _Bind_simple_helper<_Callable, _Args...>::__type
- __bind_simple(_Callable&& __callable, _Args&&... __args)
- {
- typedef _Bind_simple_helper<_Callable, _Args...> __helper_type;
- typedef typename __helper_type::__maybe_type __maybe_type;
- typedef typename __helper_type::__type __result_type;
- return __result_type(
- __maybe_type::__do_wrap( std::forward<_Callable>(__callable)),
- std::forward<_Args>(__args)...);
- }
-
- // Explicit instantiation due to -fno-implicit-instantiation.
- template void call_once(once_flag&, void (thread::*&&)(), reference_wrapper<thread>&&);
- template _Bind_simple_helper<void (thread::*)(), reference_wrapper<thread>>::__type __bind_simple(void (thread::*&&)(), reference_wrapper<thread>&&);
+ // Explicit instantiation due to -fno-implicit-templates.
+ template void call_once(once_flag&, void (thread::*&&)(), thread*&&);
#endif // _GLIBCXX_HAVE_TLS
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std