Index: system_error.hpp =================================================================== --- system_error.hpp (revision 80809) +++ system_error.hpp (working copy) @@ -21,7 +21,7 @@ class BOOST_SYMBOL_VISIBLE system_error : public std::runtime_error // BOOST_SYMBOL_VISIBLE is needed by GCC to ensure system_error thrown from a shared - // library can be caught. See svn.boost.org/trac/boost/ticket/3697 + // library can be caught. See svn.boost.org/trac/boost/ticket/3697 { public: system_error( error_code ec ) @@ -61,13 +61,17 @@ { if ( m_what.empty() ) { +#ifndef BOOST_NO_EXCEPTIONS try +#endif { m_what = this->std::runtime_error::what(); if ( !m_what.empty() ) m_what += ": "; m_what += m_error_code.message(); } +#ifndef BOOST_NO_EXCEPTIONS catch (...) { return std::runtime_error::what(); } +#endif } return m_what.c_str(); } Index: error_code.hpp =================================================================== --- error_code.hpp (revision 80809) +++ error_code.hpp (working copy) @@ -23,7 +23,7 @@ #include // TODO: undef these macros if not already defined -#include +#include #if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API) # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined @@ -186,10 +186,10 @@ virtual const char * name() const = 0; virtual std::string message( int ev ) const = 0; - virtual error_condition default_error_condition( int ev ) const; - virtual bool equivalent( int code, + inline virtual error_condition default_error_condition( int ev ) const; + inline virtual bool equivalent( int code, const error_condition & condition ) const; - virtual bool equivalent( const error_code & code, + inline virtual bool equivalent( const error_code & code, int condition ) const; bool operator==(const error_category & rhs) const { return this == &rhs; } @@ -202,9 +202,13 @@ // predefined error categories -----------------------------------------// +# ifdef BOOST_ERROR_CODE_HEADER_ONLY + inline const error_category & system_category(); + inline const error_category & generic_category(); +#else BOOST_SYSTEM_DECL const error_category & system_category(); BOOST_SYSTEM_DECL const error_category & generic_category(); - +#endif // deprecated synonyms --------------------------------------------------// # ifndef BOOST_SYSTEM_NO_DEPRECATED @@ -238,15 +242,15 @@ // modifiers: void assign( int val, const error_category & cat ) - { + { m_val = val; m_cat = &cat; } - + template typename boost::enable_if, error_condition>::type & operator=( ErrorConditionEnum val ) - { + { *this = make_error_condition(val); return *this; } @@ -266,7 +270,7 @@ static void unspecified_bool_true() {} operator unspecified_bool_type() const // true if error - { + { return m_val == 0 ? 0 : unspecified_bool_true; } @@ -282,7 +286,7 @@ const error_condition & rhs ) { return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val; - } + } inline friend bool operator<( const error_condition & lhs, const error_condition & rhs ) @@ -324,15 +328,15 @@ // modifiers: void assign( int val, const error_category & cat ) - { + { m_val = val; m_cat = &cat; } - + template typename boost::enable_if, error_code>::type & operator=( ErrorCodeEnum val ) - { + { *this = make_error_code(val); return *this; } @@ -353,7 +357,7 @@ static void unspecified_bool_true() {} operator unspecified_bool_type() const // true if error - { + { return m_val == 0 ? 0 : unspecified_bool_true; } @@ -379,7 +383,7 @@ return lhs.m_cat < rhs.m_cat || (lhs.m_cat == rhs.m_cat && lhs.m_val < rhs.m_val); } - + private: int m_val; const error_category * m_cat; @@ -431,26 +435,26 @@ return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() ); } - + inline bool operator!=( const error_code & lhs, const error_condition & rhs ) { return !(lhs == rhs); } - + inline bool operator==( const error_condition & condition, const error_code & code ) { return condition.category().equivalent( code, condition.value() ) || code.category().equivalent( code.value(), condition ); } - + inline bool operator!=( const error_condition & lhs, const error_code & rhs ) { return !(lhs == rhs); } - + // TODO: both of these may move elsewhere, but the LWG hasn't spoken yet. template @@ -482,18 +486,18 @@ // error_category default implementation -------------------------------// - inline error_condition error_category::default_error_condition( int ev ) const - { + error_condition error_category::default_error_condition( int ev ) const + { return error_condition( ev, *this ); } - inline bool error_category::equivalent( int code, + bool error_category::equivalent( int code, const error_condition & condition ) const { return default_error_condition( code ) == condition; } - inline bool error_category::equivalent( const error_code & code, + bool error_category::equivalent( const error_code & code, int condition ) const { return *this == code.category() && code.value() == condition;