aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/new-op.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-11-24 12:01:24 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2016-11-24 12:01:24 -0800
commitbbe910e6e1140cb484a74911f3cea854cf9e7e2a (patch)
treef1e36cce0d512302a559831c0df78c913e86303b /gdb/common/new-op.c
parent793c128d03113816db85e8d1fa0bcd4982e246ee (diff)
downloadgdb-bbe910e6e1140cb484a74911f3cea854cf9e7e2a.zip
gdb-bbe910e6e1140cb484a74911f3cea854cf9e7e2a.tar.gz
gdb-bbe910e6e1140cb484a74911f3cea854cf9e7e2a.tar.bz2
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.
Diffstat (limited to 'gdb/common/new-op.c')
-rw-r--r--gdb/common/new-op.c4
1 files changed, 2 insertions, 2 deletions
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);
}