<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Feb 15, 2015 at 6:01 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Sat, Feb 14, 2015 at 9:18 PM, Larisse Voufo <span dir="ltr"><<a href="mailto:lvoufo@google.com" target="_blank">lvoufo@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: lvoufo<br>
Date: Sat Feb 14 23:18:55 2015<br>
New Revision: 229281<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=229281&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=229281&view=rev</a><br>
Log:<br>
Implement C++14's sized deallocation functions, since there are no longer implicitly defined by clang, as of r229241.<br>
<br>
Modified:<br>
libcxx/trunk/include/new<br>
libcxx/trunk/src/new.cpp<br>
<br>
Modified: libcxx/trunk/include/new<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=229281&r1=229280&r2=229281&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=229281&r1=229280&r2=229281&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/new (original)<br>
+++ libcxx/trunk/include/new Sat Feb 14 23:18:55 2015<br>
@@ -50,12 +50,18 @@ new_handler get_new_handler() noexcept;<br>
void* operator new(std::size_t size); // replaceable<br>
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable<br>
void operator delete(void* ptr) noexcept; // replaceable<br>
+void operator delete(void* ptr, std::size_t size) noexcept; // replaceable, C++14<br>
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable<br>
+void operator delete(void* ptr, std::size_t size,<br>
+ const std::nothrow_t&) noexcept; // replaceable, C++14<br>
<br>
void* operator new[](std::size_t size); // replaceable<br>
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable<br>
void operator delete[](void* ptr) noexcept; // replaceable<br>
+void operator delete[](void* ptr, std::size_t size) noexcept; // replaceable, C++14<br>
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable<br>
+void operator delete[](void* ptr, std::size_t size,<br>
+ const std::nothrow_t&) noexcept; // replaceable, C++14<br>
<br>
void* operator new (std::size_t size, void* ptr) noexcept;<br>
void* operator new[](std::size_t size, void* ptr) noexcept;<br>
@@ -133,7 +139,9 @@ _LIBCPP_NEW_DELETE_VIS void* operator ne<br>
;<br>
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;<br>
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _NOEXCEPT;<br>
+_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;<br>
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;<br>
+_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;<br>
<br>
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)<br>
#if !__has_feature(cxx_noexcept)<br>
@@ -142,7 +150,9 @@ _LIBCPP_NEW_DELETE_VIS void* operator ne<br>
;<br>
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;<br>
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;<br>
+_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;<br>
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;<br>
+_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;<br>
<br>
inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}<br>
inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}<br></blockquote><div><br></div></div></div><div>These new declarations should be wrapped in a version check; we should only declare them in <new> if we're in C++14 or later.</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Modified: libcxx/trunk/src/new.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=229281&r1=229280&r2=229281&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=229281&r1=229280&r2=229281&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/src/new.cpp (original)<br>
+++ libcxx/trunk/src/new.cpp Sat Feb 14 23:18:55 2015<br>
@@ -126,6 +126,13 @@ operator delete(void* ptr) _NOEXCEPT<br>
<br>
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS<br>
void<br>
+operator delete(void* ptr, size_t) _NOEXCEPT<br>
+{<br>
+ ::operator delete(ptr);<br>
+}<br>
+<br>
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS<br>
+void<br>
operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT<br>
{<br>
::operator delete(ptr);<br>
@@ -133,9 +140,23 @@ operator delete(void* ptr, const std::no<br>
<br>
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS<br>
void<br>
+operator delete(void* ptr, size_t, const std::nothrow_t&) _NOEXCEPT<br>
+{<br>
+ ::operator delete(ptr);<br></blockquote></div></div></div></div></div></blockquote><div><br></div><div>The default behavior for this function is required to be a call to ::operator delete(ptr, std::nothrow).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+}<br>
+<br>
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS<br>
+void<br>
operator delete[] (void* ptr) _NOEXCEPT<br>
{<br>
- ::operator delete (ptr);<br>
+ ::operator delete(ptr);<br>
+}<br>
+<br>
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS<br>
+void<br>
+operator delete[] (void* ptr, size_t) _NOEXCEPT<br>
+{<br>
+ ::operator delete[](ptr);<br>
}<br>
<br>
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS<br>
@@ -144,6 +165,13 @@ operator delete[] (void* ptr, const std:<br>
{<br>
::operator delete[](ptr);<br>
}<br>
+<br>
+_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS<br>
+void<br>
+operator delete[] (void* ptr, size_t, const std::nothrow_t&) _NOEXCEPT<br>
+{<br>
+ ::operator delete[](ptr);<br></blockquote></div></div></div></div></div></blockquote><div><br></div><div>And similarly here.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+}<br>
<br>
#endif // !__GLIBCXX__</blockquote></div></div></div></div></div></blockquote><div><br></div><div>Can you add some tests for the added functions?</div></div></div></div>