mirror of
https://github.com/boostorg/exception.git
synced 2025-07-18 06:52:06 +02:00
Improved compatibility with various compilers.
[SVN r45087]
This commit is contained in:
@ -6,6 +6,8 @@
|
|||||||
#ifndef UUID_F7D5662CCB0F11DCA353CAC656D89593
|
#ifndef UUID_F7D5662CCB0F11DCA353CAC656D89593
|
||||||
#define UUID_F7D5662CCB0F11DCA353CAC656D89593
|
#define UUID_F7D5662CCB0F11DCA353CAC656D89593
|
||||||
|
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
@ -23,9 +25,8 @@ boost
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||||
virtual //Disable bogus GCC warning.
|
virtual //Disable bogus GCC warning.
|
||||||
//Would someone at GCC finally get the protected, non-virtual destructor approach?
|
|
||||||
#endif
|
#endif
|
||||||
~cloning_base() throw()
|
~cloning_base() throw()
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#ifndef UUID_DBA0D90C930911DCBA7B675A56D89593
|
#ifndef UUID_DBA0D90C930911DCBA7B675A56D89593
|
||||||
#define UUID_DBA0D90C930911DCBA7B675A56D89593
|
#define UUID_DBA0D90C930911DCBA7B675A56D89593
|
||||||
|
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
boost
|
boost
|
||||||
{
|
{
|
||||||
@ -34,9 +36,8 @@ boost
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||||
virtual //Disable bogus GCC warning.
|
virtual //Disable bogus GCC warning.
|
||||||
//Would someone at GCC finally get the protected, non-virtual destructor approach?
|
|
||||||
#endif
|
#endif
|
||||||
~counted_base() throw()
|
~counted_base() throw()
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/exception/detail/counted_base.hpp>
|
#include <boost/exception/detail/counted_base.hpp>
|
||||||
#include <boost/intrusive_ptr.hpp>
|
#include <boost/intrusive_ptr.hpp>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
@ -45,8 +47,46 @@ boost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~exception() throw()=0;
|
virtual
|
||||||
virtual char const * what() const throw();
|
char const *
|
||||||
|
what() const throw()
|
||||||
|
{
|
||||||
|
if( data_ )
|
||||||
|
try
|
||||||
|
{
|
||||||
|
char const * w = data_->what(typeid(*this));
|
||||||
|
BOOST_ASSERT(0!=w);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return typeid(*this).name();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
exception()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
exception( exception const & e ):
|
||||||
|
data_(e.data_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) )
|
||||||
|
//Force class exception to be abstract.
|
||||||
|
//Otherwise, MSVC bug allows throw exception(), even though the copy constructor is protected.
|
||||||
|
virtual ~exception() throw()=0;
|
||||||
|
#else
|
||||||
|
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||||
|
virtual //Disable bogus GCC warning.
|
||||||
|
#endif
|
||||||
|
~exception() throw()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -62,29 +102,13 @@ boost
|
|||||||
intrusive_ptr<exception_detail::error_info_container> mutable data_;
|
intrusive_ptr<exception_detail::error_info_container> mutable data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
#if BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1500) ) //See above.
|
||||||
exception::
|
inline
|
||||||
~exception() throw()
|
exception::
|
||||||
{
|
~exception() throw()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
inline
|
#endif
|
||||||
char const *
|
}
|
||||||
exception::
|
|
||||||
what() const throw()
|
|
||||||
{
|
|
||||||
if( data_ )
|
|
||||||
try
|
|
||||||
{
|
|
||||||
char const * w = data_->what(typeid(*this));
|
|
||||||
BOOST_ASSERT(0!=w);
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
return typeid(*this).name();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,9 +39,8 @@ boost
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT(4) )
|
||||||
virtual //Disable bogus GCC warning.
|
virtual //Disable bogus GCC warning.
|
||||||
//Would someone at GCC finally get the protected, non-virtual destructor approach?
|
|
||||||
#endif
|
#endif
|
||||||
~error_info_base()
|
~error_info_base()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user