Applied noexcept to everything in [language.support] (Chapter 18)
llvm-svn: 132129
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: fafca58c58453d8fcfc694d207738b0aa1215651
diff --git a/src/exception.cpp b/src/exception.cpp
index 42d0721..b0efda6 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -24,13 +24,13 @@
#endif // __APPLE__
std::unexpected_handler
-std::set_unexpected(std::unexpected_handler func) throw()
+std::set_unexpected(std::unexpected_handler func) _NOEXCEPT
{
return __sync_lock_test_and_set(&__unexpected_handler, func);
}
std::unexpected_handler
-std::get_unexpected() throw()
+std::get_unexpected() _NOEXCEPT
{
return __sync_fetch_and_add(&__unexpected_handler, (std::unexpected_handler)0);
}
@@ -45,13 +45,13 @@
}
std::terminate_handler
-std::set_terminate(std::terminate_handler func) throw()
+std::set_terminate(std::terminate_handler func) _NOEXCEPT
{
return __sync_lock_test_and_set(&__terminate_handler, func);
}
std::terminate_handler
-std::get_terminate() throw()
+std::get_terminate() _NOEXCEPT
{
return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
}
@@ -76,7 +76,7 @@
#endif // _LIBCPP_NO_EXCEPTIONS
}
-bool std::uncaught_exception() throw()
+bool std::uncaught_exception() _NOEXCEPT
{
#if __APPLE__
// on Darwin, there is a helper function so __cxa_get_globals is private
@@ -93,25 +93,25 @@
namespace std
{
-exception::~exception() throw()
+exception::~exception() _NOEXCEPT
{
}
-bad_exception::~bad_exception() throw()
+bad_exception::~bad_exception() _NOEXCEPT
{
}
-const char* exception::what() const throw()
+const char* exception::what() const _NOEXCEPT
{
return "std::exception";
}
-const char* bad_exception::what() const throw()
+const char* bad_exception::what() const _NOEXCEPT
{
return "std::bad_exception";
}
-exception_ptr::~exception_ptr()
+exception_ptr::~exception_ptr() _NOEXCEPT
{
#if __APPLE__
__cxxabiapple::__cxa_decrement_exception_refcount(__ptr_);
@@ -121,7 +121,7 @@
#endif // __APPLE__
}
-exception_ptr::exception_ptr(const exception_ptr& other)
+exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
: __ptr_(other.__ptr_)
{
#if __APPLE__
@@ -132,7 +132,7 @@
#endif // __APPLE__
}
-exception_ptr& exception_ptr::operator=(const exception_ptr& other)
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
{
#if __APPLE__
if (__ptr_ != other.__ptr_)
@@ -148,12 +148,12 @@
#endif // __APPLE__
}
-nested_exception::nested_exception()
+nested_exception::nested_exception() _NOEXCEPT
: __ptr_(current_exception())
{
}
-nested_exception::~nested_exception()
+nested_exception::~nested_exception() _NOEXCEPT
{
}
@@ -168,7 +168,7 @@
} // std
-std::exception_ptr std::current_exception()
+std::exception_ptr std::current_exception() _NOEXCEPT
{
#if __APPLE__
// be nicer if there was a constructor that took a ptr, then
diff --git a/src/new.cpp b/src/new.cpp
index 55e70ad..d629185 100644
--- a/src/new.cpp
+++ b/src/new.cpp
@@ -27,7 +27,7 @@
__attribute__((__weak__, __visibility__("default")))
void *
-operator new(std::size_t size) throw (std::bad_alloc)
+operator new(std::size_t size)
{
if (size == 0)
size = 1;
@@ -51,7 +51,7 @@
__attribute__((__weak__, __visibility__("default")))
void*
-operator new(size_t size, const std::nothrow_t&) throw()
+operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -70,14 +70,14 @@
__attribute__((__weak__, __visibility__("default")))
void*
-operator new[](size_t size) throw (std::bad_alloc)
+operator new[](size_t size)
{
return ::operator new(size);
}
__attribute__((__weak__, __visibility__("default")))
void*
-operator new[](size_t size, const std::nothrow_t& nothrow) throw()
+operator new[](size_t size, const std::nothrow_t& nothrow) _NOEXCEPT
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -96,7 +96,7 @@
__attribute__((__weak__, __visibility__("default")))
void
-operator delete(void* ptr) throw ()
+operator delete(void* ptr) _NOEXCEPT
{
if (ptr)
::free(ptr);
@@ -104,21 +104,21 @@
__attribute__((__weak__, __visibility__("default")))
void
-operator delete(void* ptr, const std::nothrow_t&) throw ()
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
{
::operator delete(ptr);
}
__attribute__((__weak__, __visibility__("default")))
void
-operator delete[] (void* ptr) throw ()
+operator delete[] (void* ptr) _NOEXCEPT
{
::operator delete (ptr);
}
__attribute__((__weak__, __visibility__("default")))
void
-operator delete[] (void* ptr, const std::nothrow_t&) throw ()
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
{
::operator delete[](ptr);
}
@@ -129,41 +129,41 @@
const nothrow_t nothrow = {};
new_handler
-set_new_handler(new_handler handler) throw()
+set_new_handler(new_handler handler) _NOEXCEPT
{
return __sync_lock_test_and_set(&__new_handler, handler);
}
new_handler
-get_new_handler() throw()
+get_new_handler() _NOEXCEPT
{
return __sync_fetch_and_add(&__new_handler, (new_handler)0);
}
-bad_alloc::bad_alloc() throw()
+bad_alloc::bad_alloc() _NOEXCEPT
{
}
-bad_alloc::~bad_alloc() throw()
+bad_alloc::~bad_alloc() _NOEXCEPT
{
}
const char*
-bad_alloc::what() const throw()
+bad_alloc::what() const _NOEXCEPT
{
return "std::bad_alloc";
}
-bad_array_new_length::bad_array_new_length() throw()
+bad_array_new_length::bad_array_new_length() _NOEXCEPT
{
}
-bad_array_new_length::~bad_array_new_length() throw()
+bad_array_new_length::~bad_array_new_length() _NOEXCEPT
{
}
const char*
-bad_array_new_length::what() const throw()
+bad_array_new_length::what() const _NOEXCEPT
{
return "bad_array_new_length";
}
diff --git a/src/typeinfo.cpp b/src/typeinfo.cpp
index 2dca96f..9ca03a1 100644
--- a/src/typeinfo.cpp
+++ b/src/typeinfo.cpp
@@ -13,30 +13,30 @@
#include "typeinfo"
-std::bad_cast::bad_cast() throw()
+std::bad_cast::bad_cast() _NOEXCEPT
{
}
-std::bad_cast::~bad_cast() throw()
+std::bad_cast::~bad_cast() _NOEXCEPT
{
}
const char*
-std::bad_cast::what() const throw()
+std::bad_cast::what() const _NOEXCEPT
{
return "std::bad_cast";
}
-std::bad_typeid::bad_typeid() throw()
+std::bad_typeid::bad_typeid() _NOEXCEPT
{
}
-std::bad_typeid::~bad_typeid() throw()
+std::bad_typeid::~bad_typeid() _NOEXCEPT
{
}
const char*
-std::bad_typeid::what() const throw()
+std::bad_typeid::what() const _NOEXCEPT
{
return "std::bad_typeid";
}