diff --git a/include/boost/exception/detail/attribute_noreturn.hpp b/include/boost/exception/detail/attribute_noreturn.hpp index 1cb0763..f6a0b59 100644 --- a/include/boost/exception/detail/attribute_noreturn.hpp +++ b/include/boost/exception/detail/attribute_noreturn.hpp @@ -6,9 +6,7 @@ #ifndef UUID_61531AB0680611DEADD5846855D89593 #define UUID_61531AB0680611DEADD5846855D89593 -#include - -#if defined(BOOST_MSVC) +#if defined(_MSC_VER) #define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn) #elif defined(__GNUC__) #define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn)) diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index fbc0594..79b2739 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -5,6 +5,12 @@ #ifndef UUID_274DA366004E11DCB1DDFE2E56D89593 #define UUID_274DA366004E11DCB1DDFE2E56D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif namespace boost @@ -129,6 +135,15 @@ boost template E const & operator<<( E const &, error_info const & ); + template + E const & operator<<( E const &, throw_function const & ); + + template + E const & operator<<( E const &, throw_file const & ); + + template + E const & operator<<( E const &, throw_line const & ); + class exception; template @@ -151,7 +166,6 @@ boost protected: - virtual ~error_info_container() throw() { } @@ -202,34 +216,19 @@ boost #endif ; +#if defined(__MWERKS__) && __MWERKS__<=0x3207 + public: +#else private: template - friend - E const & - operator<<( E const & x, throw_function const & y ) - { - x.throw_function_=y.v_; - return x; - } + friend E const & operator<<( E const &, throw_function const & ); template - friend - E const & - operator<<( E const & x, throw_file const & y ) - { - x.throw_file_=y.v_; - return x; - } + friend E const & operator<<( E const &, throw_file const & ); template - friend - E const & - operator<<( E const & x, throw_line const & y ) - { - x.throw_line_=y.v_; - return x; - } + friend E const & operator<<( E const &, throw_line const & ); friend char const * exception_detail::get_diagnostic_information( exception const &, char const * ); @@ -241,7 +240,7 @@ boost friend struct exception_detail::get_info; friend struct exception_detail::get_info; friend struct exception_detail::get_info; - +#endif mutable exception_detail::refcount_ptr data_; mutable char const * throw_function_; mutable char const * throw_file_; @@ -254,6 +253,30 @@ boost { } + template + E const & + operator<<( E const & x, throw_function const & y ) + { + x.throw_function_=y.v_; + return x; + } + + template + E const & + operator<<( E const & x, throw_file const & y ) + { + x.throw_file_=y.v_; + return x; + } + + template + E const & + operator<<( E const & x, throw_line const & y ) + { + x.throw_line_=y.v_; + return x; + } + //////////////////////////////////////////////////////////////////////// namespace @@ -393,4 +416,7 @@ boost } } +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif #endif diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index a5a5f9e..54aab7b 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) ) diff --git a/test/1-throw_exception_test.cpp b/test/1-throw_exception_test.cpp index 06273bc..5106e86 100644 --- a/test/1-throw_exception_test.cpp +++ b/test/1-throw_exception_test.cpp @@ -6,6 +6,8 @@ #include #include +#include + class my_exception: public std::exception { }; int