aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2018-12-23 18:05:23 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2018-12-23 18:05:23 +0000
commit23d5fd6cd6b48b64826f001c55c5591eedab152c (patch)
treecb3f5cc2f151a947c76cb0820e9556446f2cbee2 /libstdc++-v3
parent18246c420fd53a12be68b4ddfcfebf1e80056435 (diff)
downloadgcc-23d5fd6cd6b48b64826f001c55c5591eedab152c.zip
gcc-23d5fd6cd6b48b64826f001c55c5591eedab152c.tar.gz
gcc-23d5fd6cd6b48b64826f001c55c5591eedab152c.tar.bz2
Respect pointer_traits on node deallocation in _ReuseOrAllocNode parenthesis operator.
2018-12-23 François Dumont <fdumont@gcc.gnu.org> Respect pointer_traits on node deallocation in _ReuseOrAllocNode parenthesis operator. * include/bits/hashtable_policy.h (_Hashtable_alloc<>::_M_deallocate_node_ptr(__node_type*)): New. (_Hashtable_alloc<>::_M_deallocate_node(__node_type*)): Use latter. (_ReuseOrAllocNode<>::operator<_Arg>()(_Arg&&)): Likewise. From-SVN: r267380
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog10
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h15
2 files changed, 22 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a0ec66b..dd67656 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2018-12-23 François Dumont <fdumont@gcc.gnu.org>
+
+ Respect pointer_traits on node deallocation in _ReuseOrAllocNode
+ parenthesis operator.
+
+ * include/bits/hashtable_policy.h
+ (_Hashtable_alloc<>::_M_deallocate_node_ptr(__node_type*)): New.
+ (_Hashtable_alloc<>::_M_deallocate_node(__node_type*)): Use latter.
+ (_ReuseOrAllocNode<>::operator<_Arg>()(_Arg&&)): Likewise.
+
2018-12-22 Iain Sandoe <iain@sandoe.co.uk>
* /config/os/bsd/darwin/ppc-extra.ver: Append long double symbols.
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 66fbfbe5..a02396b 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -135,8 +135,7 @@ namespace __detail
}
__catch(...)
{
- __node->~__node_type();
- __node_alloc_traits::deallocate(__a, __node, 1);
+ _M_h._M_deallocate_node_ptr(__node);
__throw_exception_again;
}
return __node;
@@ -2047,6 +2046,9 @@ namespace __detail
void
_M_deallocate_node(__node_type* __n);
+ void
+ _M_deallocate_node_ptr(__node_type* __n);
+
// Deallocate the linked list of nodes pointed to by __n
void
_M_deallocate_nodes(__node_type* __n);
@@ -2086,9 +2088,16 @@ namespace __detail
void
_Hashtable_alloc<_NodeAlloc>::_M_deallocate_node(__node_type* __n)
{
+ __node_alloc_traits::destroy(_M_node_allocator(), __n->_M_valptr());
+ _M_deallocate_node_ptr(__n);
+ }
+
+ template<typename _NodeAlloc>
+ void
+ _Hashtable_alloc<_NodeAlloc>::_M_deallocate_node_ptr(__node_type* __n)
+ {
typedef typename __node_alloc_traits::pointer _Ptr;
auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__n);
- __node_alloc_traits::destroy(_M_node_allocator(), __n->_M_valptr());
__n->~__node_type();
__node_alloc_traits::deallocate(_M_node_allocator(), __ptr, 1);
}