diff mbox

Added noexcept on constructors

Message ID SG2PR06MB05852C18A142643E1E40564CB6810@SG2PR06MB0585.apcprd06.prod.outlook.com
State New
Headers show

Commit Message

Aditya K Dec. 3, 2016, 11:31 a.m. UTC
---
 libstdc++-v3/ChangeLog               | 3 +++
 libstdc++-v3/src/c++11/shared_ptr.cc | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Ville Voutilainen Dec. 3, 2016, 12:20 p.m. UTC | #1
On 3 December 2016 at 13:31, Aditya K <hiraditya@msn.com> wrote:
> ---
>  libstdc++-v3/ChangeLog               | 3 +++
>  libstdc++-v3/src/c++11/shared_ptr.cc | 4 ++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
> index 08d9229..18924c4 100644
> --- a/libstdc++-v3/ChangeLog
> +++ b/libstdc++-v3/ChangeLog
> @@ -1,3 +1,6 @@
> +2016-12-03  Aditya Kumar  <hiraditya@msn.com>
> +       * src/c++11/shared_ptr.cc: Added noexcept on constructors.
> +
>  2016-12-01  David Edelsohn  <dje.gcc@gmail.com>


Please separate the ChangeLogs from patches - Changelog needs to be
temporally linear, and doesn't merge well.
For reference, see the ChangeLog part of https://gcc.gnu.org/contribute.html

> diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc
> index 9028040..b4addd0 100644
> --- a/libstdc++-v3/src/c++11/shared_ptr.cc
> +++ b/libstdc++-v3/src/c++11/shared_ptr.cc
> @@ -56,7 +56,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      { return _Hash_impl::hash(addr) & __gnu_internal::mask; }
>    }
>
> -  _Sp_locker::_Sp_locker(const void* p)
> +  _Sp_locker::_Sp_locker(const void* p) noexcept
>    {
>      if (__gthread_active_p())
>        {
> @@ -67,7 +67,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>        _M_key1 = _M_key2 = __gnu_internal::invalid;
>    }
>
> -  _Sp_locker::_Sp_locker(const void* p1, const void* p2)
> +  _Sp_locker::_Sp_locker(const void* p1, const void* p2) noexcept
>    {
>      if (__gthread_active_p())
>        {

It would be helpful to mention rationale for patches, and add tests to
verify correct functionality. However, in this
case it's fairly obvious that the noexcept-spec of the class
definition declarations of these constructors disagree with the
definitions.
Ville Voutilainen Dec. 3, 2016, 12:40 p.m. UTC | #2
On 3 December 2016 at 14:20, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On 3 December 2016 at 13:31, Aditya K <hiraditya@msn.com> wrote:
>> ---
>>  libstdc++-v3/ChangeLog               | 3 +++
>>  libstdc++-v3/src/c++11/shared_ptr.cc | 4 ++--
>>  2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
>> index 08d9229..18924c4 100644
>> --- a/libstdc++-v3/ChangeLog
>> +++ b/libstdc++-v3/ChangeLog
>> @@ -1,3 +1,6 @@
>> +2016-12-03  Aditya Kumar  <hiraditya@msn.com>
>> +       * src/c++11/shared_ptr.cc: Added noexcept on constructors.
>> +
>>  2016-12-01  David Edelsohn  <dje.gcc@gmail.com>
>
>
> Please separate the ChangeLogs from patches - Changelog needs to be
> temporally linear, and doesn't merge well.
> For reference, see the ChangeLog part of https://gcc.gnu.org/contribute.html


I also failed to mention that a proper ChangeLog entry contains the
context of the change, for example

2016-12-01  Ville Voutilainen  <ville.voutilainen@gmail.com>

        Implement LWG 2766,
        Swapping non-swappable types and LWG 2749,
        swappable traits for variants.
        * include/bits/move.h (swap(_Tp&, _Tp&)): Constrain
        with __is_tuple_like.

Note the parenthesized mention of swap.
diff mbox

Patch

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 08d9229..18924c4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,6 @@ 
+2016-12-03  Aditya Kumar  <hiraditya@msn.com>
+	* src/c++11/shared_ptr.cc: Added noexcept on constructors.
+
 2016-12-01  David Edelsohn  <dje.gcc@gmail.com>
 
 	* testsuite/26_numerics/headers/cmath/hypot.cc: XFAIL on AIX.
diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc
index 9028040..b4addd0 100644
--- a/libstdc++-v3/src/c++11/shared_ptr.cc
+++ b/libstdc++-v3/src/c++11/shared_ptr.cc
@@ -56,7 +56,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return _Hash_impl::hash(addr) & __gnu_internal::mask; }
   }
 
-  _Sp_locker::_Sp_locker(const void* p)
+  _Sp_locker::_Sp_locker(const void* p) noexcept
   {
     if (__gthread_active_p())
       {
@@ -67,7 +67,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _M_key1 = _M_key2 = __gnu_internal::invalid;
   }
 
-  _Sp_locker::_Sp_locker(const void* p1, const void* p2)
+  _Sp_locker::_Sp_locker(const void* p1, const void* p2) noexcept
   {
     if (__gthread_active_p())
       {