This commit is contained in:
Emil Dotchevski
2020-12-22 17:26:53 -08:00
parent 083cfbafa3
commit c445901088
26 changed files with 487 additions and 84 deletions

View File

@ -8,13 +8,12 @@
#define BOOST_EXCEPTION_618474C2DE1511DEB74A388C56D89593
#include <boost/config.hpp>
#ifdef BOOST_NO_EXCEPTIONS
#error This header requires exception handling to be enabled.
#endif
#include <boost/exception/exception.hpp>
#include <boost/exception/info.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/detail/clone_current_exception.hpp>
#ifndef BOOST_NO_EXCEPTIONS
# include <boost/exception/detail/clone_current_exception.hpp>
#endif
#include <boost/exception/detail/type_info.hpp>
#ifndef BOOST_NO_RTTI
#include <boost/core/demangle.hpp>
@ -42,15 +41,14 @@ namespace
boost
{
class exception_ptr;
BOOST_NORETURN void rethrow_exception( exception_ptr const & );
exception_ptr current_exception();
namespace exception_detail { void rethrow_exception_( exception_ptr const & ); }
class
exception_ptr
{
typedef boost::shared_ptr<exception_detail::clone_base const> impl;
impl ptr_;
friend void rethrow_exception( exception_ptr const & );
friend void exception_detail::rethrow_exception_( exception_ptr const & );
typedef exception_detail::clone_base const * (impl::*unspecified_bool_type)() const;
public:
exception_ptr()
@ -106,6 +104,7 @@ boost
}
#endif
#ifndef BOOST_NO_EXCEPTIONS
namespace
exception_detail
{
@ -499,34 +498,46 @@ boost
BOOST_ASSERT(ret);
return ret;
}
#endif // ifndef BOOST_NO_EXCEPTIONS
namespace
exception_detail
{
inline
void
rethrow_exception_( exception_ptr const & p )
{
BOOST_ASSERT(p);
#if defined( BOOST_NO_CXX11_HDR_EXCEPTION ) || defined( BOOST_NO_EXCEPTIONS )
p.ptr_->rethrow();
#else
try
{
p.ptr_->rethrow();
}
catch(
std_exception_ptr_wrapper const & wrp)
{
// if an std::exception_ptr was wrapped above then rethrow it
std::rethrow_exception(wrp.p);
}
#endif
}
}
BOOST_NORETURN
inline
void
rethrow_exception( exception_ptr const & p )
{
BOOST_ASSERT(p);
#ifndef BOOST_NO_CXX11_HDR_EXCEPTION
try
{
p.ptr_->rethrow();
}
catch(
exception_detail::std_exception_ptr_wrapper const & wrp)
{
// if an std::exception_ptr was wrapped above then rethrow it
std::rethrow_exception(wrp.p);
}
#else
p.ptr_->rethrow();
#endif
exception_detail::rethrow_exception_(p);
BOOST_ASSERT(0);
#if defined(UNDER_CE)
// some CE platforms don't define ::abort()
exit(-1);
#else
abort();
#endif
#if defined(UNDER_CE)
// some CE platforms don't define ::abort()
exit(-1);
#else
abort();
#endif
}
inline
@ -534,6 +545,9 @@ boost
diagnostic_information( exception_ptr const & p, bool verbose=true )
{
if( p )
#ifdef BOOST_NO_EXCEPTIONS
return "<unavailable> due to BOOST_NO_EXCEPTIONS";
#else
try
{
rethrow_exception(p);
@ -543,6 +557,7 @@ boost
{
return current_exception_diagnostic_information(verbose);
}
#endif
return "<empty>";
}