123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef BHO_THROW_EXCEPTION_HPP_INCLUDED
- #define BHO_THROW_EXCEPTION_HPP_INCLUDED
- #if defined(_MSC_VER) && (_MSC_VER >= 1020)
- # pragma once
- #endif
- #include <asio2/bho/assert/source_location.hpp>
- #include <asio2/bho/config.hpp>
- #include <asio2/bho/config/workaround.hpp>
- #include <exception>
- #include <utility>
- #include <cstddef>
- #if !defined(BHO_NO_CXX11_HDR_TYPE_TRAITS)
- #include <type_traits>
- #endif
- #if !defined( BHO_EXCEPTION_DISABLE ) && defined( BHO_BORLANDC ) && BHO_WORKAROUND( BHO_BORLANDC, BHO_TESTED_AT(0x593) )
- # define BHO_EXCEPTION_DISABLE
- #endif
- namespace bho
- {
- #if defined( BHO_NO_EXCEPTIONS )
- BHO_NORETURN void throw_exception( std::exception const & e );
- BHO_NORETURN void throw_exception( std::exception const & e, bho::source_location const & loc );
- #endif
- inline void throw_exception_assert_compatibility( std::exception const & ) {}
- #if !defined( BHO_NO_EXCEPTIONS )
- #if defined( BHO_EXCEPTION_DISABLE )
- template<class E> BHO_NORETURN void throw_exception( E const & e )
- {
- throw_exception_assert_compatibility( e );
- throw e;
- }
- template<class E> BHO_NORETURN void throw_exception( E const & e, bho::source_location const & )
- {
- throw_exception_assert_compatibility( e );
- throw e;
- }
- #else
- template<class E> BHO_NORETURN void throw_exception( E const & e )
- {
- throw_exception_assert_compatibility( e );
- throw e;
- }
- template<class E> BHO_NORETURN void throw_exception( E const & e, bho::source_location const & loc )
- {
- throw_exception_assert_compatibility( e );
- ((void)loc); throw e;
- }
- #endif
- #endif
- }
- #define BHO_THROW_EXCEPTION(x) ::bho::throw_exception(x, BHO_CURRENT_LOCATION)
- #endif
|