<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 16, 2015 at 5:48 PM, Larisse Voufo <span dir="ltr"><<a href="mailto:lvoufo@cs.indiana.edu" target="_blank">lvoufo@cs.indiana.edu</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"><span class="">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></span><div><div class="h5"><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></blockquote><div><br></div></div></div><div>Clang also supports the -fsized-deallocation flag in C++11 mode. Should we factor this in the version check as well, or perhaps</div><div>remove/deprecate it from Clang?</div></div></div></div></blockquote><div><br></div><div>I don't think there's any need to care about whether the feature is enabled in Clang. The non-nothrow forms are implicitly declared by the compiler, so libc++'s declarations are redundant in all modes (but technically the standard says they should be there in <new> in C++14, so I suppose we should include them for completeness). The nothrow forms are useless and never implicitly called, but we're (currently; I have filed a library issue) required to provide them.</div><div><br></div><div>So I think you should just check whether libc++ is in C++14 mode, and declare these functions if so.</div><div><br></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: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"><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>
+}<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>
+}<br>
<br>
#endif // !__GLIBCXX__<br>
<br>
<br>
<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>
</blockquote></div><br></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></div></div><br></div></div>
</blockquote></div><br></div></div>