<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 15, 2015 at 6:04 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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></div><div>The default behavior for this function is required to be a call to ::operator delete(ptr, std::nothrow).</div></div></div></div></blockquote><div> </div><div style="font-size:12.8000001907349px">Can you please point to the specific section in the standard that makes this a requirement?</div><div style="font-size:12.8000001907349px">I thought I made sure to look, but I guess may have missed something. </div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Also, the current delete(void* ptr, const std::nothrow_t&) calls <span style="color:rgb(80,0,80)">::operator delete(ptr)</span> anyways, which </div><div style="font-size:12.8000001907349px">makes both alternatives equivalent, unless one replaces delete(void* ptr, const std::nothrow_t&) I guess.</div><div style="font-size:12.8000001907349px"><div><div><div></div></div></div></div><div style="font-size:12.8000001907349px">I looked in the libcxx/test/std/language.support/support.dynamic/new.delete/...</div><div><span style="font-size:12.8000001907349px">I was not sure how to make the test cases for C++14 specific. Any idea?</span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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></span><div>And similarly here.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>