From patchwork Wed Nov 23 20:06:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 17744 Received: (qmail 40117 invoked by alias); 23 Nov 2016 20:08:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 40021 invoked by uid 89); 23 Nov 2016 20:08:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=Baldwin, baldwin, Hx-languages-length:1479, nothrow X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 20:07:49 +0000 Received: from ralph.com (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 7C8EE10AA59 for ; Wed, 23 Nov 2016 15:07:47 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH 2/3] Add noexcept to custom non-throwing new operators. Date: Wed, 23 Nov 2016 12:06:51 -0800 Message-Id: <20161123200652.89209-3-jhb@FreeBSD.org> In-Reply-To: <20161123200652.89209-1-jhb@FreeBSD.org> References: <20161123200652.89209-1-jhb@FreeBSD.org> X-IsSubscribed: yes 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. --- 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 9e8fb4f..051d4ce 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2016-11-23 John Baldwin + * common/new-op.c (operator new): Mark 'noexcept'. + (operator new[]): Likewise. + +2016-11-23 John Baldwin + * breakpoint.h (class number_or_range_parser): Use 'class' instead of 'struct'. * mi/mi-main.c (mi_cmd_trace_frame_collected): Use 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); }