On 13/10/16 18:34 +0100, Jonathan Wakely wrote:
This splits the large (2200 lines) header into smaller
pieces, so there are separate headers for:
- std::less, std::equal_to etc. (already in their own header)
- std::__invoke (already in its own header)
- std::reference_wrapper (often used on its own, e.g. in )
- std::function (using in and )
Everything else (std::mem_fn, std::bind, std::not_fn, searchers) stays
in , because we don't actually need them elsewhere in the
library.
Code which doesn't need the whole of should include the
relevant header instead.
This means that we don't need to pull the whole of (and
and ) into just because shared_ptr
wants to use reference_wrapper in one place. This reduces
from 48kloc to 30kloc!
The patch is compressed because it's quite large, but it's mostly just
moving big blocks of code from into new headers.
Any objections?
Nobody objected, so I'm doing it, here's the patch.
Tested powerp64le-linux. Committed to trunk.
commit fe1ee3343d9a010bef95634338014a0e79f3c8c0
Author: Jonathan Wakely
Date: Wed Oct 12 15:59:23 2016 +0100
Split into smaller pieces
* include/Makefile.am: Add and .
Order alphabetically.
* include/Makefile.in: Regenerate.
* include/bits/refwrap.h: New header.
(_Maybe_get_result_type,_Weak_result_type_impl, _Weak_result_type)
(_Reference_wrapper_base_impl, _Reference_wrapper_base)
(reference_wrapper, ref, cref): Move here from .
* include/bits/shared_ptr_base.h: Include and
instead of .
* include/bits/std_function.h: New header.
(_Maybe_unary_or_binary_function, bad_function_call)
(__is_location_invariant, _Nocopy_types, _Any_data)
(_Simple_type_wrapper, _Function_base, _Function_handler, function):
Move here from .
* include/bits/unique_ptr.h: Include .
* include/std/functional: Include new headers and move components to
them.
* include/std/future: Include instead of
.
* include/std/mutex: Likewise.
* include/std/regex: Likewise.
* src/c++11/compatibility-thread-c++0x.cc: Include .
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
lines.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
* testsuite/30_threads/packaged_task/49668.cc: Include .
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index bb4a532..15a164e 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -140,6 +140,7 @@ bits_headers = \
${bits_srcdir}/random.h \
${bits_srcdir}/random.tcc \
${bits_srcdir}/range_access.h \
+ ${bits_srcdir}/refwrap.h \
${bits_srcdir}/regex.h \
${bits_srcdir}/regex.tcc \
${bits_srcdir}/regex_constants.h \
@@ -152,14 +153,13 @@ bits_headers = \
${bits_srcdir}/regex_compiler.tcc \
${bits_srcdir}/regex_executor.h \
${bits_srcdir}/regex_executor.tcc \
- ${bits_srcdir}/stream_iterator.h \
- ${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/shared_ptr.h \
${bits_srcdir}/shared_ptr_atomic.h \
${bits_srcdir}/shared_ptr_base.h \
${bits_srcdir}/slice_array.h \
${bits_srcdir}/sstream.tcc \
${bits_srcdir}/std_abs.h \
+ ${bits_srcdir}/std_function.h \
${bits_srcdir}/std_mutex.h \
${bits_srcdir}/stl_algo.h \
${bits_srcdir}/stl_algobase.h \
@@ -186,6 +186,8 @@ bits_headers = \
${bits_srcdir}/stl_tree.h \
${bits_srcdir}/stl_uninitialized.h \
${bits_srcdir}/stl_vector.h \
+ ${bits_srcdir}/stream_iterator.h \
+ ${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/streambuf.tcc \
${bits_srcdir}/stringfwd.h \
${bits_srcdir}/string_view.tcc \
diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h
new file mode 100644
index 000..06948ff
--- /dev/null
+++ b/libstdc++-v3/include/bits/refwrap.h
@@ -0,0 +1,383 @@
+// Implementation of std::reference_wrapper -*- C++ -*-
+
+// Copyright (C) 2004-2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along