diff -r 510d5bd079ad boost/test/execution_monitor.hpp --- a/boost/test/execution_monitor.hpp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/execution_monitor.hpp Mon Jun 30 18:23:45 2008 -0600 @@ -82,7 +82,7 @@ // design rationale: fear of being out (or nearly out) of memory. -class BOOST_TEST_DECL execution_exception { +class BOOST_TEST_DECL execution_exception : public std::exception { typedef boost::unit_test::const_string const_string; public: enum error_code { @@ -119,7 +119,7 @@ // access methods error_code code() const { return m_error_code; } - const_string what() const { return m_what; } + const char* what() const throw() { return m_what.begin(); } private: // Data members @@ -203,10 +203,13 @@ { try { return m_next ? (*m_next)( F ) : F(); - } catch( Exception const& e ) { + } +#ifndef BOOST_NO_EXCEPTIONS + catch( Exception const& e ) { m_translator( e ); return boost::exit_exception_failure; } +#endif } private: @@ -228,13 +231,13 @@ // ************** execution_aborted ************** // // ************************************************************************** // -struct execution_aborted {}; +struct execution_aborted : public std::exception {}; // ************************************************************************** // // ************** system_error ************** // // ************************************************************************** // -class system_error { + class system_error : public std::exception { public: // Constructor explicit system_error( char const* exp ); @@ -243,7 +246,7 @@ unit_test::readonly_property p_failed_exp; }; -#define BOOST_TEST_SYS_ASSERT( exp ) if( (exp) ) ; else throw ::boost::system_error( BOOST_STRINGIZE( exp ) ) +#define BOOST_TEST_SYS_ASSERT( exp ) if( (exp) ) ; else boost::throw_exception( ::boost::system_error( BOOST_STRINGIZE( exp ) ) ); } // namespace boost diff -r 510d5bd079ad boost/test/impl/cpp_main.ipp --- a/boost/test/impl/cpp_main.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/cpp_main.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -84,6 +84,7 @@ result = ::boost::exit_failure; } } +#ifndef BOOST_NO_EXCEPTIONS catch( ::boost::execution_exception const& exex ) { std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl; result = ::boost::exit_exception_failure; @@ -94,6 +95,7 @@ << "\n**** error(" << ex.p_errno << "): " << std::strerror( ex.p_errno ) << std::endl; result = ::boost::exit_exception_failure; } +#endif if( result != ::boost::exit_success ) { std::cerr << "******** errors detected; see standard output for details ********" << std::endl; diff -r 510d5bd079ad boost/test/impl/exception_safety.ipp --- a/boost/test/impl/exception_safety.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/exception_safety.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -17,6 +17,7 @@ // Boost.Test #include +#include #if !BOOST_WORKAROUND(__GNUC__, < 3) && \ !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ @@ -106,7 +107,7 @@ struct exception_safety_tester : itest::manager, test_observer { // helpers types - struct unique_exception {}; + struct unique_exception : std::exception {}; // Constructor explicit exception_safety_tester( const_string test_name ); @@ -393,7 +394,7 @@ if( m_exec_path_counter == m_break_exec_path ) debug::debugger_break(); - throw unique_exception(); + boost::throw_exception(unique_exception()); } //____________________________________________________________________________// diff -r 510d5bd079ad boost/test/impl/execution_monitor.ipp --- a/boost/test/impl/execution_monitor.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/execution_monitor.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -31,6 +31,7 @@ #include // Boost +#include #include // for exit codes #include // for workarounds @@ -191,7 +192,7 @@ BOOST_TEST_VSNPRINTF( buf, sizeof(buf), format, args ); va_end( args ); - throw execution_exception( ec, buf ); + boost::throw_exception(execution_exception( ec, buf )); } //____________________________________________________________________________// @@ -219,7 +220,7 @@ // ************** boost::detail::system_signal_exception ************** // // ************************************************************************** // -class system_signal_exception { +class system_signal_exception : public std::exception { public: // Constructor system_signal_exception() @@ -727,8 +728,10 @@ if( !sigsetjmp( signal_handler::jump_buffer(), 1 ) ) return detail::do_invoke( m_custom_translators , F ); - else - throw local_signal_handler.sys_sig(); + else { + boost::throw_exception(local_signal_handler.sys_sig()); + return 0; + } } //____________________________________________________________________________// @@ -1063,6 +1066,8 @@ // required. Programmers ask for const anyhow, so we supply it. That's // easier than answering questions about non-const usage. +#ifndef BOOST_NO_EXCEPTIONS + catch( char const* ex ) { detail::report_error( execution_exception::cpp_exception_error, "C string: %s", ex ); } catch( std::string const& ex ) @@ -1121,6 +1126,8 @@ catch( ... ) { detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); } +#endif // BOOST_NO_EXCEPTIONS + return 0; // never reached; supplied to quiet compiler warnings } // execute diff -r 510d5bd079ad boost/test/impl/framework.ipp --- a/boost/test/impl/framework.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/framework.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -34,6 +34,7 @@ #include // Boost +#include #include // STL @@ -88,7 +89,7 @@ { #ifdef BOOST_TEST_ALTERNATIVE_INIT_API if( !(*m_init_func)() ) - throw std::runtime_error( "test module initialization failed" ); + boost::throw_exception(std::runtime_error( "test module initialization failed" )); #else test_suite* manual_test_units = (*m_init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv ); @@ -162,7 +163,7 @@ m_curr_test_case = bkup; if( unit_test_monitor.is_critical_error( run_result ) ) - throw test_being_aborted(); + boost::throw_exception(test_being_aborted()); } bool test_suite_start( test_suite const& ts ) @@ -257,9 +258,11 @@ em.execute( tic ); } +#ifndef BOOST_NO_EXCEPTIONS catch( execution_exception const& ex ) { throw setup_error( ex.what() ); } +#endif s_frk_impl().m_is_initialized = true; } @@ -278,12 +281,12 @@ register_test_unit( test_case* tc ) { if( tc->p_id != INV_TEST_UNIT_ID ) - throw setup_error( BOOST_TEST_L( "test case already registered" ) ); + boost::throw_exception(setup_error( BOOST_TEST_L( "test case already registered" ) )); test_unit_id new_id = s_frk_impl().m_next_test_case_id; if( new_id == MAX_TEST_CASE_ID ) - throw setup_error( BOOST_TEST_L( "too many test cases" ) ); + boost::throw_exception(setup_error( BOOST_TEST_L( "too many test cases" ) )); typedef framework_impl::test_unit_store::value_type map_value_type; @@ -299,12 +302,12 @@ register_test_unit( test_suite* ts ) { if( ts->p_id != INV_TEST_UNIT_ID ) - throw setup_error( BOOST_TEST_L( "test suite already registered" ) ); + boost::throw_exception(setup_error( BOOST_TEST_L( "test suite already registered" ) )); test_unit_id new_id = s_frk_impl().m_next_test_suite_id; if( new_id == MAX_TEST_SUITE_ID ) - throw setup_error( BOOST_TEST_L( "too many test suites" ) ); + boost::throw_exception(setup_error( BOOST_TEST_L( "too many test suites" ) )); typedef framework_impl::test_unit_store::value_type map_value_type; s_frk_impl().m_test_units.insert( map_value_type( new_id, ts ) ); @@ -364,7 +367,7 @@ test_unit* res = s_frk_impl().m_test_units[id]; if( (res->p_type & t) == 0 ) - throw internal_error( "Invalid test unit type" ); + boost::throw_exception(internal_error( "Invalid test unit type" )); return *res; } @@ -381,9 +384,9 @@ traverse_test_tree( id, tcc ); if( tcc.p_count == 0 ) - throw setup_error( runtime_config::test_to_run().is_empty() - ? BOOST_TEST_L( "test tree is empty" ) - : BOOST_TEST_L( "no test cases matching filter" ) ); + boost::throw_exception(setup_error( runtime_config::test_to_run().is_empty() + ? BOOST_TEST_L( "test tree is empty" ) + : BOOST_TEST_L( "no test cases matching filter" ) )); bool call_start_finish = !continue_test || !s_frk_impl().m_test_in_progress; bool was_in_progress = s_frk_impl().m_test_in_progress; @@ -397,9 +400,11 @@ try { em.execute( ut_detail::test_start_caller( to, tcc.p_count ) ); } +#ifndef BOOST_NO_EXCEPTIONS catch( execution_exception const& ex ) { - throw setup_error( ex.what() ); + boost::throw_exception(setup_error( ex.what() )); } +#endif } } diff -r 510d5bd079ad boost/test/impl/interaction_based.ipp --- a/boost/test/impl/interaction_based.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/interaction_based.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -31,6 +31,7 @@ #include // for setup_error #include +#include // STL #include @@ -70,7 +71,7 @@ if( reset ) { if( new_ptr ) { if( ptr != &dummy ) - throw unit_test::framework::setup_error( BOOST_TEST_L( "Couldn't run two interation based test the same time" ) ); + boost::throw_exception( unit_test::framework::setup_error( BOOST_TEST_L( "Couldn't run two interation based test the same time" ) )); ptr = new_ptr; } diff -r 510d5bd079ad boost/test/impl/test_tools.ipp --- a/boost/test/impl/test_tools.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/test_tools.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -25,6 +25,7 @@ // Boost #include +#include // STL #include @@ -70,7 +71,7 @@ using namespace unit_test; if( !framework::is_initialized() ) - throw std::runtime_error( "can't use testing tools before framework is initialized" ); + boost::throw_exception(std::runtime_error( "can't use testing tools before framework is initialized" )); if( !!pr ) tl = PASS; @@ -319,7 +320,7 @@ framework::test_unit_aborted( framework::current_test_case() ); - throw execution_aborted(); + boost::throw_exception(execution_aborted()); } } diff -r 510d5bd079ad boost/test/impl/unit_test_main.ipp --- a/boost/test/impl/unit_test_main.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/unit_test_main.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -182,6 +182,7 @@ ? boost::exit_success : results_collector.results( framework::master_test_suite().p_id ).result_code(); } +#ifndef BOOST_NO_EXCEPTIONS catch( framework::internal_error const& ex ) { results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl; @@ -197,6 +198,7 @@ return boost::exit_exception_failure; } +#endif } } // namespace unit_test diff -r 510d5bd079ad boost/test/impl/unit_test_monitor.ipp --- a/boost/test/impl/unit_test_monitor.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/unit_test_monitor.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -68,6 +68,7 @@ execute( callback0( zero_return_wrapper( tc.test_func() ) ) ); } +#ifndef BOOST_NO_EXCEPTIONS catch( execution_exception const& ex ) { framework::exception_caught( ex ); framework::test_unit_aborted( framework::current_test_case() ); @@ -84,6 +85,7 @@ default: return unexpected_exception; } } +#endif return test_ok; } diff -r 510d5bd079ad boost/test/impl/unit_test_suite.ipp --- a/boost/test/impl/unit_test_suite.ipp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/impl/unit_test_suite.ipp Mon Jun 30 18:23:45 2008 -0600 @@ -205,13 +205,15 @@ BOOST_TEST_FOREACH( test_unit_id, id, members ) traverse_test_tree( id, V ); } - - } catch( test_being_aborted const& ) { + } +#ifndef BOOST_NO_EXCEPTIONS + catch( test_being_aborted const& ) { V.test_suite_finish( suite ); framework::test_unit_aborted( suite ); throw; } +#endif V.test_suite_finish( suite ); } diff -r 510d5bd079ad boost/test/interaction_based.hpp --- a/boost/test/interaction_based.hpp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/interaction_based.hpp Mon Jun 30 18:23:45 2008 -0600 @@ -18,6 +18,7 @@ // Boost.Test #include #include +#include #include @@ -210,7 +211,7 @@ if( res ) ::boost::itest::manager::instance().allocated( l.m_file_name, l.m_line_num, res, s ); else - throw std::bad_alloc(); + boost::throw_exception(std::bad_alloc()); return res; } @@ -225,7 +226,7 @@ if( res ) ::boost::itest::manager::instance().allocated( l.m_file_name, l.m_line_num, res, s ); else - throw std::bad_alloc(); + boost::throw_exception(std::bad_alloc()); return res; } diff -r 510d5bd079ad boost/test/minimal.hpp --- a/boost/test/minimal.hpp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/minimal.hpp Mon Jun 30 18:23:45 2008 -0600 @@ -82,7 +82,7 @@ { report_error( msg, file, line, func_name, is_msg ); - throw boost::execution_aborted(); + boost::throw_exception(boost::execution_aborted()); } class caller { @@ -116,6 +116,7 @@ BOOST_CHECK( run_result == 0 || run_result == boost::exit_success ); } +#ifndef BOOST_NO_EXCEPTIONS catch( boost::execution_exception const& exex ) { if( exex.code() != boost::execution_exception::no_error ) BOOST_ERROR( (std::string( "exception \"" ). @@ -123,6 +124,7 @@ append( "\" caught" ) ).c_str() ); std::cerr << "\n**** Testing aborted."; } +#endif if( boost::minimal_test::errors_counter() != 0 ) { std::cerr << "\n**** " << errors_counter() diff -r 510d5bd079ad boost/test/unit_test_suite_impl.hpp --- a/boost/test/unit_test_suite_impl.hpp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/unit_test_suite_impl.hpp Mon Jun 30 18:23:45 2008 -0600 @@ -214,7 +214,7 @@ // ************** test_being_aborted ************** // // ************************************************************************** // -struct BOOST_TEST_DECL test_being_aborted {}; +struct BOOST_TEST_DECL test_being_aborted : public std::exception {}; // ************************************************************************** // // ************** object generators ************** // diff -r 510d5bd079ad boost/test/utils/named_params.hpp --- a/boost/test/utils/named_params.hpp Fri Jun 27 15:59:57 2008 -0600 +++ b/boost/test/utils/named_params.hpp Mon Jun 30 18:23:45 2008 -0600 @@ -18,6 +18,7 @@ // Boost #include #include +#include // Boost.Test #include @@ -46,14 +47,14 @@ // ************** access_to_invalid_parameter ************** // // ************************************************************************** // -struct access_to_invalid_parameter {}; +struct access_to_invalid_parameter : public std::exception {}; //____________________________________________________________________________// inline void report_access_to_invalid_parameter() { - throw access_to_invalid_parameter(); + boost::throw_exception(access_to_invalid_parameter()); } //____________________________________________________________________________//