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
This commit is contained in:
parent
19ce6a4792
commit
1e15fd1856
@ -33,9 +33,9 @@ class xxx_error : public exception // at least indirectly
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit xxx_error(const string& what_arg);
|
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
|
} // std
|
||||||
@ -60,12 +60,12 @@ public:
|
|||||||
explicit logic_error(const string&);
|
explicit logic_error(const string&);
|
||||||
explicit logic_error(const char*);
|
explicit logic_error(const char*);
|
||||||
|
|
||||||
logic_error(const logic_error&) throw();
|
logic_error(const logic_error&) _NOEXCEPT;
|
||||||
logic_error& operator=(const logic_error&) throw();
|
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
|
class _LIBCPP_EXCEPTION_ABI runtime_error
|
||||||
@ -77,12 +77,12 @@ public:
|
|||||||
explicit runtime_error(const string&);
|
explicit runtime_error(const string&);
|
||||||
explicit runtime_error(const char*);
|
explicit runtime_error(const char*);
|
||||||
|
|
||||||
runtime_error(const runtime_error&) throw();
|
runtime_error(const runtime_error&) _NOEXCEPT;
|
||||||
runtime_error& operator=(const runtime_error&) throw();
|
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
|
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 string& __s) : logic_error(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __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
|
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 string& __s) : logic_error(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __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
|
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 string& __s) : logic_error(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __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
|
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 string& __s) : logic_error(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __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
|
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 string& __s) : runtime_error(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __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
|
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 string& __s) : runtime_error(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __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
|
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 string& __s) : runtime_error(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __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
|
} // std
|
||||||
|
@ -20,24 +20,24 @@ namespace std
|
|||||||
class error_category
|
class error_category
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~error_category();
|
virtual ~error_category() noexcept;
|
||||||
|
|
||||||
error_category(const error_category&) = delete;
|
error_category(const error_category&) = delete;
|
||||||
error_category& operator=(const error_category&) = delete;
|
error_category& operator=(const error_category&) = delete;
|
||||||
|
|
||||||
virtual const char* name() const = 0;
|
virtual const char* name() const noexcept = 0;
|
||||||
virtual error_condition default_error_condition(int ev) const;
|
virtual error_condition default_error_condition(int ev) const noexcept;
|
||||||
virtual bool equivalent(int code, const error_condition& condition) const;
|
virtual bool equivalent(int code, const error_condition& condition) const noexcept;
|
||||||
virtual bool equivalent(const error_code& code, int condition) const;
|
virtual bool equivalent(const error_code& code, int condition) const noexcept;
|
||||||
virtual string message(int ev) const = 0;
|
virtual string message(int ev) const = 0;
|
||||||
|
|
||||||
bool operator==(const error_category& rhs) const;
|
bool operator==(const error_category& rhs) const noexcept;
|
||||||
bool operator!=(const error_category& rhs) const;
|
bool operator!=(const error_category& rhs) const noexcept;
|
||||||
bool operator<(const error_category& rhs) const;
|
bool operator<(const error_category& rhs) const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
const error_category& generic_category();
|
const error_category& generic_category() noexcept;
|
||||||
const error_category& system_category();
|
const error_category& system_category() noexcept;
|
||||||
|
|
||||||
template <class T> struct is_error_code_enum
|
template <class T> struct is_error_code_enum
|
||||||
: public false_type {};
|
: public false_type {};
|
||||||
@ -49,27 +49,27 @@ class error_code
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructors:
|
// constructors:
|
||||||
error_code();
|
error_code() noexcept;
|
||||||
error_code(int val, const error_category& cat);
|
error_code(int val, const error_category& cat) noexcept;
|
||||||
template <class ErrorCodeEnum>
|
template <class ErrorCodeEnum>
|
||||||
error_code(ErrorCodeEnum e);
|
error_code(ErrorCodeEnum e) noexcept;
|
||||||
|
|
||||||
// modifiers:
|
// modifiers:
|
||||||
void assign(int val, const error_category& cat);
|
void assign(int val, const error_category& cat) noexcept;
|
||||||
template <class ErrorCodeEnum>
|
template <class ErrorCodeEnum>
|
||||||
error_code& operator=(ErrorCodeEnum e);
|
error_code& operator=(ErrorCodeEnum e) noexcept;
|
||||||
void clear();
|
void clear() noexcept;
|
||||||
|
|
||||||
// observers:
|
// observers:
|
||||||
int value() const;
|
int value() const noexcept;
|
||||||
const error_category& category() const;
|
const error_category& category() const noexcept;
|
||||||
error_condition default_error_condition() const;
|
error_condition default_error_condition() const noexcept;
|
||||||
string message() const;
|
string message() const;
|
||||||
explicit operator bool() const;
|
explicit operator bool() const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
// non-member functions:
|
// 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 <class charT, class traits>
|
template <class charT, class traits>
|
||||||
basic_ostream<charT,traits>&
|
basic_ostream<charT,traits>&
|
||||||
operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
|
operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
|
||||||
@ -78,25 +78,25 @@ class error_condition
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructors:
|
// constructors:
|
||||||
error_condition();
|
error_condition() noexcept;
|
||||||
error_condition(int val, const error_category& cat);
|
error_condition(int val, const error_category& cat) noexcept;
|
||||||
template <class ErrorConditionEnum>
|
template <class ErrorConditionEnum>
|
||||||
error_condition(ErrorConditionEnum e);
|
error_condition(ErrorConditionEnum e) noexcept;
|
||||||
|
|
||||||
// modifiers:
|
// modifiers:
|
||||||
void assign(int val, const error_category& cat);
|
void assign(int val, const error_category& cat) noexcept;
|
||||||
template <class ErrorConditionEnum>
|
template <class ErrorConditionEnum>
|
||||||
error_condition& operator=(ErrorConditionEnum e);
|
error_condition& operator=(ErrorConditionEnum e) noexcept;
|
||||||
void clear();
|
void clear() noexcept;
|
||||||
|
|
||||||
// observers:
|
// observers:
|
||||||
int value() const;
|
int value() const noexcept;
|
||||||
const error_category& category() const;
|
const error_category& category() const noexcept;
|
||||||
string message() const;
|
string message() const noexcept;
|
||||||
explicit operator bool() const;
|
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
|
class system_error
|
||||||
: public runtime_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 char* what_arg);
|
||||||
system_error(int ev, const error_category& ecat);
|
system_error(int ev, const error_category& ecat);
|
||||||
|
|
||||||
const error_code& code() const throw();
|
const error_code& code() const noexcept;
|
||||||
const char* what() const throw();
|
const char* what() const noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class errc
|
enum class errc
|
||||||
@ -198,18 +198,18 @@ enum class errc
|
|||||||
template <> struct is_error_condition_enum<errc>
|
template <> struct is_error_condition_enum<errc>
|
||||||
: true_type { }
|
: true_type { }
|
||||||
|
|
||||||
error_code make_error_code(errc e);
|
error_code make_error_code(errc e) noexcept;
|
||||||
error_condition make_error_condition(errc e);
|
error_condition make_error_condition(errc e) noexcept;
|
||||||
|
|
||||||
// Comparison operators:
|
// Comparison operators:
|
||||||
bool operator==(const error_code& lhs, const error_code& rhs);
|
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
|
||||||
bool operator==(const error_code& lhs, const error_condition& rhs);
|
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
|
||||||
bool operator==(const error_condition& lhs, const error_code& rhs);
|
bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
|
||||||
bool operator==(const error_condition& lhs, const error_condition& rhs);
|
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
|
||||||
bool operator!=(const error_code& lhs, const error_code& rhs);
|
bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
|
||||||
bool operator!=(const error_code& lhs, const error_condition& rhs);
|
bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
|
||||||
bool operator!=(const error_condition& lhs, const error_code& rhs);
|
bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
|
||||||
bool operator!=(const error_condition& lhs, const error_condition& rhs);
|
bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
|
||||||
|
|
||||||
template <> struct hash<std::error_code>;
|
template <> struct hash<std::error_code>;
|
||||||
|
|
||||||
@ -369,28 +369,28 @@ class __do_message;
|
|||||||
class _LIBCPP_VISIBLE error_category
|
class _LIBCPP_VISIBLE error_category
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~error_category();
|
virtual ~error_category() _NOEXCEPT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
error_category();
|
error_category() _NOEXCEPT;
|
||||||
error_category(const error_category&);// = delete;
|
error_category(const error_category&);// = delete;
|
||||||
error_category& operator=(const error_category&);// = delete;
|
error_category& operator=(const error_category&);// = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual const char* name() const = 0;
|
virtual const char* name() const _NOEXCEPT = 0;
|
||||||
virtual error_condition default_error_condition(int __ev) const;
|
virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
|
||||||
virtual bool equivalent(int __code, const error_condition& __condition) const;
|
virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
|
||||||
virtual bool equivalent(const error_code& __code, int __condition) const;
|
virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
|
||||||
virtual string message(int __ev) const = 0;
|
virtual string message(int __ev) const = 0;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_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
|
_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
|
_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;
|
friend class __do_message;
|
||||||
};
|
};
|
||||||
@ -402,8 +402,8 @@ public:
|
|||||||
virtual string message(int ev) const;
|
virtual string message(int ev) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
const error_category& generic_category();
|
const error_category& generic_category() _NOEXCEPT;
|
||||||
const error_category& system_category();
|
const error_category& system_category() _NOEXCEPT;
|
||||||
|
|
||||||
class _LIBCPP_VISIBLE error_condition
|
class _LIBCPP_VISIBLE error_condition
|
||||||
{
|
{
|
||||||
@ -411,19 +411,21 @@ class _LIBCPP_VISIBLE error_condition
|
|||||||
const error_category* __cat_;
|
const error_category* __cat_;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
error_condition() : __val_(0), __cat_(&generic_category()) {}
|
error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
error_condition(int __val, const error_category& __cat)
|
error_condition(int __val, const error_category& __cat) _NOEXCEPT
|
||||||
: __val_(__val), __cat_(&__cat) {}
|
: __val_(__val), __cat_(&__cat) {}
|
||||||
|
|
||||||
template <class _E>
|
template <class _E>
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
error_condition(_E __e, typename enable_if<is_error_condition_enum<_E>::value>::type* = 0)
|
error_condition(_E __e,
|
||||||
|
typename enable_if<is_error_condition_enum<_E>::value>::type* = 0
|
||||||
|
) _NOEXCEPT
|
||||||
{*this = make_error_condition(__e);}
|
{*this = make_error_condition(__e);}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
void assign(int __val, const error_category& __cat)
|
void assign(int __val, const error_category& __cat) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__val_ = __val;
|
__val_ = __val;
|
||||||
__cat_ = &__cat;
|
__cat_ = &__cat;
|
||||||
@ -436,38 +438,38 @@ public:
|
|||||||
is_error_condition_enum<_E>::value,
|
is_error_condition_enum<_E>::value,
|
||||||
error_condition&
|
error_condition&
|
||||||
>::type
|
>::type
|
||||||
operator=(_E __e)
|
operator=(_E __e) _NOEXCEPT
|
||||||
{*this = make_error_condition(__e); return *this;}
|
{*this = make_error_condition(__e); return *this;}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
void clear()
|
void clear() _NOEXCEPT
|
||||||
{
|
{
|
||||||
__val_ = 0;
|
__val_ = 0;
|
||||||
__cat_ = &generic_category();
|
__cat_ = &generic_category();
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
int value() const {return __val_;}
|
int value() const _NOEXCEPT {return __val_;}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
const error_category& category() const {return *__cat_;}
|
const error_category& category() const _NOEXCEPT {return *__cat_;}
|
||||||
string message() const;
|
string message() const;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
//explicit
|
//explicit
|
||||||
operator bool() const {return __val_ != 0;}
|
operator bool() const _NOEXCEPT {return __val_ != 0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
error_condition
|
error_condition
|
||||||
make_error_condition(errc __e)
|
make_error_condition(errc __e) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return error_condition(static_cast<int>(__e), generic_category());
|
return error_condition(static_cast<int>(__e), generic_category());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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()
|
return __x.category() < __y.category()
|
||||||
|| __x.category() == __y.category() && __x.value() < __y.value();
|
|| __x.category() == __y.category() && __x.value() < __y.value();
|
||||||
@ -481,19 +483,21 @@ class _LIBCPP_VISIBLE error_code
|
|||||||
const error_category* __cat_;
|
const error_category* __cat_;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
error_code() : __val_(0), __cat_(&system_category()) {}
|
error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
error_code(int __val, const error_category& __cat)
|
error_code(int __val, const error_category& __cat) _NOEXCEPT
|
||||||
: __val_(__val), __cat_(&__cat) {}
|
: __val_(__val), __cat_(&__cat) {}
|
||||||
|
|
||||||
template <class _E>
|
template <class _E>
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
error_code(_E __e, typename enable_if<is_error_code_enum<_E>::value>::type* = 0)
|
error_code(_E __e,
|
||||||
|
typename enable_if<is_error_code_enum<_E>::value>::type* = 0
|
||||||
|
) _NOEXCEPT
|
||||||
{*this = make_error_code(__e);}
|
{*this = make_error_code(__e);}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
void assign(int __val, const error_category& __cat)
|
void assign(int __val, const error_category& __cat) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__val_ = __val;
|
__val_ = __val;
|
||||||
__cat_ = &__cat;
|
__cat_ = &__cat;
|
||||||
@ -506,43 +510,43 @@ public:
|
|||||||
is_error_code_enum<_E>::value,
|
is_error_code_enum<_E>::value,
|
||||||
error_code&
|
error_code&
|
||||||
>::type
|
>::type
|
||||||
operator=(_E __e)
|
operator=(_E __e) _NOEXCEPT
|
||||||
{*this = make_error_code(__e); return *this;}
|
{*this = make_error_code(__e); return *this;}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
void clear()
|
void clear() _NOEXCEPT
|
||||||
{
|
{
|
||||||
__val_ = 0;
|
__val_ = 0;
|
||||||
__cat_ = &system_category();
|
__cat_ = &system_category();
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
int value() const {return __val_;}
|
int value() const _NOEXCEPT {return __val_;}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
const error_category& category() const {return *__cat_;}
|
const error_category& category() const _NOEXCEPT {return *__cat_;}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
error_condition default_error_condition() const
|
error_condition default_error_condition() const _NOEXCEPT
|
||||||
{return __cat_->default_error_condition(__val_);}
|
{return __cat_->default_error_condition(__val_);}
|
||||||
|
|
||||||
string message() const;
|
string message() const;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
//explicit
|
//explicit
|
||||||
operator bool() const {return __val_ != 0;}
|
operator bool() const _NOEXCEPT {return __val_ != 0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
error_code
|
error_code
|
||||||
make_error_code(errc __e)
|
make_error_code(errc __e) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return error_code(static_cast<int>(__e), generic_category());
|
return error_code(static_cast<int>(__e), generic_category());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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()
|
return __x.category() < __y.category()
|
||||||
|| __x.category() == __y.category() && __x.value() < __y.value();
|
|| __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
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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();
|
return __x.category() == __y.category() && __x.value() == __y.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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)
|
return __x.category().equivalent(__x.value(), __y)
|
||||||
|| __y.category().equivalent(__x, __y.value());
|
|| __y.category().equivalent(__x, __y.value());
|
||||||
@ -565,40 +569,44 @@ operator==(const error_code& __x, const error_condition& __y)
|
|||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const error_condition& __x, const error_code& __y)
|
operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT
|
||||||
{
|
{
|
||||||
return __y == __x;
|
return __y == __x;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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();
|
return __x.category() == __y.category() && __x.value() == __y.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
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 <>
|
template <>
|
||||||
struct _LIBCPP_VISIBLE hash<error_code>
|
struct _LIBCPP_VISIBLE hash<error_code>
|
||||||
: public unary_function<error_code, size_t>
|
: public unary_function<error_code, size_t>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_t operator()(const error_code& __ec) const
|
size_t operator()(const error_code& __ec) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
return static_cast<size_t>(__ec.value());
|
return static_cast<size_t>(__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 string& __what_arg);
|
||||||
system_error(int __ev, const error_category& __ecat, const char* __what_arg);
|
system_error(int __ev, const error_category& __ecat, const char* __what_arg);
|
||||||
system_error(int __ev, const error_category& __ecat);
|
system_error(int __ev, const error_category& __ecat);
|
||||||
~system_error() throw();
|
~system_error() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
const error_code& code() const throw() {return __ec_;}
|
const error_code& code() const _NOEXCEPT {return __ec_;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static string __init(const error_code&, string);
|
static string __init(const error_code&, string);
|
||||||
|
@ -16,12 +16,12 @@ class _LIBCPP_HIDDEN __future_error_category
|
|||||||
: public __do_message
|
: public __do_message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const char* name() const;
|
virtual const char* name() const _NOEXCEPT;
|
||||||
virtual string message(int ev) const;
|
virtual string message(int ev) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
__future_error_category::name() const
|
__future_error_category::name() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
return "future";
|
return "future";
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,12 @@ class _LIBCPP_HIDDEN __iostream_category
|
|||||||
: public __do_message
|
: public __do_message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const char* name() const;
|
virtual const char* name() const _NOEXCEPT;
|
||||||
virtual string message(int ev) const;
|
virtual string message(int ev) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
__iostream_category::name() const
|
__iostream_category::name() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
return "iostream";
|
return "iostream";
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,13 @@ private:
|
|||||||
static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
|
static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
|
||||||
sizeof(count_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:
|
public:
|
||||||
explicit __libcpp_nmstr(const char* msg);
|
explicit __libcpp_nmstr(const char* msg);
|
||||||
__libcpp_nmstr(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
|
__libcpp_nmstr(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
|
||||||
__libcpp_nmstr& operator=(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
|
__libcpp_nmstr& operator=(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
|
||||||
~__libcpp_nmstr() _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)
|
__libcpp_nmstr::__libcpp_nmstr(const char* msg)
|
||||||
@ -98,14 +98,14 @@ logic_error::logic_error(const char* msg)
|
|||||||
::new(&s) __libcpp_nmstr(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_;
|
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||||
::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
|
::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
|
||||||
}
|
}
|
||||||
|
|
||||||
logic_error&
|
logic_error&
|
||||||
logic_error::operator=(const logic_error& le) throw()
|
logic_error::operator=(const logic_error& le) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
|
__libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
|
||||||
const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
|
const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
|
||||||
@ -113,14 +113,14 @@ logic_error::operator=(const logic_error& le) throw()
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
logic_error::~logic_error() throw()
|
logic_error::~logic_error() _NOEXCEPT
|
||||||
{
|
{
|
||||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||||
s.~__libcpp_nmstr();
|
s.~__libcpp_nmstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
logic_error::what() const throw()
|
logic_error::what() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||||
return s.c_str();
|
return s.c_str();
|
||||||
@ -138,14 +138,14 @@ runtime_error::runtime_error(const char* msg)
|
|||||||
::new(&s) __libcpp_nmstr(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_;
|
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||||
::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
|
::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime_error&
|
runtime_error&
|
||||||
runtime_error::operator=(const runtime_error& le) throw()
|
runtime_error::operator=(const runtime_error& le) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
|
__libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
|
||||||
const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
|
const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
|
||||||
@ -153,26 +153,26 @@ runtime_error::operator=(const runtime_error& le) throw()
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime_error::~runtime_error() throw()
|
runtime_error::~runtime_error() _NOEXCEPT
|
||||||
{
|
{
|
||||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||||
s.~__libcpp_nmstr();
|
s.~__libcpp_nmstr();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
runtime_error::what() const throw()
|
runtime_error::what() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||||
return s.c_str();
|
return s.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
domain_error::~domain_error() throw() {}
|
domain_error::~domain_error() _NOEXCEPT {}
|
||||||
invalid_argument::~invalid_argument() throw() {}
|
invalid_argument::~invalid_argument() _NOEXCEPT {}
|
||||||
length_error::~length_error() throw() {}
|
length_error::~length_error() _NOEXCEPT {}
|
||||||
out_of_range::~out_of_range() throw() {}
|
out_of_range::~out_of_range() _NOEXCEPT {}
|
||||||
|
|
||||||
range_error::~range_error() throw() {}
|
range_error::~range_error() _NOEXCEPT {}
|
||||||
overflow_error::~overflow_error() throw() {}
|
overflow_error::~overflow_error() _NOEXCEPT {}
|
||||||
underflow_error::~underflow_error() throw() {}
|
underflow_error::~underflow_error() _NOEXCEPT {}
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
@ -15,28 +15,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||||||
|
|
||||||
// class error_category
|
// class error_category
|
||||||
|
|
||||||
error_category::error_category()
|
error_category::error_category() _NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
error_category::~error_category()
|
error_category::~error_category() _NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
error_condition
|
error_condition
|
||||||
error_category::default_error_condition(int ev) const
|
error_category::default_error_condition(int ev) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
return error_condition(ev, *this);
|
return error_condition(ev, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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;
|
return default_error_condition(code) == condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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;
|
return *this == code.category() && code.value() == condition;
|
||||||
}
|
}
|
||||||
@ -51,12 +51,12 @@ class _LIBCPP_HIDDEN __generic_error_category
|
|||||||
: public __do_message
|
: public __do_message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const char* name() const;
|
virtual const char* name() const _NOEXCEPT;
|
||||||
virtual string message(int ev) const;
|
virtual string message(int ev) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
__generic_error_category::name() const
|
__generic_error_category::name() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
return "generic";
|
return "generic";
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ __generic_error_category::message(int ev) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const error_category&
|
const error_category&
|
||||||
generic_category()
|
generic_category() _NOEXCEPT
|
||||||
{
|
{
|
||||||
static __generic_error_category s;
|
static __generic_error_category s;
|
||||||
return s;
|
return s;
|
||||||
@ -82,13 +82,13 @@ class _LIBCPP_HIDDEN __system_error_category
|
|||||||
: public __do_message
|
: public __do_message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const char* name() const;
|
virtual const char* name() const _NOEXCEPT;
|
||||||
virtual string message(int ev) const;
|
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*
|
const char*
|
||||||
__system_error_category::name() const
|
__system_error_category::name() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
return "system";
|
return "system";
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ __system_error_category::message(int ev) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_condition
|
error_condition
|
||||||
__system_error_category::default_error_condition(int ev) const
|
__system_error_category::default_error_condition(int ev) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
#ifdef ELAST
|
#ifdef ELAST
|
||||||
if (ev > ELAST)
|
if (ev > ELAST)
|
||||||
@ -114,7 +114,7 @@ __system_error_category::default_error_condition(int ev) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const error_category&
|
const error_category&
|
||||||
system_category()
|
system_category() _NOEXCEPT
|
||||||
{
|
{
|
||||||
static __system_error_category s;
|
static __system_error_category s;
|
||||||
return 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
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user