From ed56921d6e491eb96f489cedf24fed393fdfc0bf Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 26 May 2011 18:23:59 +0000 Subject: [PATCH] Applied noexcept to everything in [language.support] (Chapter 18) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132129 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/exception | 104 ++++++++++---------- include/initializer_list | 26 ++--- include/limits | 198 +++++++++++++++++++-------------------- include/new | 85 +++++++++-------- include/typeinfo | 48 +++++----- src/exception.cpp | 30 +++--- src/new.cpp | 32 +++---- src/typeinfo.cpp | 12 +-- 8 files changed, 271 insertions(+), 264 deletions(-) diff --git a/include/exception b/include/exception index 87f6552a..00fc6b89 100644 --- a/include/exception +++ b/include/exception @@ -20,56 +20,56 @@ namespace std class exception { public: - exception() throw(); - exception(const exception&) throw(); - exception& operator=(const exception&) throw(); - virtual ~exception() throw(); - virtual const char* what() const throw(); + exception() noexcept; + exception(const exception&) noexcept; + exception& operator=(const exception&) noexcept; + virtual ~exception() noexcept; + virtual const char* what() const noexcept; }; class bad_exception : public exception { public: - bad_exception() throw(); - bad_exception(const bad_exception&) throw(); - bad_exception& operator=(const bad_exception&) throw(); - virtual ~bad_exception() throw(); - virtual const char* what() const throw(); + bad_exception() noexcept; + bad_exception(const bad_exception&) noexcept; + bad_exception& operator=(const bad_exception&) noexcept; + virtual ~bad_exception() noexcept; + virtual const char* what() const noexcept; }; typedef void (*unexpected_handler)(); -unexpected_handler set_unexpected(unexpected_handler f ) throw(); -unexpected_handler get_unexpected() throw(); -void unexpected [[noreturn]] (); +unexpected_handler set_unexpected(unexpected_handler f ) noexcept; +unexpected_handler get_unexpected() noexcept; +[[noreturn]] void unexpected(); typedef void (*terminate_handler)(); -terminate_handler set_terminate(terminate_handler f ) throw(); -terminate_handler get_terminate() throw(); -void terminate [[noreturn]] (); +terminate_handler set_terminate(terminate_handler f ) noexcept; +terminate_handler get_terminate() noexcept; +[[noreturn]] void terminate() noexcept; -bool uncaught_exception() throw(); +bool uncaught_exception() noexcept; typedef unspecified exception_ptr; -exception_ptr current_exception(); +exception_ptr current_exception() noexcept; void rethrow_exception [[noreturn]] (exception_ptr p); -template exception_ptr make_exception_ptr(E e); +template exception_ptr make_exception_ptr(E e) noexcept; class nested_exception { public: - nested_exception() throw(); - nested_exception(const nested_exception&) throw() = default; - nested_exception& operator=(const nested_exception&) throw() = default; + nested_exception() noexcept; + nested_exception(const nested_exception&) noexcept = default; + nested_exception& operator=(const nested_exception&) noexcept = default; virtual ~nested_exception() = default; // access functions - void rethrow_nested [[noreturn]] () const; - exception_ptr nested_ptr() const; + [[noreturn]] void rethrow_nested() const; + exception_ptr nested_ptr() const noexcept; }; -template void throw_with_nested [[noreturn]] (T&& t); +template [[noreturn]] void throw_with_nested(T&& t); template void rethrow_if_nested(const E& e); } // std @@ -88,65 +88,65 @@ namespace std // purposefully not using versioning namespace class _LIBCPP_EXCEPTION_ABI exception { public: - _LIBCPP_INLINE_VISIBILITY exception() throw() {} - virtual ~exception() throw(); - virtual const char* what() const throw(); + _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} + virtual ~exception() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_exception : public exception { public: - _LIBCPP_INLINE_VISIBILITY bad_exception() throw() {} - virtual ~bad_exception() throw(); - virtual const char* what() const throw(); + _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {} + virtual ~bad_exception() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; typedef void (*unexpected_handler)(); -_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw(); -_LIBCPP_VISIBLE unexpected_handler get_unexpected() throw(); +_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; +_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT; _ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected(); typedef void (*terminate_handler)(); -_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw(); -_LIBCPP_VISIBLE terminate_handler get_terminate() throw(); +_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT; +_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT; _ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT; -_LIBCPP_VISIBLE bool uncaught_exception() throw(); +_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT; class exception_ptr; -exception_ptr current_exception(); +exception_ptr current_exception() _NOEXCEPT; _ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr); class _LIBCPP_VISIBLE exception_ptr { void* __ptr_; public: - _LIBCPP_INLINE_VISIBILITY exception_ptr() : __ptr_() {} - _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) : __ptr_() {} - exception_ptr(const exception_ptr&); - exception_ptr& operator=(const exception_ptr&); - ~exception_ptr(); + _LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {} + _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {} + exception_ptr(const exception_ptr&) _NOEXCEPT; + exception_ptr& operator=(const exception_ptr&) _NOEXCEPT; + ~exception_ptr() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY // explicit - operator bool() const {return __ptr_ != nullptr;} + operator bool() const _NOEXCEPT {return __ptr_ != nullptr;} friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const exception_ptr& __x, const exception_ptr& __y) + bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {return __x.__ptr_ == __y.__ptr_;} friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const exception_ptr& __x, const exception_ptr& __y) + bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {return !(__x == __y);} - friend exception_ptr current_exception(); + friend exception_ptr current_exception() _NOEXCEPT; _ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr); }; template exception_ptr -make_exception_ptr(_E __e) +make_exception_ptr(_E __e) _NOEXCEPT { #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -166,14 +166,14 @@ class _LIBCPP_EXCEPTION_ABI nested_exception { exception_ptr __ptr_; public: - nested_exception(); -// nested_exception(const nested_exception&) throw() = default; -// nested_exception& operator=(const nested_exception&) throw() = default; - virtual ~nested_exception(); + nested_exception() _NOEXCEPT; +// nested_exception(const nested_exception&) noexcept = default; +// nested_exception& operator=(const nested_exception&) noexcept = default; + virtual ~nested_exception() _NOEXCEPT; // access functions _ATTRIBUTE(noreturn) void rethrow_nested() const; - _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const {return __ptr_;} + _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;} }; template diff --git a/include/initializer_list b/include/initializer_list index 83eb8f48..f1bea94f 100644 --- a/include/initializer_list +++ b/include/initializer_list @@ -29,15 +29,15 @@ public: typedef const E* iterator; typedef const E* const_iterator; - initializer_list(); + initializer_list() noexcept; - size_t size() const; - const E* begin() const; - const E* end() const; + size_t size() const noexcept; + const E* begin() const noexcept; + const E* end() const noexcept; }; -template const E* begin(initializer_list il); -template const E* end(initializer_list il); +template const E* begin(initializer_list il) noexcept; +template const E* end(initializer_list il) noexcept; } // std @@ -58,7 +58,7 @@ class _LIBCPP_VISIBLE initializer_list size_t __size_; _LIBCPP_ALWAYS_INLINE - initializer_list(const _E* __b, size_t __s) + initializer_list(const _E* __b, size_t __s) _NOEXCEPT : __begin_(__b), __size_(__s) {} @@ -71,17 +71,17 @@ public: typedef const _E* iterator; typedef const _E* const_iterator; - _LIBCPP_ALWAYS_INLINE initializer_list() : __begin_(nullptr), __size_(0) {} + _LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} - _LIBCPP_ALWAYS_INLINE size_t size() const {return __size_;} - _LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;} - _LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;} + _LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;} + _LIBCPP_ALWAYS_INLINE const _E* begin() const _NOEXCEPT {return __begin_;} + _LIBCPP_ALWAYS_INLINE const _E* end() const _NOEXCEPT {return __begin_ + __size_;} }; template inline _LIBCPP_INLINE_VISIBILITY const _E* -begin(initializer_list<_E> __il) +begin(initializer_list<_E> __il) _NOEXCEPT { return __il.begin(); } @@ -89,7 +89,7 @@ begin(initializer_list<_E> __il) template inline _LIBCPP_INLINE_VISIBILITY const _E* -end(initializer_list<_E> __il) +end(initializer_list<_E> __il) _NOEXCEPT { return __il.end(); } diff --git a/include/limits b/include/limits index f3d42f70..989964e0 100644 --- a/include/limits +++ b/include/limits @@ -22,9 +22,9 @@ class numeric_limits { public: static const bool is_specialized = false; - static T min() throw(); - static T max() throw(); - static T lowest() throw(); + static T min() noexcept; + static T max() noexcept; + static T lowest() noexcept; static const int digits = 0; static const int digits10 = 0; @@ -33,8 +33,8 @@ public: static const bool is_integer = false; static const bool is_exact = false; static const int radix = 0; - static T epsilon() throw(); - static T round_error() throw(); + static T epsilon() noexcept; + static T round_error() noexcept; static const int min_exponent = 0; static const int min_exponent10 = 0; @@ -46,10 +46,10 @@ public: static const bool has_signaling_NaN = false; static const float_denorm_style has_denorm = denorm_absent; static const bool has_denorm_loss = false; - static T infinity() throw(); - static T quiet_NaN() throw(); - static T signaling_NaN() throw(); - static T denorm_min() throw(); + static T infinity() noexcept; + static T quiet_NaN() noexcept; + static T signaling_NaN() noexcept; + static T denorm_min() noexcept; static const bool is_iec559 = false; static const bool is_bounded = false; @@ -132,9 +132,9 @@ protected: typedef _Tp type; static const bool is_specialized = false; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return type();} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return type();} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return type();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return type();} static const int digits = 0; static const int digits10 = 0; @@ -143,8 +143,8 @@ protected: static const bool is_integer = false; static const bool is_exact = false; static const int radix = 0; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type();} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type();} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type();} static const int min_exponent = 0; static const int min_exponent10 = 0; @@ -156,10 +156,10 @@ protected: static const bool has_signaling_NaN = false; static const float_denorm_style has_denorm = denorm_absent; static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type();} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type();} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type();} static const bool is_iec559 = false; static const bool is_bounded = false; @@ -196,15 +196,15 @@ protected: static const int max_digits10 = 0; static const type __min = __libcpp_compute_min::value; static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();} static const bool is_integer = true; static const bool is_exact = true; static const int radix = 2; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);} static const int min_exponent = 0; static const int min_exponent10 = 0; @@ -216,10 +216,10 @@ protected: static const bool has_signaling_NaN = false; static const float_denorm_style has_denorm = denorm_absent; static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);} static const bool is_iec559 = false; static const bool is_bounded = true; @@ -248,15 +248,15 @@ protected: static const int max_digits10 = 0; static const type __min = false; static const type __max = true; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();} static const bool is_integer = true; static const bool is_exact = true; static const int radix = 2; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);} static const int min_exponent = 0; static const int min_exponent10 = 0; @@ -268,10 +268,10 @@ protected: static const bool has_signaling_NaN = false; static const float_denorm_style has_denorm = denorm_absent; static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);} static const bool is_iec559 = false; static const bool is_bounded = true; @@ -294,15 +294,15 @@ protected: static const int digits = __FLT_MANT_DIG__; static const int digits10 = __FLT_DIG__; static const int max_digits10 = 2+(digits * 30103)/100000; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __FLT_MIN__;} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __FLT_MAX__;} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __FLT_MIN__;} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __FLT_MAX__;} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();} static const bool is_integer = false; static const bool is_exact = false; static const int radix = __FLT_RADIX__; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __FLT_EPSILON__;} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5F;} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __FLT_EPSILON__;} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5F;} static const int min_exponent = __FLT_MIN_EXP__; static const int min_exponent10 = __FLT_MIN_10_EXP__; @@ -314,10 +314,10 @@ protected: static const bool has_signaling_NaN = true; static const float_denorm_style has_denorm = denorm_present; static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_valf();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanf("");} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansf("");} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __FLT_DENORM_MIN__;} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_valf();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;} static const bool is_iec559 = true; static const bool is_bounded = true; @@ -340,15 +340,15 @@ protected: static const int digits = __DBL_MANT_DIG__; static const int digits10 = __DBL_DIG__; static const int max_digits10 = 2+(digits * 30103)/100000; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __DBL_MIN__;} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __DBL_MAX__;} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __DBL_MIN__;} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __DBL_MAX__;} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();} static const bool is_integer = false; static const bool is_exact = false; static const int radix = __FLT_RADIX__; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __DBL_EPSILON__;} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __DBL_EPSILON__;} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;} static const int min_exponent = __DBL_MIN_EXP__; static const int min_exponent10 = __DBL_MIN_10_EXP__; @@ -360,10 +360,10 @@ protected: static const bool has_signaling_NaN = true; static const float_denorm_style has_denorm = denorm_present; static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_val();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nan("");} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nans("");} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __DBL_DENORM_MIN__;} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_val();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nan("");} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nans("");} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;} static const bool is_iec559 = true; static const bool is_bounded = true; @@ -386,15 +386,15 @@ protected: static const int digits = __LDBL_MANT_DIG__; static const int digits10 = __LDBL_DIG__; static const int max_digits10 = 2+(digits * 30103)/100000; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __LDBL_MIN__;} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __LDBL_MAX__;} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __LDBL_MIN__;} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __LDBL_MAX__;} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();} static const bool is_integer = false; static const bool is_exact = false; static const int radix = __FLT_RADIX__; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __LDBL_EPSILON__;} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;} static const int min_exponent = __LDBL_MIN_EXP__; static const int min_exponent10 = __LDBL_MIN_10_EXP__; @@ -406,10 +406,10 @@ protected: static const bool has_signaling_NaN = true; static const float_denorm_style has_denorm = denorm_present; static const bool has_denorm_loss = false; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_vall();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanl("");} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansl("");} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __LDBL_DENORM_MIN__;} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_vall();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;} #if (defined(__ppc__) || defined(__ppc64__)) static const bool is_iec559 = false; @@ -432,9 +432,9 @@ class _LIBCPP_VISIBLE numeric_limits typedef typename __base::type type; public: static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} static const int digits = __base::digits; static const int digits10 = __base::digits10; @@ -443,8 +443,8 @@ public: static const bool is_integer = __base::is_integer; static const bool is_exact = __base::is_exact; static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} static const int min_exponent = __base::min_exponent; static const int min_exponent10 = __base::min_exponent10; @@ -456,10 +456,10 @@ public: static const bool has_signaling_NaN = __base::has_signaling_NaN; static const float_denorm_style has_denorm = __base::has_denorm; static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} static const bool is_iec559 = __base::is_iec559; static const bool is_bounded = __base::is_bounded; @@ -478,9 +478,9 @@ class _LIBCPP_VISIBLE numeric_limits typedef _Tp type; public: static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} static const int digits = __base::digits; static const int digits10 = __base::digits10; @@ -489,8 +489,8 @@ public: static const bool is_integer = __base::is_integer; static const bool is_exact = __base::is_exact; static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} static const int min_exponent = __base::min_exponent; static const int min_exponent10 = __base::min_exponent10; @@ -502,10 +502,10 @@ public: static const bool has_signaling_NaN = __base::has_signaling_NaN; static const float_denorm_style has_denorm = __base::has_denorm; static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} static const bool is_iec559 = __base::is_iec559; static const bool is_bounded = __base::is_bounded; @@ -524,9 +524,9 @@ class _LIBCPP_VISIBLE numeric_limits typedef _Tp type; public: static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} static const int digits = __base::digits; static const int digits10 = __base::digits10; @@ -535,8 +535,8 @@ public: static const bool is_integer = __base::is_integer; static const bool is_exact = __base::is_exact; static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} static const int min_exponent = __base::min_exponent; static const int min_exponent10 = __base::min_exponent10; @@ -548,10 +548,10 @@ public: static const bool has_signaling_NaN = __base::has_signaling_NaN; static const float_denorm_style has_denorm = __base::has_denorm; static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} static const bool is_iec559 = __base::is_iec559; static const bool is_bounded = __base::is_bounded; @@ -570,9 +570,9 @@ class _LIBCPP_VISIBLE numeric_limits typedef _Tp type; public: static const bool is_specialized = __base::is_specialized; - _LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();} - _LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();} - _LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();} + _LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();} + _LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();} + _LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();} static const int digits = __base::digits; static const int digits10 = __base::digits10; @@ -581,8 +581,8 @@ public: static const bool is_integer = __base::is_integer; static const bool is_exact = __base::is_exact; static const int radix = __base::radix; - _LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();} - _LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();} + _LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();} + _LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();} static const int min_exponent = __base::min_exponent; static const int min_exponent10 = __base::min_exponent10; @@ -594,10 +594,10 @@ public: static const bool has_signaling_NaN = __base::has_signaling_NaN; static const float_denorm_style has_denorm = __base::has_denorm; static const bool has_denorm_loss = __base::has_denorm_loss; - _LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();} - _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();} - _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();} - _LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();} + _LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();} + _LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();} + _LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();} + _LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();} static const bool is_iec559 = __base::is_iec559; static const bool is_bounded = __base::is_bounded; diff --git a/include/new b/include/new index 68f0274b..fac9f853 100644 --- a/include/new +++ b/include/new @@ -21,35 +21,34 @@ class bad_alloc : public exception { public: - bad_alloc() throw(); - bad_alloc(const bad_alloc&) throw(); - bad_alloc& operator=(const bad_alloc&) throw(); - virtual ~bad_alloc() throw(); - virtual const char* what() const throw(); + bad_alloc() noexcept; + bad_alloc(const bad_alloc&) noexcept; + bad_alloc& operator=(const bad_alloc&) noexcept; + virtual const char* what() const noexcept; }; struct nothrow_t {}; extern const nothrow_t nothrow; typedef void (*new_handler)(); -new_handler set_new_handler(new_handler new_p) throw(); -new_handler get_new_handler() throw(); +new_handler set_new_handler(new_handler new_p) noexcept; +new_handler get_new_handler() noexcept; } // std -void* operator new(std::size_t size) throw(std::bad_alloc); // replaceable -void* operator new(std::size_t size, const std::nothrow_t&) throw(); // replaceable -void operator delete(void* ptr) throw(); // replaceable -void operator delete(void* ptr, const std::nothrow_t&) throw(); // replaceable +void* operator new(std::size_t size); // replaceable +void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable +void operator delete(void* ptr) noexcept; // replaceable +void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable -void* operator new[](std::size_t size) throw(std::bad_alloc); // replaceable -void* operator new[](std::size_t size, const std::nothrow_t&) throw(); // replaceable -void operator delete[](void* ptr) throw(); // replaceable -void operator delete[](void* ptr, const std::nothrow_t&) throw(); // replaceable +void* operator new[](std::size_t size); // replaceable +void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable +void operator delete[](void* ptr) noexcept; // replaceable +void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable -void* operator new (std::size_t size, void* ptr) throw(); -void* operator new[](std::size_t size, void* ptr) throw(); -void operator delete (void* ptr, void*) throw(); -void operator delete[](void* ptr, void*) throw(); +void* operator new (std::size_t size, void* ptr) noexcept; +void* operator new[](std::size_t size, void* ptr) noexcept; +void operator delete (void* ptr, void*) noexcept; +void operator delete[](void* ptr, void*) noexcept; */ @@ -66,18 +65,18 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc : public exception { public: - bad_alloc() throw(); - virtual ~bad_alloc() throw(); - virtual const char* what() const throw(); + bad_alloc() _NOEXCEPT; + virtual ~bad_alloc() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_array_new_length : public bad_alloc { public: - bad_array_new_length() throw(); - virtual ~bad_array_new_length() throw(); - virtual const char* what() const throw(); + bad_array_new_length() _NOEXCEPT; + virtual ~bad_array_new_length() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; void __throw_bad_alloc(); // not in C++ spec @@ -85,24 +84,32 @@ void __throw_bad_alloc(); // not in C++ spec struct _LIBCPP_VISIBLE nothrow_t {}; extern _LIBCPP_VISIBLE const nothrow_t nothrow; typedef void (*new_handler)(); -_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw(); -_LIBCPP_VISIBLE new_handler get_new_handler() throw(); +_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT; +_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT; } // std -_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc); -_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw(); -_LIBCPP_VISIBLE void operator delete(void*) throw(); -_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) throw(); +_LIBCPP_VISIBLE void* operator new(std::size_t) +#if !__has_feature(cxx_noexcept) + throw(std::bad_alloc) +#endif +; +_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) _NOEXCEPT; +_LIBCPP_VISIBLE void operator delete(void*) _NOEXCEPT; +_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) _NOEXCEPT; -_LIBCPP_VISIBLE void* operator new[](std::size_t) throw(std::bad_alloc); -_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) throw(); -_LIBCPP_VISIBLE void operator delete[](void*) throw(); -_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) throw(); +_LIBCPP_VISIBLE void* operator new[](std::size_t) +#if !__has_feature(cxx_noexcept) + throw(std::bad_alloc) +#endif +; +_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) _NOEXCEPT; +_LIBCPP_VISIBLE void operator delete[](void*) _NOEXCEPT; +_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) _NOEXCEPT; -_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) throw() {return __p;} -_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) throw() {return __p;} -_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) throw() {} -_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) throw() {} +_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} +_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} +_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {} +_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {} #endif // _LIBCPP_NEW diff --git a/include/typeinfo b/include/typeinfo index 8bbd5590..310c482c 100644 --- a/include/typeinfo +++ b/include/typeinfo @@ -22,12 +22,12 @@ class type_info public: virtual ~type_info(); - bool operator==(const type_info& rhs) const; - bool operator!=(const type_info& rhs) const; + bool operator==(const type_info& rhs) const noexcept; + bool operator!=(const type_info& rhs) const noexcept; - bool before(const type_info& rhs) const; - size_t hash_code() const throw(); - const char* name() const; + bool before(const type_info& rhs) const noexcept; + size_t hash_code() const noexcept; + const char* name() const noexcept; type_info(const type_info& rhs) = delete; type_info& operator=(const type_info& rhs) = delete; @@ -37,20 +37,20 @@ class bad_cast : public exception { public: - bad_cast() throw(); - bad_cast(const bad_cast&) throw(); - bad_cast& operator=(const bad_cast&) throw(); - virtual const char* what() const throw(); + bad_cast() noexcept; + bad_cast(const bad_cast&) noexcept; + bad_cast& operator=(const bad_cast&) noexcept; + virtual const char* what() const noexcept; }; class bad_typeid : public exception { public: - bad_typeid() throw(); - bad_typeid(const bad_typeid&) throw(); - bad_typeid& operator=(const bad_typeid&) throw(); - virtual const char* what() const throw(); + bad_typeid() noexcept; + bad_typeid(const bad_typeid&) noexcept; + bad_typeid& operator=(const bad_typeid&) noexcept; + virtual const char* what() const noexcept; }; } // std @@ -81,20 +81,20 @@ public: virtual ~type_info(); _LIBCPP_INLINE_VISIBILITY - const char* name() const {return __type_name;} + const char* name() const _NOEXCEPT {return __type_name;} _LIBCPP_INLINE_VISIBILITY - bool before(const type_info& __arg) const + bool before(const type_info& __arg) const _NOEXCEPT {return __type_name < __arg.__type_name;} _LIBCPP_INLINE_VISIBILITY - size_t hash_code() const throw() + size_t hash_code() const _NOEXCEPT {return *reinterpret_cast(&__type_name);} _LIBCPP_INLINE_VISIBILITY - bool operator==(const type_info& __arg) const + bool operator==(const type_info& __arg) const _NOEXCEPT {return __type_name == __arg.__type_name;} _LIBCPP_INLINE_VISIBILITY - bool operator!=(const type_info& __arg) const + bool operator!=(const type_info& __arg) const _NOEXCEPT {return !operator==(__arg);} }; @@ -103,18 +103,18 @@ class _LIBCPP_EXCEPTION_ABI bad_cast : public exception { public: - bad_cast() throw(); - virtual ~bad_cast() throw(); - virtual const char* what() const throw(); + bad_cast() _NOEXCEPT; + virtual ~bad_cast() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_typeid : public exception { public: - bad_typeid() throw(); - virtual ~bad_typeid() throw(); - virtual const char* what() const throw(); + bad_typeid() _NOEXCEPT; + virtual ~bad_typeid() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; } // std diff --git a/src/exception.cpp b/src/exception.cpp index 42d0721c..b0efda64 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::unexpected() } 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 @@ std::terminate() _NOEXCEPT #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 @@ bool std::uncaught_exception() throw() 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 @@ exception_ptr::~exception_ptr() #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 @@ exception_ptr::exception_ptr(const exception_ptr& other) #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 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) #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 @@ nested_exception::rethrow_nested() const } // 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 55e70ad0..d629185e 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 @@ operator new(std::size_t size) throw (std::bad_alloc) __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 @@ operator new(size_t size, const std::nothrow_t&) throw() __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 @@ operator new[](size_t size, const std::nothrow_t& nothrow) throw() __attribute__((__weak__, __visibility__("default"))) void -operator delete(void* ptr) throw () +operator delete(void* ptr) _NOEXCEPT { if (ptr) ::free(ptr); @@ -104,21 +104,21 @@ operator delete(void* ptr) throw () __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 @@ namespace std 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 2dca96fd..9ca03a18 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"; }