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|
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -60,7 +60,7 @@ future_error::future_error(error_code __ec)
|
||||
}
|
||||
|
||||
void
|
||||
__assoc_sub_state::__on_zero_shared()
|
||||
__assoc_sub_state::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
@@ -518,7 +518,7 @@ locale::facet::~facet()
|
||||
}
|
||||
|
||||
void
|
||||
locale::facet::__on_zero_shared()
|
||||
locale::facet::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
@@ -16,14 +16,14 @@ namespace
|
||||
|
||||
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 @@ decrement(T& t)
|
||||
|
||||
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 @@ __shared_count::~__shared_count()
|
||||
}
|
||||
|
||||
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 @@ __shared_weak_count::~__shared_weak_count()
|
||||
}
|
||||
|
||||
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 @@ __shared_weak_count::lock()
|
||||
#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 @@ undeclare_no_pointers(char*, size_t)
|
||||
}
|
||||
|
||||
pointer_safety
|
||||
get_pointer_safety()
|
||||
get_pointer_safety() _NOEXCEPT
|
||||
{
|
||||
return pointer_safety::relaxed;
|
||||
}
|
||||
|
Reference in New Issue
Block a user