hashtable exception safety patch

François Dumont frs.dumont@gmail.com
Tue Sep 13 19:23:00 GMT 2011


On 09/12/2011 09:17 PM, Paolo Carlini wrote:
> On 09/12/2011 09:08 PM, François Dumont wrote:
>> Hi
>>
>>     Yes, ext/throw_allocator.h was just what I needed, with even 
>> better type names. Here is the patch again with the same ChangeLog 
>> entry. Tested under linux x86_64.
>>
>>     Ok to commit ?
> Almost. Before that, please just rebase on the patch I attached in my 
> previous message: I see you (re)introduced various problems, like '/' 
> at the end of lines, instead of the beginning; size_type 
> __saved_next_resize wrongly non-const in rehash(size_type); the comment:
>
>      // Allocate the new node before doing the rehash so that we don't
>      // do a rehash if the allocation throws.
>
>
> again in the wrong place. There may be more, just rebase, please.
>
> Paolo.
>
>
Hi

     To rebase would have forced me to delay the patch of one day which 
I try to avoid... without success. Here it is again.

2011-09-13  François Dumont <fdumont@gcc.gnu.org>
             Paolo Carlini <paolo.carlini@oracle.com>

         * include/bits/hashtable.h (_Hashtable<>::_M_rehash): Take and 
restore
         hash policy _M_prev_resize on exception.
         (_Hashtable<>::_M_insert_bucket): Capture hash policy next resize
         before using it and use latter method to have it restored on 
exception.
         (_Hashtable<>::_M_insert(_Arg&& __v, std::false_type): Likewise.
         (_Hashtable<>::insert(_InputIterator, _InputIterator): Likewise.
         (_Hashtable<>::rehash): Likewise.
         * testsuite/23_containers/unordered_set/insert/hash_policy.cc: New.
         * testsuite/23_containers/unordered_multiset/insert/hash_policy.cc:
         Likewise.

     Tested on x86_64 linux, ok to commit ?

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable_1.patch
Type: text/x-patch
Size: 11505 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20110913/75edc72d/attachment.bin>


More information about the Libstdc++ mailing list