This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Add noexcept to custom non-throwing new operators.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bbe910e6e1140cb484a74911f3cea854cf9e7e2a

commit bbe910e6e1140cb484a74911f3cea854cf9e7e2a
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Thu Nov 24 12:01:24 2016 -0800

    Add noexcept to custom non-throwing new operators.
    
    Both libc++ and libstdc++ declare non-throwing new operators as
    noexcept and overloads must also be noexcept.  This fixes a
    -Wmissing-exception-spec warning with clang.
    
    gdb/ChangeLog:
    
    	* common/new-op.c (operator new): Mark 'noexcept'.
    	(operator new[]): Likewise.

Diff:
---
 gdb/ChangeLog       | 5 +++++
 gdb/common/new-op.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 51787ad..9dc2618 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-24  John Baldwin  <jhb@FreeBSD.org>
+
+	* common/new-op.c (operator new): Mark 'noexcept'.
+	(operator new[]): Likewise.
+
 2016-11-24  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
 	* dwarf2loc.c (copy_bitwise): Use memcpy for the middle part, if
diff --git a/gdb/common/new-op.c b/gdb/common/new-op.c
index 1eb4f94..c67239c 100644
--- a/gdb/common/new-op.c
+++ b/gdb/common/new-op.c
@@ -76,7 +76,7 @@ operator new (std::size_t sz)
 }
 
 void *
-operator new (std::size_t sz, const std::nothrow_t&)
+operator new (std::size_t sz, const std::nothrow_t&) noexcept
 {
   /* malloc (0) is unpredictable; avoid it.  */
   if (sz == 0)
@@ -91,7 +91,7 @@ operator new[] (std::size_t sz)
 }
 
 void*
-operator new[] (std::size_t sz, const std::nothrow_t&)
+operator new[] (std::size_t sz, const std::nothrow_t&) noexcept
 {
   return ::operator new (sz, std::nothrow);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]