mirror of
https://github.com/boostorg/exception.git
synced 2025-07-23 00:57:14 +02:00
Simplified type_info support due to improvements in boost/detail/sp_typeinfo.hpp. A few tweaks to better deal with warnings.
[SVN r58132]
This commit is contained in:
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||
#define UUID_316FDA946C0D11DEA9CBAE5255D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/error_info.hpp>
|
||||
@ -28,4 +30,7 @@
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_7E83C166200811DE885E826156D89593
|
||||
#define UUID_7E83C166200811DE885E826156D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
boost
|
||||
@ -35,4 +37,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_CE6983AC753411DDA764247956D89593
|
||||
#define UUID_CE6983AC753411DDA764247956D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -34,10 +36,6 @@ boost
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
template <class Tag,class T>
|
||||
class
|
||||
error_info:
|
||||
@ -69,9 +67,9 @@ boost
|
||||
|
||||
value_type value_;
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_618474C2DE1511DEB74A388C56D89593
|
||||
#define UUID_618474C2DE1511DEB74A388C56D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
@ -482,4 +484,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_898984B4076411DD973EDFA055D89593
|
||||
#define UUID_898984B4076411DD973EDFA055D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <ostream>
|
||||
|
||||
@ -39,4 +41,7 @@ boost
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||
#define UUID_6F463AC838DF11DDA3E6909F56D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <iomanip>
|
||||
@ -42,4 +44,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_C3E1741C754311DDB2834CCA55D89593
|
||||
#define UUID_C3E1741C754311DDB2834CCA55D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
@ -44,92 +46,34 @@ boost
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
struct
|
||||
type_info_
|
||||
{
|
||||
detail::sp_typeinfo const * type_;
|
||||
char const * name_;
|
||||
|
||||
explicit
|
||||
type_info_( detail::sp_typeinfo const & type, char const * name ):
|
||||
type_(&type),
|
||||
name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
friend
|
||||
bool
|
||||
operator==( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
return (*a.type_)==(*b.type_);
|
||||
}
|
||||
|
||||
friend
|
||||
bool
|
||||
operator<( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
return 0!=(a.type_->before(*b.type_));
|
||||
}
|
||||
|
||||
char const *
|
||||
name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
};
|
||||
#else
|
||||
struct
|
||||
type_info_
|
||||
{
|
||||
detail::sp_typeinfo const * type_;
|
||||
detail::sp_typeinfo const & type_;
|
||||
|
||||
explicit
|
||||
type_info_( detail::sp_typeinfo const & type ):
|
||||
type_(&type)
|
||||
type_(type)
|
||||
{
|
||||
}
|
||||
|
||||
type_info_( detail::sp_typeinfo const & type, char const * ):
|
||||
type_(&type)
|
||||
{
|
||||
}
|
||||
|
||||
friend
|
||||
bool
|
||||
operator==( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
return (*a.type_)==(*b.type_);
|
||||
}
|
||||
|
||||
friend
|
||||
bool
|
||||
operator<( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
return 0!=(a.type_->before(*b.type_));
|
||||
}
|
||||
|
||||
char const *
|
||||
name() const
|
||||
{
|
||||
return type_->name();
|
||||
return 0!=(a.type_.before(b.type_));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
inline
|
||||
bool
|
||||
operator!=( type_info_ const & a, type_info_ const & b )
|
||||
{
|
||||
return !(a==b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T),::boost::tag_type_name<T>())
|
||||
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
|
||||
|
||||
#ifndef BOOST_NO_RTTI
|
||||
#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_0552D49838DD11DD90146B8956D89593
|
||||
#define UUID_0552D49838DD11DD90146B8956D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
@ -49,27 +51,33 @@ boost
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
struct
|
||||
is_convertible_to_boost_exception
|
||||
inline
|
||||
exception const *
|
||||
get_boost_exception( exception const * e )
|
||||
{
|
||||
struct yes { char q[100]; };
|
||||
typedef char no;
|
||||
static yes check(exception const *);
|
||||
static no check(...);
|
||||
enum e { value=sizeof(check((T*)0))==sizeof(yes) };
|
||||
};
|
||||
return e;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
is_convertible_to_std_exception
|
||||
inline
|
||||
exception const *
|
||||
get_boost_exception( ... )
|
||||
{
|
||||
struct yes { char q[100]; };
|
||||
typedef char no;
|
||||
static yes check(std::exception const *);
|
||||
static no check(...);
|
||||
enum e { value = sizeof(check((T*)0))==sizeof(yes) };
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline
|
||||
std::exception const *
|
||||
get_std_exception( std::exception const * e )
|
||||
{
|
||||
return e;
|
||||
}
|
||||
|
||||
inline
|
||||
std::exception const *
|
||||
get_std_exception( ... )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline
|
||||
char const *
|
||||
@ -127,7 +135,7 @@ boost
|
||||
}
|
||||
#ifndef BOOST_NO_RTTI
|
||||
tmp << std::string("Dynamic exception type: ") <<
|
||||
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
|
||||
(be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name() << '\n';
|
||||
#endif
|
||||
if( with_what && se )
|
||||
tmp << "std::exception::what: " << wh << '\n';
|
||||
@ -143,9 +151,7 @@ boost
|
||||
std::string
|
||||
diagnostic_information( T const & e )
|
||||
{
|
||||
boost::exception const * be=exception_detail::is_convertible_to_boost_exception<T>::value?((boost::exception const *)&e):0;
|
||||
std::exception const * se=exception_detail::is_convertible_to_std_exception<T>::value?((std::exception const *)&e):0;
|
||||
return exception_detail::diagnostic_information_impl(be,se,true);
|
||||
return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true);
|
||||
}
|
||||
|
||||
inline
|
||||
@ -170,4 +176,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,20 +5,17 @@
|
||||
|
||||
#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||
#define UUID_F0EE17BE6C1211DE87FF459155D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include "boost/exception/info.hpp"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996) //'strerror': This function or variable may be unsafe
|
||||
#endif
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
@ -41,8 +38,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
boost
|
||||
@ -370,10 +372,6 @@ boost
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
template <class T>
|
||||
class
|
||||
clone_impl:
|
||||
@ -407,9 +405,6 @@ boost
|
||||
throw*this;
|
||||
}
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@ -421,4 +416,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_1A590226753311DD9E4CCF6156D89593
|
||||
#define UUID_1A590226753311DD9E4CCF6156D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/detail/error_info_impl.hpp>
|
||||
@ -122,4 +124,7 @@ boost
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||
#define UUID_8D22C4CA9CC811DCAA9133D256D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/to_string_stub.hpp>
|
||||
@ -95,7 +97,7 @@ boost
|
||||
{
|
||||
shared_ptr<error_info_base> const & p = i->second;
|
||||
#ifndef BOOST_NO_RTTI
|
||||
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
|
||||
BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
|
||||
#endif
|
||||
return p;
|
||||
}
|
||||
@ -159,4 +161,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_63EE924290FB11DC87BB856555D89593
|
||||
#define UUID_63EE924290FB11DC87BB856555D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
@ -68,4 +70,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_7E48761AD92811DC9011477D56D89593
|
||||
#define UUID_7E48761AD92811DC9011477D56D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/exception/detail/is_output_streamable.hpp>
|
||||
@ -75,4 +77,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
#ifndef UUID_E788439ED9F011DCB181F25B55D89593
|
||||
#define UUID_E788439ED9F011DCB181F25B55D89593
|
||||
|
||||
#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/to_string.hpp>
|
||||
#include <boost/exception/detail/object_hex_dump.hpp>
|
||||
@ -101,4 +103,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user