[_Hashtable] Add missing destructor call
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Testing passed
|
Commit Message
Noticed looking for other occasion to replace __try/__catch with RAII
helper.
libstdc++: [_Hashtable] Add missing node destructor call
libstdc++-v3/ChangeLog:
* include/bits/hashtable_policy.h
(_Hashtable_alloc<>::_M_allocate_node): Add missing call to
node destructor
on construct exception.
Tested under Linux x64, ok to commit ?
I hope gmail appli will appreciate .diff instead of .patch. .txt are not
in .gitignore so annoying to use for patches.
François
Comments
François Dumont <frs.dumont@gmail.com> writes:
> Noticed looking for other occasion to replace __try/__catch with RAII
> helper.
>
> libstdc++: [_Hashtable] Add missing node destructor call
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/hashtable_policy.h
> (_Hashtable_alloc<>::_M_allocate_node): Add missing call
> to node destructor
> on construct exception.
>
> Tested under Linux x64, ok to commit ?
>
> I hope gmail appli will appreciate .diff instead of .patch. .txt are
> not in .gitignore so annoying to use for patches.
Are you using 'git send-email'? It should handle all of that for you.
>
> François
>
> [2. text/x-patch; hashtable_policy.h.diff]...
On Mon, 6 Nov 2023 at 21:39, François Dumont <frs.dumont@gmail.com> wrote:
>
> Noticed looking for other occasion to replace __try/__catch with RAII
> helper.
>
> libstdc++: [_Hashtable] Add missing node destructor call
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/hashtable_policy.h
> (_Hashtable_alloc<>::_M_allocate_node): Add missing call to
> node destructor
> on construct exception.
>
> Tested under Linux x64, ok to commit ?
>
> I hope gmail appli will appreciate .diff instead of .patch.
No, it doesn't.
> .txt are not
> in .gitignore so annoying to use for patches.
You don't have to create the file inside the Git repo, e.g. I dump
patches to /tmp/patch.txt
On Mon, 6 Nov 2023 at 21:39, François Dumont <frs.dumont@gmail.com> wrote:
>
> Noticed looking for other occasion to replace __try/__catch with RAII
> helper.
>
> libstdc++: [_Hashtable] Add missing node destructor call
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/hashtable_policy.h
> (_Hashtable_alloc<>::_M_allocate_node): Add missing call to
> node destructor
> on construct exception.
>
> Tested under Linux x64, ok to commit ?
OK.
Is this missing on any branches too?
I don't think it's actually a problem, since it's a trivial destructor anyway.
>
> I hope gmail appli will appreciate .diff instead of .patch. .txt are not
> in .gitignore so annoying to use for patches.
>
> François
On 07/11/2023 00:28, Jonathan Wakely wrote:
> On Mon, 6 Nov 2023 at 21:39, François Dumont <frs.dumont@gmail.com> wrote:
>> Noticed looking for other occasion to replace __try/__catch with RAII
>> helper.
>>
>> libstdc++: [_Hashtable] Add missing node destructor call
>>
>> libstdc++-v3/ChangeLog:
>>
>> * include/bits/hashtable_policy.h
>> (_Hashtable_alloc<>::_M_allocate_node): Add missing call to
>> node destructor
>> on construct exception.
>>
>> Tested under Linux x64, ok to commit ?
> OK.
>
> Is this missing on any branches too?
Clearly all maintained branches.
> I don't think it's actually a problem, since it's a trivial destructor anyway.
Yes, me neither, I was only thinking about sanity checker tools when
doing this so no plan for backports.
On Wed, 8 Nov 2023 at 05:39, François Dumont <frs.dumont@gmail.com> wrote:
>
>
> On 07/11/2023 00:28, Jonathan Wakely wrote:
> > On Mon, 6 Nov 2023 at 21:39, François Dumont <frs.dumont@gmail.com> wrote:
> >> Noticed looking for other occasion to replace __try/__catch with RAII
> >> helper.
> >>
> >> libstdc++: [_Hashtable] Add missing node destructor call
> >>
> >> libstdc++-v3/ChangeLog:
> >>
> >> * include/bits/hashtable_policy.h
> >> (_Hashtable_alloc<>::_M_allocate_node): Add missing call to
> >> node destructor
> >> on construct exception.
> >>
> >> Tested under Linux x64, ok to commit ?
> > OK.
> >
> > Is this missing on any branches too?
> Clearly all maintained branches.
> > I don't think it's actually a problem, since it's a trivial destructor anyway.
>
> Yes, me neither, I was only thinking about sanity checker tools when
> doing this so no plan for backports.
OK, that seems fine, thanks.
@@ -2020,19 +2020,20 @@ namespace __detail
_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&&... __args)
-> __node_ptr
{
- auto __nptr = __node_alloc_traits::allocate(_M_node_allocator(), 1);
+ auto& __alloc = _M_node_allocator();
+ auto __nptr = __node_alloc_traits::allocate(__alloc, 1);
__node_ptr __n = std::__to_address(__nptr);
__try
{
::new ((void*)__n) __node_type;
- __node_alloc_traits::construct(_M_node_allocator(),
- __n->_M_valptr(),
+ __node_alloc_traits::construct(__alloc, __n->_M_valptr(),
std::forward<_Args>(__args)...);
return __n;
}
__catch(...)
{
- __node_alloc_traits::deallocate(_M_node_allocator(), __nptr, 1);
+ __n->~__node_type();
+ __node_alloc_traits::deallocate(__alloc, __nptr, 1);
__throw_exception_again;
}
}