From 1e15fd1856a34a4bc0f7c1d649d2e22df9033326 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 26 May 2011 19:48:01 +0000 Subject: [PATCH] Applied noexcept to everything in [diagnostics] (Chapter 19) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132137 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/stdexcept | 34 ++++---- include/system_error | 186 ++++++++++++++++++++++--------------------- src/future.cpp | 4 +- src/ios.cpp | 4 +- src/stdexcept.cpp | 34 ++++---- src/system_error.cpp | 28 +++---- 6 files changed, 149 insertions(+), 141 deletions(-) diff --git a/include/stdexcept b/include/stdexcept index 2ef15a62..d31dc8b0 100644 --- a/include/stdexcept +++ b/include/stdexcept @@ -33,9 +33,9 @@ class xxx_error : public exception // at least indirectly { public: explicit xxx_error(const string& what_arg); - explicit xxx_error(const char* what_arg); // extension + explicit xxx_error(const char* what_arg); - virtual const char* what() const // returns what_arg + virtual const char* what() const noexcept // returns what_arg }; } // std @@ -60,12 +60,12 @@ public: explicit logic_error(const string&); explicit logic_error(const char*); - logic_error(const logic_error&) throw(); - logic_error& operator=(const logic_error&) throw(); + logic_error(const logic_error&) _NOEXCEPT; + logic_error& operator=(const logic_error&) _NOEXCEPT; - virtual ~logic_error() throw(); + virtual ~logic_error() _NOEXCEPT; - virtual const char* what() const throw(); + virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI runtime_error @@ -77,12 +77,12 @@ public: explicit runtime_error(const string&); explicit runtime_error(const char*); - runtime_error(const runtime_error&) throw(); - runtime_error& operator=(const runtime_error&) throw(); + runtime_error(const runtime_error&) _NOEXCEPT; + runtime_error& operator=(const runtime_error&) _NOEXCEPT; - virtual ~runtime_error() throw(); + virtual ~runtime_error() _NOEXCEPT; - virtual const char* what() const throw(); + virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI domain_error @@ -92,7 +92,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {} - virtual ~domain_error() throw(); + virtual ~domain_error() _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI invalid_argument @@ -102,7 +102,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {} - virtual ~invalid_argument() throw(); + virtual ~invalid_argument() _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI length_error @@ -112,7 +112,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} - virtual ~length_error() throw(); + virtual ~length_error() _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI out_of_range @@ -122,7 +122,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {} - virtual ~out_of_range() throw(); + virtual ~out_of_range() _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI range_error @@ -132,7 +132,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {} - virtual ~range_error() throw(); + virtual ~range_error() _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI overflow_error @@ -142,7 +142,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {} - virtual ~overflow_error() throw(); + virtual ~overflow_error() _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI underflow_error @@ -152,7 +152,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {} - virtual ~underflow_error() throw(); + virtual ~underflow_error() _NOEXCEPT; }; } // std diff --git a/include/system_error b/include/system_error index 13e5af4f..5e1e6fe4 100644 --- a/include/system_error +++ b/include/system_error @@ -20,24 +20,24 @@ namespace std class error_category { public: - virtual ~error_category(); + virtual ~error_category() noexcept; error_category(const error_category&) = delete; error_category& operator=(const error_category&) = delete; - virtual const char* name() const = 0; - virtual error_condition default_error_condition(int ev) const; - virtual bool equivalent(int code, const error_condition& condition) const; - virtual bool equivalent(const error_code& code, int condition) const; + virtual const char* name() const noexcept = 0; + virtual error_condition default_error_condition(int ev) const noexcept; + virtual bool equivalent(int code, const error_condition& condition) const noexcept; + virtual bool equivalent(const error_code& code, int condition) const noexcept; virtual string message(int ev) const = 0; - bool operator==(const error_category& rhs) const; - bool operator!=(const error_category& rhs) const; - bool operator<(const error_category& rhs) const; + bool operator==(const error_category& rhs) const noexcept; + bool operator!=(const error_category& rhs) const noexcept; + bool operator<(const error_category& rhs) const noexcept; }; -const error_category& generic_category(); -const error_category& system_category(); +const error_category& generic_category() noexcept; +const error_category& system_category() noexcept; template struct is_error_code_enum : public false_type {}; @@ -49,27 +49,27 @@ class error_code { public: // constructors: - error_code(); - error_code(int val, const error_category& cat); + error_code() noexcept; + error_code(int val, const error_category& cat) noexcept; template - error_code(ErrorCodeEnum e); + error_code(ErrorCodeEnum e) noexcept; // modifiers: - void assign(int val, const error_category& cat); + void assign(int val, const error_category& cat) noexcept; template - error_code& operator=(ErrorCodeEnum e); - void clear(); + error_code& operator=(ErrorCodeEnum e) noexcept; + void clear() noexcept; // observers: - int value() const; - const error_category& category() const; - error_condition default_error_condition() const; + int value() const noexcept; + const error_category& category() const noexcept; + error_condition default_error_condition() const noexcept; string message() const; - explicit operator bool() const; + explicit operator bool() const noexcept; }; // non-member functions: -bool operator<(const error_code& lhs, const error_code& rhs); +bool operator<(const error_code& lhs, const error_code& rhs) noexcept; template basic_ostream& operator<<(basic_ostream& os, const error_code& ec); @@ -78,25 +78,25 @@ class error_condition { public: // constructors: - error_condition(); - error_condition(int val, const error_category& cat); + error_condition() noexcept; + error_condition(int val, const error_category& cat) noexcept; template - error_condition(ErrorConditionEnum e); + error_condition(ErrorConditionEnum e) noexcept; // modifiers: - void assign(int val, const error_category& cat); + void assign(int val, const error_category& cat) noexcept; template - error_condition& operator=(ErrorConditionEnum e); - void clear(); + error_condition& operator=(ErrorConditionEnum e) noexcept; + void clear() noexcept; // observers: - int value() const; - const error_category& category() const; - string message() const; - explicit operator bool() const; + int value() const noexcept; + const error_category& category() const noexcept; + string message() const noexcept; + explicit operator bool() const noexcept; }; -bool operator<(const error_condition& lhs, const error_condition& rhs); +bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept; class system_error : public runtime_error @@ -109,8 +109,8 @@ public: system_error(int ev, const error_category& ecat, const char* what_arg); system_error(int ev, const error_category& ecat); - const error_code& code() const throw(); - const char* what() const throw(); + const error_code& code() const noexcept; + const char* what() const noexcept; }; enum class errc @@ -198,18 +198,18 @@ enum class errc template <> struct is_error_condition_enum : true_type { } -error_code make_error_code(errc e); -error_condition make_error_condition(errc e); +error_code make_error_code(errc e) noexcept; +error_condition make_error_condition(errc e) noexcept; // Comparison operators: -bool operator==(const error_code& lhs, const error_code& rhs); -bool operator==(const error_code& lhs, const error_condition& rhs); -bool operator==(const error_condition& lhs, const error_code& rhs); -bool operator==(const error_condition& lhs, const error_condition& rhs); -bool operator!=(const error_code& lhs, const error_code& rhs); -bool operator!=(const error_code& lhs, const error_condition& rhs); -bool operator!=(const error_condition& lhs, const error_code& rhs); -bool operator!=(const error_condition& lhs, const error_condition& rhs); +bool operator==(const error_code& lhs, const error_code& rhs) noexcept; +bool operator==(const error_code& lhs, const error_condition& rhs) noexcept; +bool operator==(const error_condition& lhs, const error_code& rhs) noexcept; +bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept; +bool operator!=(const error_code& lhs, const error_code& rhs) noexcept; +bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept; +bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept; +bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept; template <> struct hash; @@ -369,28 +369,28 @@ class __do_message; class _LIBCPP_VISIBLE error_category { public: - virtual ~error_category(); + virtual ~error_category() _NOEXCEPT; private: - error_category(); + error_category() _NOEXCEPT; error_category(const error_category&);// = delete; error_category& operator=(const error_category&);// = delete; public: - virtual const char* name() const = 0; - virtual error_condition default_error_condition(int __ev) const; - virtual bool equivalent(int __code, const error_condition& __condition) const; - virtual bool equivalent(const error_code& __code, int __condition) const; + virtual const char* name() const _NOEXCEPT = 0; + virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; + virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; + virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT; virtual string message(int __ev) const = 0; _LIBCPP_ALWAYS_INLINE - bool operator==(const error_category& __rhs) const {return this == &__rhs;} + bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;} _LIBCPP_ALWAYS_INLINE - bool operator!=(const error_category& __rhs) const {return !(*this == __rhs);} + bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);} _LIBCPP_ALWAYS_INLINE - bool operator< (const error_category& __rhs) const {return this < &__rhs;} + bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} friend class __do_message; }; @@ -402,8 +402,8 @@ public: virtual string message(int ev) const; }; -const error_category& generic_category(); -const error_category& system_category(); +const error_category& generic_category() _NOEXCEPT; +const error_category& system_category() _NOEXCEPT; class _LIBCPP_VISIBLE error_condition { @@ -411,19 +411,21 @@ class _LIBCPP_VISIBLE error_condition const error_category* __cat_; public: _LIBCPP_ALWAYS_INLINE - error_condition() : __val_(0), __cat_(&generic_category()) {} + error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {} _LIBCPP_ALWAYS_INLINE - error_condition(int __val, const error_category& __cat) + error_condition(int __val, const error_category& __cat) _NOEXCEPT : __val_(__val), __cat_(&__cat) {} template _LIBCPP_ALWAYS_INLINE - error_condition(_E __e, typename enable_if::value>::type* = 0) + error_condition(_E __e, + typename enable_if::value>::type* = 0 + ) _NOEXCEPT {*this = make_error_condition(__e);} _LIBCPP_ALWAYS_INLINE - void assign(int __val, const error_category& __cat) + void assign(int __val, const error_category& __cat) _NOEXCEPT { __val_ = __val; __cat_ = &__cat; @@ -436,38 +438,38 @@ public: is_error_condition_enum<_E>::value, error_condition& >::type - operator=(_E __e) + operator=(_E __e) _NOEXCEPT {*this = make_error_condition(__e); return *this;} _LIBCPP_ALWAYS_INLINE - void clear() + void clear() _NOEXCEPT { __val_ = 0; __cat_ = &generic_category(); } _LIBCPP_ALWAYS_INLINE - int value() const {return __val_;} + int value() const _NOEXCEPT {return __val_;} _LIBCPP_ALWAYS_INLINE - const error_category& category() const {return *__cat_;} + const error_category& category() const _NOEXCEPT {return *__cat_;} string message() const; _LIBCPP_ALWAYS_INLINE //explicit - operator bool() const {return __val_ != 0;} + operator bool() const _NOEXCEPT {return __val_ != 0;} }; inline _LIBCPP_INLINE_VISIBILITY error_condition -make_error_condition(errc __e) +make_error_condition(errc __e) _NOEXCEPT { return error_condition(static_cast(__e), generic_category()); } inline _LIBCPP_INLINE_VISIBILITY bool -operator<(const error_condition& __x, const error_condition& __y) +operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT { return __x.category() < __y.category() || __x.category() == __y.category() && __x.value() < __y.value(); @@ -481,19 +483,21 @@ class _LIBCPP_VISIBLE error_code const error_category* __cat_; public: _LIBCPP_ALWAYS_INLINE - error_code() : __val_(0), __cat_(&system_category()) {} + error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {} _LIBCPP_ALWAYS_INLINE - error_code(int __val, const error_category& __cat) + error_code(int __val, const error_category& __cat) _NOEXCEPT : __val_(__val), __cat_(&__cat) {} template _LIBCPP_ALWAYS_INLINE - error_code(_E __e, typename enable_if::value>::type* = 0) + error_code(_E __e, + typename enable_if::value>::type* = 0 + ) _NOEXCEPT {*this = make_error_code(__e);} _LIBCPP_ALWAYS_INLINE - void assign(int __val, const error_category& __cat) + void assign(int __val, const error_category& __cat) _NOEXCEPT { __val_ = __val; __cat_ = &__cat; @@ -506,43 +510,43 @@ public: is_error_code_enum<_E>::value, error_code& >::type - operator=(_E __e) + operator=(_E __e) _NOEXCEPT {*this = make_error_code(__e); return *this;} _LIBCPP_ALWAYS_INLINE - void clear() + void clear() _NOEXCEPT { __val_ = 0; __cat_ = &system_category(); } _LIBCPP_ALWAYS_INLINE - int value() const {return __val_;} + int value() const _NOEXCEPT {return __val_;} _LIBCPP_ALWAYS_INLINE - const error_category& category() const {return *__cat_;} + const error_category& category() const _NOEXCEPT {return *__cat_;} _LIBCPP_ALWAYS_INLINE - error_condition default_error_condition() const + error_condition default_error_condition() const _NOEXCEPT {return __cat_->default_error_condition(__val_);} string message() const; _LIBCPP_ALWAYS_INLINE //explicit - operator bool() const {return __val_ != 0;} + operator bool() const _NOEXCEPT {return __val_ != 0;} }; inline _LIBCPP_INLINE_VISIBILITY error_code -make_error_code(errc __e) +make_error_code(errc __e) _NOEXCEPT { return error_code(static_cast(__e), generic_category()); } inline _LIBCPP_INLINE_VISIBILITY bool -operator<(const error_code& __x, const error_code& __y) +operator<(const error_code& __x, const error_code& __y) _NOEXCEPT { return __x.category() < __y.category() || __x.category() == __y.category() && __x.value() < __y.value(); @@ -550,14 +554,14 @@ operator<(const error_code& __x, const error_code& __y) inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const error_code& __x, const error_code& __y) +operator==(const error_code& __x, const error_code& __y) _NOEXCEPT { return __x.category() == __y.category() && __x.value() == __y.value(); } inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const error_code& __x, const error_condition& __y) +operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT { return __x.category().equivalent(__x.value(), __y) || __y.category().equivalent(__x, __y.value()); @@ -565,40 +569,44 @@ operator==(const error_code& __x, const error_condition& __y) inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const error_condition& __x, const error_code& __y) +operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT { return __y == __x; } inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const error_condition& __x, const error_condition& __y) +operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT { return __x.category() == __y.category() && __x.value() == __y.value(); } inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const error_code& __x, const error_code& __y) {return !(__x == __y);} +operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT +{return !(__x == __y);} inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const error_code& __x, const error_condition& __y) {return !(__x == __y);} +operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT +{return !(__x == __y);} inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const error_condition& __x, const error_code& __y) {return !(__x == __y);} +operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT +{return !(__x == __y);} inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);} +operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT +{return !(__x == __y);} template <> struct _LIBCPP_VISIBLE hash : public unary_function { _LIBCPP_INLINE_VISIBILITY - size_t operator()(const error_code& __ec) const + size_t operator()(const error_code& __ec) const _NOEXCEPT { return static_cast(__ec.value()); } @@ -617,10 +625,10 @@ public: system_error(int __ev, const error_category& __ecat, const string& __what_arg); system_error(int __ev, const error_category& __ecat, const char* __what_arg); system_error(int __ev, const error_category& __ecat); - ~system_error() throw(); + ~system_error() _NOEXCEPT; _LIBCPP_ALWAYS_INLINE - const error_code& code() const throw() {return __ec_;} + const error_code& code() const _NOEXCEPT {return __ec_;} private: static string __init(const error_code&, string); diff --git a/src/future.cpp b/src/future.cpp index 0b8628f3..8e79f3e3 100644 --- a/src/future.cpp +++ b/src/future.cpp @@ -16,12 +16,12 @@ class _LIBCPP_HIDDEN __future_error_category : public __do_message { public: - virtual const char* name() const; + virtual const char* name() const _NOEXCEPT; virtual string message(int ev) const; }; const char* -__future_error_category::name() const +__future_error_category::name() const _NOEXCEPT { return "future"; } diff --git a/src/ios.cpp b/src/ios.cpp index e7153cba..bca15fb7 100644 --- a/src/ios.cpp +++ b/src/ios.cpp @@ -38,12 +38,12 @@ class _LIBCPP_HIDDEN __iostream_category : public __do_message { public: - virtual const char* name() const; + virtual const char* name() const _NOEXCEPT; virtual string message(int ev) const; }; const char* -__iostream_category::name() const +__iostream_category::name() const _NOEXCEPT { return "iostream"; } diff --git a/src/stdexcept.cpp b/src/stdexcept.cpp index 9d9b4d94..28917887 100644 --- a/src/stdexcept.cpp +++ b/src/stdexcept.cpp @@ -34,13 +34,13 @@ private: static const std::ptrdiff_t offset = static_cast(2*sizeof(unused_t) + sizeof(count_t)); - count_t& count() const throw() {return (count_t&)(*(str_ - sizeof(count_t)));} + count_t& count() const _NOEXCEPT {return (count_t&)(*(str_ - sizeof(count_t)));} public: explicit __libcpp_nmstr(const char* msg); __libcpp_nmstr(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW; __libcpp_nmstr& operator=(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW; ~__libcpp_nmstr() _LIBCPP_CANTTHROW; - const char* c_str() const throw() {return str_;} + const char* c_str() const _NOEXCEPT {return str_;} }; __libcpp_nmstr::__libcpp_nmstr(const char* msg) @@ -98,14 +98,14 @@ logic_error::logic_error(const char* msg) ::new(&s) __libcpp_nmstr(msg); } -logic_error::logic_error(const logic_error& le) throw() +logic_error::logic_error(const logic_error& le) _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; ::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_); } logic_error& -logic_error::operator=(const logic_error& le) throw() +logic_error::operator=(const logic_error& le) _NOEXCEPT { __libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_; const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_; @@ -113,14 +113,14 @@ logic_error::operator=(const logic_error& le) throw() return *this; } -logic_error::~logic_error() throw() +logic_error::~logic_error() _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; s.~__libcpp_nmstr(); } const char* -logic_error::what() const throw() +logic_error::what() const _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; return s.c_str(); @@ -138,14 +138,14 @@ runtime_error::runtime_error(const char* msg) ::new(&s) __libcpp_nmstr(msg); } -runtime_error::runtime_error(const runtime_error& le) throw() +runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; ::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_); } runtime_error& -runtime_error::operator=(const runtime_error& le) throw() +runtime_error::operator=(const runtime_error& le) _NOEXCEPT { __libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_; const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_; @@ -153,26 +153,26 @@ runtime_error::operator=(const runtime_error& le) throw() return *this; } -runtime_error::~runtime_error() throw() +runtime_error::~runtime_error() _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; s.~__libcpp_nmstr(); } const char* -runtime_error::what() const throw() +runtime_error::what() const _NOEXCEPT { __libcpp_nmstr& s = (__libcpp_nmstr&)__imp_; return s.c_str(); } -domain_error::~domain_error() throw() {} -invalid_argument::~invalid_argument() throw() {} -length_error::~length_error() throw() {} -out_of_range::~out_of_range() throw() {} +domain_error::~domain_error() _NOEXCEPT {} +invalid_argument::~invalid_argument() _NOEXCEPT {} +length_error::~length_error() _NOEXCEPT {} +out_of_range::~out_of_range() _NOEXCEPT {} -range_error::~range_error() throw() {} -overflow_error::~overflow_error() throw() {} -underflow_error::~underflow_error() throw() {} +range_error::~range_error() _NOEXCEPT {} +overflow_error::~overflow_error() _NOEXCEPT {} +underflow_error::~underflow_error() _NOEXCEPT {} } // std diff --git a/src/system_error.cpp b/src/system_error.cpp index 2886a15c..caafc32a 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp @@ -15,28 +15,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD // class error_category -error_category::error_category() +error_category::error_category() _NOEXCEPT { } -error_category::~error_category() +error_category::~error_category() _NOEXCEPT { } error_condition -error_category::default_error_condition(int ev) const +error_category::default_error_condition(int ev) const _NOEXCEPT { return error_condition(ev, *this); } bool -error_category::equivalent(int code, const error_condition& condition) const +error_category::equivalent(int code, const error_condition& condition) const _NOEXCEPT { return default_error_condition(code) == condition; } bool -error_category::equivalent(const error_code& code, int condition) const +error_category::equivalent(const error_code& code, int condition) const _NOEXCEPT { return *this == code.category() && code.value() == condition; } @@ -51,12 +51,12 @@ class _LIBCPP_HIDDEN __generic_error_category : public __do_message { public: - virtual const char* name() const; + virtual const char* name() const _NOEXCEPT; virtual string message(int ev) const; }; const char* -__generic_error_category::name() const +__generic_error_category::name() const _NOEXCEPT { return "generic"; } @@ -72,7 +72,7 @@ __generic_error_category::message(int ev) const } const error_category& -generic_category() +generic_category() _NOEXCEPT { static __generic_error_category s; return s; @@ -82,13 +82,13 @@ class _LIBCPP_HIDDEN __system_error_category : public __do_message { public: - virtual const char* name() const; + virtual const char* name() const _NOEXCEPT; virtual string message(int ev) const; - virtual error_condition default_error_condition(int ev) const; + virtual error_condition default_error_condition(int ev) const _NOEXCEPT; }; const char* -__system_error_category::name() const +__system_error_category::name() const _NOEXCEPT { return "system"; } @@ -104,7 +104,7 @@ __system_error_category::message(int ev) const } error_condition -__system_error_category::default_error_condition(int ev) const +__system_error_category::default_error_condition(int ev) const _NOEXCEPT { #ifdef ELAST if (ev > ELAST) @@ -114,7 +114,7 @@ __system_error_category::default_error_condition(int ev) const } const error_category& -system_category() +system_category() _NOEXCEPT { static __system_error_category s; return s; @@ -186,7 +186,7 @@ system_error::system_error(int ev, const error_category& ecat) { } -system_error::~system_error() throw() +system_error::~system_error() _NOEXCEPT { }