From 6eac0600c4305074b28c96d17f75ed0de5016f5b Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Fri, 24 Aug 2018 20:24:42 +0200 Subject: [PATCH] new(nothrow) is malloc-like 2018-08-24 Marc Glisse PR libstdc++/86822 * libsupc++/new (operator new(size_t, nothrow_t), operator new[](size_t, nothrow_t), operator new(size_t, align_val_t, nothrow_t), operator new[](size_t, align_val_t, nothrow_t)): Add malloc attribute. From-SVN: r263841 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/libsupc++/new | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 48a63667430..9f9be6c552c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2018-08-24 Marc Glisse + + PR libstdc++/86822 + * libsupc++/new (operator new(size_t, nothrow_t), operator + new[](size_t, nothrow_t), operator new(size_t, align_val_t, nothrow_t), + operator new[](size_t, align_val_t, nothrow_t)): Add malloc attribute. + 2018-08-24 Jonathan Wakely * include/debug/deque (std::__debug::deque): Declare. diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index 82d884d95d3..19bc1832541 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -137,9 +137,9 @@ void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); #endif void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT - __attribute__((__externally_visible__)); + __attribute__((__externally_visible__, __malloc__)); void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT - __attribute__((__externally_visible__)); + __attribute__((__externally_visible__, __malloc__)); void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT @@ -148,7 +148,7 @@ void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT void* operator new(std::size_t, std::align_val_t) __attribute__((__externally_visible__)); void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) - _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__)); void operator delete(void*, std::align_val_t) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete(void*, std::align_val_t, const std::nothrow_t&) @@ -156,7 +156,7 @@ void operator delete(void*, std::align_val_t, const std::nothrow_t&) void* operator new[](std::size_t, std::align_val_t) __attribute__((__externally_visible__)); void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) - _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__, __malloc__)); void operator delete[](void*, std::align_val_t) _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); void operator delete[](void*, std::align_val_t, const std::nothrow_t&) -- 2.30.2