This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: profile mode fix
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: FranÃois Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 26 Jan 2014 10:38:26 +0000
- Subject: Re: profile mode fix
- Authentication-results: sourceware.org; auth=none
- References: <52E4D8BC dot 5090701 at gmail dot com>
On 26 January 2014 09:43, FranÃois Dumont wrote:
> Hi
>
> This is a patch to fix PR 55033 in profile mode. Like in debug mode it
> was missing noexcept qualifier on move constructor.
But don't those functions allocate memory? So they can throw.
I agree we want the move constructor to be noexcept anyway, and maybe
the default constructor, but why would we want to lie about the copy
constructor?
I have this patch in my tree that I'm trying to decide whether it
should be committed, but if we make the change we should have a
comment like this:
--- a/libstdc++-v3/include/profile/unordered_base.h
+++ b/libstdc++-v3/include/profile/unordered_base.h
@@ -160,9 +160,14 @@ namespace __profile
__profcxx_hashtable_construct(&__uc, __uc.bucket_count());
__profcxx_hashtable_construct2(&__uc);
}
+
_Unordered_profile(const _Unordered_profile&)
: _Unordered_profile() { }
- _Unordered_profile(_Unordered_profile&&)
+
+ // This might actually throw, but for consistency with normal mode
+ // unordered containers we want the noexcept specification, and will
+ // std::terminate() if an exception is thrown.
+ _Unordered_profile(_Unordered_profile&&) noexcept
: _Unordered_profile() { }
~_Unordered_profile() noexcept