forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user