From 2dbe56bdfbf6c570cf23073f0c596da6bd1531c8 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely
Date: Thu, 22 Sep 2016 14:58:49 +0100
Subject: [PATCH] Implement C++17 node extraction and insertion (P0083R5)
* doc/xml/manual/status_cxx2017.xml: Document status.
* doc/html/*: Regenerate.
* include/Makefile.am: Add bits/node_handle.h and reorder.
* include/Makefile.in: Regenerate.
* include/bits/hashtable.h (_Hashtable::node_type)
(_Hashtable::insert_return_type, _Hashtable::_M_reinsert_node)
(_Hashtable::_M_reinsert_node_multi, _Hashtable::extract)
(_Hashtable::_M_merge_unique, _Hashtable::_M_merge_multi): Define.
(_Hash_merge_helper): Define primary template.
* include/bits/node_handle.h: New header.
* include/bits/stl_map.h (map): Declare _Rb_tree_merge_helper as
friend.
(map::node_type, map::insert_return_type, map::extract, map::merge)
(map::insert(node_type&&), map::insert(const_iterator, node_type&&)):
Define new members.
(_Rb_tree_merge_helper): Specialize for map.
* include/bits/stl_multimap.h (multimap): Declare _Rb_tree_merge_helper
as friend.
(multimap::node_type, multimap::extract, multimap::merge)
(multimap::insert(node_type&&))
(multimap::insert(const_iterator, node_type&&)): Define.
(_Rb_tree_merge_helper): Specialize for multimap.
* include/bits/stl_multiset.h (multiset): Declare _Rb_tree_merge_helper
as friend.
(multiset::node_type, multiset::extract, multiset::merge)
(multiset::insert(node_type&&))
(multiset::insert(const_iterator, node_type&&)): Define.
* include/bits/stl_set.h (set): Declare _Rb_tree_merge_helper as
friend.
(set::node_type, set::insert_return_type, set::extract, set::merge)
(set::insert(node_type&&), set::insert(const_iterator, node_type&&)):
Define.
(_Rb_tree_merge_helper): Specialize for set.
* include/bits/stl_tree.h (_Rb_tree): Declare _Rb_tree<> as friend.
(_Rb_tree::node_type, _Rb_tree::insert_return_type)
(_Rb_tree::_M_reinsert_node_unique, _Rb_tree::_M_reinsert_node_equal)
(_Rb_tree::_M_reinsert_node_hint_unique)
(_Rb_tree::_M_reinsert_node_hint_equal, _Rb_tree::extract)
(_Rb_tree::_M_merge_unique, _Rb_tree::_M_merge_equal): Define.
(_Rb_tree_merge_helper): Specialize for multiset.
* include/bits/unordered_map.h (unordered_map): Declare
unordered_map<> and unordered_multimap<> as friends.
(unordered_map::node_type, unordered_map::insert_return_type)
(unordered_map::extract, unordered_map::merge)
(unordered_map::insert(node_type&&))
(unordered_map::insert(const_iterator, node_type&&))
(unordered_multimap): Declare _Hash_merge_helper as friend.
(unordered_multimap::node_type, unordered_multimap::extract)
(unordered_multimap::merge, unordered_multimap::insert(node_type&&))
(unordered_multimap::insert(const_iterator, node_type&&)): Define.
(_Hash_merge_helper): Specialize for unordered maps and multimaps.
* include/bits/unordered_set.h (unordered_set, unordered_multiset):
Declare _Hash_merge_helper as friend.
(unordered_set::node_type, unordered_set::insert_return_type)
(unordered_set::extract, unordered_set::merge)
(unordered_set::insert(node_type&&))
(unordered_set::insert(const_iterator, node_type&&)): Define.
(unordered_multiset::node_type, unordered_multiset::extract)
(unordered_multiset::merge, unordered_multiset::insert(node_type&&))
(unordered_multiset::insert(const_iterator, node_type&&)): Define.
(_Hash_merge_helper): Specialize for unordered sets and multisets.
* include/debug/map.h (map): Add using declarations or forwarding
functions for new members.
* include/debug/map.h (multimap): Likewise.
* include/debug/map.h (multiset): Likewise.
* include/debug/map.h (set): Likewise.
* include/debug/unordered_map (unordered_map, unordered_multimap):
Likewise.
* include/debug/unordered_set( unordered_set, unordered_multiset):
Likewise.
* python/libstdcxx/v6/printers.py (get_value_from_aligned_membuf): New
helper function.
(get_value_from_list_node, get_value_from_Rb_tree_node): Use helper.
(StdNodeHandlePrinter): Define printer for node handles.
(build_libstdcxx_dictionary): Register StdNodeHandlePrinter.
* testsuite/23_containers/map/modifiers/extract.cc: New.
* testsuite/23_containers/map/modifiers/merge.cc: New.
* testsuite/23_containers/multimap/modifiers/extract.cc: New.
* testsuite/23_containers/multimap/modifiers/merge.cc: New.
* testsuite/23_containers/multiset/modifiers/extract.cc: New.
* testsuite/23_containers/multiset/modifiers/merge.cc: New.
* testsuite/23_containers/set/modifiers/extract.cc: New.
* testsuite/23_containers/set/modifiers/merge.cc: New.
* testsuite/23_containers/unordered_map/modifiers/extract.cc: New.
* testsuite/23_containers/unordered_map/modifiers/merge.cc: New.
* testsuite/23_containers/unordered_multimap/modifiers/extract.cc:
New.
* testsuite/23_containers/unordered_multimap/modifiers/merge.cc: New.
* testsuite/23_containers/unordered_multiset/modifiers/extract.cc:
New.
* testsuite/23_containers/unordered_multiset/modifiers/merge.cc: New.
* testsuite/23_containers/unordered_set/modifiers/extract.cc: New.
* testsuite/23_containers/unordered_set/modifiers/merge.cc: New.
* testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
dg-error lineno.
* testsuite/libstdc++-prettyprinters/cxx17.cc: Test node handles.
From-SVN: r240363
---
libstdc++-v3/ChangeLog | 100 ++++++
.../doc/html/manual/profile_mode_devel.html | 2 +-
libstdc++-v3/doc/html/manual/status.html | 4 +-
.../doc/xml/manual/status_cxx2017.xml | 3 +-
libstdc++-v3/include/Makefile.am | 3 +-
libstdc++-v3/include/Makefile.in | 3 +-
libstdc++-v3/include/bits/hashtable.h | 141 ++++++++
libstdc++-v3/include/bits/node_handle.h | 330 ++++++++++++++++++
libstdc++-v3/include/bits/stl_map.h | 83 +++++
libstdc++-v3/include/bits/stl_multimap.h | 82 +++++
libstdc++-v3/include/bits/stl_multiset.h | 81 +++++
libstdc++-v3/include/bits/stl_set.h | 81 +++++
libstdc++-v3/include/bits/stl_tree.h | 197 ++++++++++-
libstdc++-v3/include/bits/unordered_map.h | 178 +++++++++-
libstdc++-v3/include/bits/unordered_set.h | 172 +++++++++
libstdc++-v3/include/debug/map.h | 46 ++-
libstdc++-v3/include/debug/multimap.h | 34 ++
libstdc++-v3/include/debug/multiset.h | 34 ++
libstdc++-v3/include/debug/set.h | 45 +++
libstdc++-v3/include/debug/unordered_map | 94 ++++-
libstdc++-v3/include/debug/unordered_set | 93 +++++
libstdc++-v3/python/libstdcxx/v6/printers.py | 58 ++-
.../23_containers/map/modifiers/extract.cc | 147 ++++++++
.../23_containers/map/modifiers/merge.cc | 147 ++++++++
.../multimap/modifiers/extract.cc | 141 ++++++++
.../23_containers/multimap/modifiers/merge.cc | 119 +++++++
.../multiset/modifiers/extract.cc | 129 +++++++
.../23_containers/multiset/modifiers/merge.cc | 117 +++++++
.../23_containers/set/modifiers/extract.cc | 138 ++++++++
.../23_containers/set/modifiers/merge.cc | 143 ++++++++
.../unordered_map/modifiers/extract.cc | 148 ++++++++
.../unordered_map/modifiers/merge.cc | 140 ++++++++
.../unordered_multimap/modifiers/extract.cc | 138 ++++++++
.../unordered_multimap/modifiers/merge.cc | 123 +++++++
.../unordered_multiset/modifiers/extract.cc | 128 +++++++
.../unordered_multiset/modifiers/merge.cc | 121 +++++++
.../unordered_set/instantiation_neg.cc | 2 +-
.../unordered_set/modifiers/extract.cc | 140 ++++++++
.../unordered_set/modifiers/merge.cc | 140 ++++++++
.../libstdc++-prettyprinters/cxx17.cc | 16 +-
40 files changed, 4019 insertions(+), 22 deletions(-)
create mode 100644 libstdc++-v3/include/bits/node_handle.h
create mode 100644 libstdc++-v3/testsuite/23_containers/map/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/map/modifiers/merge.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/multimap/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/multimap/modifiers/merge.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/modifiers/merge.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/set/modifiers/merge.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/merge.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/modifiers/merge.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multiset/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multiset/modifiers/merge.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/extract.cc
create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/merge.cc
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 16a49549af4..9376bfbdf2f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,103 @@
+2016-09-22 Jonathan Wakely
+
+ Implement C++17 node extraction and insertion (P0083R5)
+ * doc/xml/manual/status_cxx2017.xml: Document status.
+ * doc/html/*: Regenerate.
+ * include/Makefile.am: Add bits/node_handle.h and reorder.
+ * include/Makefile.in: Regenerate.
+ * include/bits/hashtable.h (_Hashtable::node_type)
+ (_Hashtable::insert_return_type, _Hashtable::_M_reinsert_node)
+ (_Hashtable::_M_reinsert_node_multi, _Hashtable::extract)
+ (_Hashtable::_M_merge_unique, _Hashtable::_M_merge_multi): Define.
+ (_Hash_merge_helper): Define primary template.
+ * include/bits/node_handle.h: New header.
+ * include/bits/stl_map.h (map): Declare _Rb_tree_merge_helper as
+ friend.
+ (map::node_type, map::insert_return_type, map::extract, map::merge)
+ (map::insert(node_type&&), map::insert(const_iterator, node_type&&)):
+ Define new members.
+ (_Rb_tree_merge_helper): Specialize for map.
+ * include/bits/stl_multimap.h (multimap): Declare _Rb_tree_merge_helper
+ as friend.
+ (multimap::node_type, multimap::extract, multimap::merge)
+ (multimap::insert(node_type&&))
+ (multimap::insert(const_iterator, node_type&&)): Define.
+ (_Rb_tree_merge_helper): Specialize for multimap.
+ * include/bits/stl_multiset.h (multiset): Declare _Rb_tree_merge_helper
+ as friend.
+ (multiset::node_type, multiset::extract, multiset::merge)
+ (multiset::insert(node_type&&))
+ (multiset::insert(const_iterator, node_type&&)): Define.
+ * include/bits/stl_set.h (set): Declare _Rb_tree_merge_helper as
+ friend.
+ (set::node_type, set::insert_return_type, set::extract, set::merge)
+ (set::insert(node_type&&), set::insert(const_iterator, node_type&&)):
+ Define.
+ (_Rb_tree_merge_helper): Specialize for set.
+ * include/bits/stl_tree.h (_Rb_tree): Declare _Rb_tree<> as friend.
+ (_Rb_tree::node_type, _Rb_tree::insert_return_type)
+ (_Rb_tree::_M_reinsert_node_unique, _Rb_tree::_M_reinsert_node_equal)
+ (_Rb_tree::_M_reinsert_node_hint_unique)
+ (_Rb_tree::_M_reinsert_node_hint_equal, _Rb_tree::extract)
+ (_Rb_tree::_M_merge_unique, _Rb_tree::_M_merge_equal): Define.
+ (_Rb_tree_merge_helper): Specialize for multiset.
+ * include/bits/unordered_map.h (unordered_map): Declare
+ unordered_map<> and unordered_multimap<> as friends.
+ (unordered_map::node_type, unordered_map::insert_return_type)
+ (unordered_map::extract, unordered_map::merge)
+ (unordered_map::insert(node_type&&))
+ (unordered_map::insert(const_iterator, node_type&&))
+ (unordered_multimap): Declare _Hash_merge_helper as friend.
+ (unordered_multimap::node_type, unordered_multimap::extract)
+ (unordered_multimap::merge, unordered_multimap::insert(node_type&&))
+ (unordered_multimap::insert(const_iterator, node_type&&)): Define.
+ (_Hash_merge_helper): Specialize for unordered maps and multimaps.
+ * include/bits/unordered_set.h (unordered_set, unordered_multiset):
+ Declare _Hash_merge_helper as friend.
+ (unordered_set::node_type, unordered_set::insert_return_type)
+ (unordered_set::extract, unordered_set::merge)
+ (unordered_set::insert(node_type&&))
+ (unordered_set::insert(const_iterator, node_type&&)): Define.
+ (unordered_multiset::node_type, unordered_multiset::extract)
+ (unordered_multiset::merge, unordered_multiset::insert(node_type&&))
+ (unordered_multiset::insert(const_iterator, node_type&&)): Define.
+ (_Hash_merge_helper): Specialize for unordered sets and multisets.
+ * include/debug/map.h (map): Add using declarations or forwarding
+ functions for new members.
+ * include/debug/map.h (multimap): Likewise.
+ * include/debug/map.h (multiset): Likewise.
+ * include/debug/map.h (set): Likewise.
+ * include/debug/unordered_map (unordered_map, unordered_multimap):
+ Likewise.
+ * include/debug/unordered_set( unordered_set, unordered_multiset):
+ Likewise.
+ * python/libstdcxx/v6/printers.py (get_value_from_aligned_membuf): New
+ helper function.
+ (get_value_from_list_node, get_value_from_Rb_tree_node): Use helper.
+ (StdNodeHandlePrinter): Define printer for node handles.
+ (build_libstdcxx_dictionary): Register StdNodeHandlePrinter.
+ * testsuite/23_containers/map/modifiers/extract.cc: New.
+ * testsuite/23_containers/map/modifiers/merge.cc: New.
+ * testsuite/23_containers/multimap/modifiers/extract.cc: New.
+ * testsuite/23_containers/multimap/modifiers/merge.cc: New.
+ * testsuite/23_containers/multiset/modifiers/extract.cc: New.
+ * testsuite/23_containers/multiset/modifiers/merge.cc: New.
+ * testsuite/23_containers/set/modifiers/extract.cc: New.
+ * testsuite/23_containers/set/modifiers/merge.cc: New.
+ * testsuite/23_containers/unordered_map/modifiers/extract.cc: New.
+ * testsuite/23_containers/unordered_map/modifiers/merge.cc: New.
+ * testsuite/23_containers/unordered_multimap/modifiers/extract.cc:
+ New.
+ * testsuite/23_containers/unordered_multimap/modifiers/merge.cc: New.
+ * testsuite/23_containers/unordered_multiset/modifiers/extract.cc:
+ New.
+ * testsuite/23_containers/unordered_multiset/modifiers/merge.cc: New.
+ * testsuite/23_containers/unordered_set/modifiers/extract.cc: New.
+ * testsuite/23_containers/unordered_set/modifiers/merge.cc: New.
+ * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
+ dg-error lineno.
+ * testsuite/libstdc++-prettyprinters/cxx17.cc: Test node handles.
+
2016-09-22 Ville Voutilainen
Fix tests on old arm platforms for optional.
diff --git a/libstdc++-v3/doc/html/manual/profile_mode_devel.html b/libstdc++-v3/doc/html/manual/profile_mode_devel.html
index 2521dd66811..db96f989b24 100644
--- a/libstdc++-v3/doc/html/manual/profile_mode_devel.html
+++ b/libstdc++-v3/doc/html/manual/profile_mode_devel.html
@@ -64,4 +64,4 @@
include/profile/impl/profiler_trace.h
. Use
__trace_vector_to_list
as an example.
Add documentation in file doc/xml/manual/profile_mode.xml
.
-