noexcept for <memory>. I've added a few extension noexcept to: allocator_traits<A>::deallocate, allocaate<T>::deallocate, return_temporary_buffer, and default_delete<T>::operator()(T*) const. My rationale was: If a std-dicated noexcept function needs to call another std-defined function, that called function must be noexcept. We're all a little new to noexcept, so things like this are to be expected. Also included fix for broken __is_swappable trait pointed out by Marc Glisse, thanks Marc|. And fixed a test case for is_nothrow_destructible. Destructors are now noexcept by default|
llvm-svn: 132261
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 3739fe79e52751e2757804c10b52a8c16d5f2ab7
diff --git a/src/future.cpp b/src/future.cpp
index 8e79f3e..98c7805 100644
--- a/src/future.cpp
+++ b/src/future.cpp
@@ -60,7 +60,7 @@
}
void
-__assoc_sub_state::__on_zero_shared()
+__assoc_sub_state::__on_zero_shared() _NOEXCEPT
{
delete this;
}
diff --git a/src/locale.cpp b/src/locale.cpp
index 4bd77ca..668847b 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -518,7 +518,7 @@
}
void
-locale::facet::__on_zero_shared()
+locale::facet::__on_zero_shared() _NOEXCEPT
{
delete this;
}
diff --git a/src/memory.cpp b/src/memory.cpp
index 3e3e910..cb5e5e7 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -16,14 +16,14 @@
template <class T>
inline T
-increment(T& t)
+increment(T& t) _NOEXCEPT
{
return __sync_add_and_fetch(&t, 1);
}
template <class T>
inline T
-decrement(T& t)
+decrement(T& t) _NOEXCEPT
{
return __sync_add_and_fetch(&t, -1);
}
@@ -32,10 +32,10 @@
const allocator_arg_t allocator_arg = allocator_arg_t();
-bad_weak_ptr::~bad_weak_ptr() throw() {}
+bad_weak_ptr::~bad_weak_ptr() _NOEXCEPT {}
const char*
-bad_weak_ptr::what() const throw()
+bad_weak_ptr::what() const _NOEXCEPT
{
return "bad_weak_ptr";
}
@@ -45,13 +45,13 @@
}
void
-__shared_count::__add_shared()
+__shared_count::__add_shared() _NOEXCEPT
{
increment(__shared_owners_);
}
bool
-__shared_count::__release_shared()
+__shared_count::__release_shared() _NOEXCEPT
{
if (decrement(__shared_owners_) == -1)
{
@@ -66,33 +66,33 @@
}
void
-__shared_weak_count::__add_shared()
+__shared_weak_count::__add_shared() _NOEXCEPT
{
__shared_count::__add_shared();
}
void
-__shared_weak_count::__add_weak()
+__shared_weak_count::__add_weak() _NOEXCEPT
{
increment(__shared_weak_owners_);
}
void
-__shared_weak_count::__release_shared()
+__shared_weak_count::__release_shared() _NOEXCEPT
{
if (__shared_count::__release_shared())
__release_weak();
}
void
-__shared_weak_count::__release_weak()
+__shared_weak_count::__release_weak() _NOEXCEPT
{
if (decrement(__shared_weak_owners_) == -1)
__on_zero_shared_weak();
}
__shared_weak_count*
-__shared_weak_count::lock()
+__shared_weak_count::lock() _NOEXCEPT
{
long object_owners = __shared_owners_;
while (object_owners != -1)
@@ -112,7 +112,7 @@
#ifndef _LIBCPP_NO_RTTI
const void*
-__shared_weak_count::__get_deleter(const type_info&) const
+__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
{
return 0;
}
@@ -135,7 +135,7 @@
}
pointer_safety
-get_pointer_safety()
+get_pointer_safety() _NOEXCEPT
{
return pointer_safety::relaxed;
}