Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:09:49

0001 //  (C) Copyright Gennadiy Rozental 2001.
0002 //  Distributed under the Boost Software License, Version 1.0.
0003 //  (See accompanying file LICENSE_1_0.txt or copy at
0004 //  http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See http://www.boost.org/libs/test for the library home page.
0007 //
0008 //!@file
0009 //!@brief contains wrappers, which allows to build Boost.Test with no exception
0010 // ***************************************************************************
0011 
0012 #ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
0013 #define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
0014 
0015 // Boost
0016 #include <boost/config.hpp> // BOOST_NO_EXCEPTIONS
0017 
0018 #ifdef BOOST_NO_EXCEPTIONS
0019 // C RUNTIME
0020 #include <stdlib.h>
0021 
0022 #endif
0023 
0024 #include <boost/test/detail/suppress_warnings.hpp>
0025 
0026 //____________________________________________________________________________//
0027 
0028 namespace boost {
0029 namespace unit_test {
0030 namespace ut_detail {
0031 
0032 #ifdef BOOST_NO_EXCEPTIONS
0033 
0034 template<typename E>
0035 BOOST_NORETURN inline void
0036 throw_exception(E const& /*e*/) { abort(); }
0037 
0038 #define BOOST_TEST_I_TRY
0039 #define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;)
0040 #define BOOST_TEST_I_CATCH0( T ) if(0)
0041 #define BOOST_TEST_I_CATCHALL() if(0)
0042 #define BOOST_TEST_I_RETHROW
0043 
0044 #else
0045 
0046 template<typename E>
0047 BOOST_NORETURN inline void
0048 throw_exception(E const& e) { throw e; }
0049 
0050 #define BOOST_TEST_I_TRY try
0051 #define BOOST_TEST_I_CATCH( T, var ) catch( T const& var )
0052 #define BOOST_TEST_I_CATCH0( T ) catch( T const& )
0053 #define BOOST_TEST_I_CATCHALL() catch(...)
0054 #define BOOST_TEST_I_RETHROW throw
0055 #endif
0056 
0057 //____________________________________________________________________________//
0058 
0059 #define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E )
0060 #define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex )
0061 
0062 
0063 } // namespace ut_detail
0064 } // namespace unit_test
0065 } // namespace boost
0066 
0067 //____________________________________________________________________________//
0068 
0069 #include <boost/test/detail/enable_warnings.hpp>
0070 
0071 #endif // BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP