mirror of
https://github.com/boostorg/exception.git
synced 2025-07-05 08:46:36 +02:00
Compare commits
1 Commits
boost-1.64
...
boost-1.55
Author | SHA1 | Date | |
---|---|---|---|
544d197957 |
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
||||
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>%s</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="body-0">
|
||||
<div class="body-1">
|
||||
<div class="body-2">
|
||||
<div>
|
||||
<div id="boost_logo">
|
||||
<a href="http://www.boost.org"><img style="border:0" src="../../../boost.png" alt="Boost" width="277" height="86"/></a>
|
||||
</div>
|
||||
<h1>Boost Exception</h1>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
@ -1,16 +0,0 @@
|
||||
<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div id="footer">
|
||||
<p>
|
||||
<a class="logo" href="http://jigsaw.w3.org/css-validator/check/referer"><img class="logo_pic" src="valid-css.png" alt="Valid CSS" height="31" width="88"/></a>
|
||||
<a class="logo" href="http://validator.w3.org/check?uri=referer"><img class="logo_pic" src="valid-xhtml.png" alt="Valid XHTML 1.0" height="31" width="88"/></a>
|
||||
<small>Copyright (c) 2006-2009 by Emil Dotchevski and Reverge Studios, Inc.<br/>
|
||||
Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,46 +0,0 @@
|
||||
//Copyright (c) 2006-2013 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_9011016A11A711E3B46CD9FA6088709B
|
||||
#define UUID_9011016A11A711E3B46CD9FA6088709B
|
||||
#if (__GNUC__*100+__GNUC_MINOR__>301) && !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/exception/get_error_info.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
//Here we're using the boost::error_info machinery to store the info in the exception
|
||||
//object. Within the context of N3757, this is strictly an implementation detail.
|
||||
|
||||
template <class Tag>
|
||||
inline
|
||||
void
|
||||
exception::
|
||||
set( typename Tag::type const & v )
|
||||
{
|
||||
exception_detail::set_info(*this,error_info<Tag,typename Tag::type>(v));
|
||||
}
|
||||
|
||||
template <class Tag>
|
||||
inline
|
||||
typename Tag::type const *
|
||||
exception::
|
||||
get() const
|
||||
{
|
||||
return get_error_info<error_info<Tag,typename Tag::type> >(*this);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
17
include/boost/exception/detail/attribute_noreturn.hpp
Normal file
17
include/boost/exception/detail/attribute_noreturn.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
//Copyright (c) 2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_61531AB0680611DEADD5846855D89593
|
||||
#define UUID_61531AB0680611DEADD5846855D89593
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
|
||||
#elif defined(__GNUC__)
|
||||
#define BOOST_ATTRIBUTE_NORETURN __attribute__((__noreturn__))
|
||||
#else
|
||||
#define BOOST_ATTRIBUTE_NORETURN
|
||||
#endif
|
||||
|
||||
#endif
|
@ -12,8 +12,6 @@
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
@ -48,11 +46,6 @@ boost
|
||||
typedef T value_type;
|
||||
|
||||
error_info( value_type const & value );
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
error_info( error_info const & );
|
||||
error_info( value_type && value ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(value))));
|
||||
error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.value_))));
|
||||
#endif
|
||||
~error_info() throw();
|
||||
|
||||
value_type const &
|
||||
@ -68,10 +61,6 @@ boost
|
||||
}
|
||||
|
||||
private:
|
||||
error_info & operator=( error_info const & );
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
error_info & operator=( error_info && x );
|
||||
#endif
|
||||
|
||||
std::string name_value_string() const;
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <boost/exception/detail/clone_current_exception.hpp>
|
||||
#ifndef BOOST_NO_RTTI
|
||||
#include <boost/core/demangle.hpp>
|
||||
#endif
|
||||
//#ifndef BOOST_NO_RTTI
|
||||
//#include <boost/units/detail/utility.hpp>
|
||||
//#endif
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdexcept>
|
||||
#include <new>
|
||||
@ -34,7 +34,7 @@ namespace
|
||||
boost
|
||||
{
|
||||
class exception_ptr;
|
||||
BOOST_NORETURN void rethrow_exception( exception_ptr const & );
|
||||
BOOST_ATTRIBUTE_NORETURN void rethrow_exception( exception_ptr const & );
|
||||
exception_ptr current_exception();
|
||||
|
||||
class
|
||||
@ -92,7 +92,7 @@ boost
|
||||
std::string
|
||||
to_string( original_exception_type const & x )
|
||||
{
|
||||
return core::demangle(x.value()->name());
|
||||
return /*units::detail::demangle*/(x.value()->name());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -454,7 +454,7 @@ boost
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOST_NORETURN
|
||||
BOOST_ATTRIBUTE_NORETURN
|
||||
inline
|
||||
void
|
||||
rethrow_exception( exception_ptr const & p )
|
||||
|
@ -1,17 +0,0 @@
|
||||
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_837060E885AF11E68DA91D15E31AC075
|
||||
#define UUID_837060E885AF11E68DA91D15E31AC075
|
||||
|
||||
#ifdef BOOST_EXCEPTION_MINI_BOOST
|
||||
#include <memory>
|
||||
namespace boost { namespace exception_detail { using std::shared_ptr; } }
|
||||
#else
|
||||
#include <boost/shared_ptr.hpp>
|
||||
namespace boost { namespace exception_detail { using boost::shared_ptr; } }
|
||||
#endif
|
||||
|
||||
#endif
|
@ -12,10 +12,12 @@
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/core/typeinfo.hpp>
|
||||
#include <boost/core/demangle.hpp>
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/config.hpp>
|
||||
//#ifndef BOOST_NO_TYPEID
|
||||
//#include <boost/units/detail/utility.hpp>
|
||||
//#endif
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
@ -29,7 +31,7 @@ boost
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
return BOOST_CURRENT_FUNCTION;
|
||||
#else
|
||||
return core::demangle(typeid(T*).name());
|
||||
return /*units::detail::demangle*/(typeid(T*).name());
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -41,7 +43,7 @@ boost
|
||||
#ifdef BOOST_NO_TYPEID
|
||||
return BOOST_CURRENT_FUNCTION;
|
||||
#else
|
||||
return core::demangle(typeid(T).name());
|
||||
return /*units::detail::demangle*/(typeid(T).name());
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -51,10 +53,10 @@ boost
|
||||
struct
|
||||
type_info_
|
||||
{
|
||||
core::typeinfo const * type_;
|
||||
detail::sp_typeinfo const * type_;
|
||||
|
||||
explicit
|
||||
type_info_( core::typeinfo const & type ):
|
||||
type_info_( detail::sp_typeinfo const & type ):
|
||||
type_(&type)
|
||||
{
|
||||
}
|
||||
@ -69,7 +71,7 @@ boost
|
||||
}
|
||||
}
|
||||
|
||||
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_CORE_TYPEID(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))
|
||||
|
@ -16,9 +16,9 @@
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#ifndef BOOST_NO_RTTI
|
||||
#include <boost/core/demangle.hpp>
|
||||
#endif
|
||||
//#ifndef BOOST_NO_RTTI
|
||||
//#include <boost/units/detail/utility.hpp>
|
||||
//#endif
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@ -151,7 +151,7 @@ boost
|
||||
#ifndef BOOST_NO_RTTI
|
||||
if ( verbose )
|
||||
tmp << std::string("Dynamic exception type: ") <<
|
||||
core::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n';
|
||||
/*units::detail::demangle*/((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n';
|
||||
#endif
|
||||
if( with_what && se && verbose )
|
||||
tmp << "std::exception::what: " << wh << '\n';
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef UUID_DDFBB4546C1211DEA4659E9055D89593
|
||||
#define UUID_DDFBB4546C1211DEA4659E9055D89593
|
||||
|
||||
#include <boost/exception/error_info.hpp>
|
||||
#include "boost/exception/error_info.hpp"
|
||||
|
||||
namespace
|
||||
boost
|
||||
|
@ -10,10 +10,9 @@
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
#include "boost/exception/info.hpp"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -34,7 +33,7 @@ boost
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
int v=e.value();
|
||||
tmp << '[' << error_info_name(e) << "] = " << v << ", \"" << strerror(v) << "\"\n";
|
||||
tmp << v << ", \"" << strerror(v) << "\"";
|
||||
return tmp.str();
|
||||
}
|
||||
}
|
||||
|
483
include/boost/exception/exception.hpp
Normal file
483
include/boost/exception/exception.hpp
Normal file
@ -0,0 +1,483 @@
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
#if (__GNUC__*100+__GNUC_MINOR__>301) && !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
|
||||
{
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
class
|
||||
refcount_ptr
|
||||
{
|
||||
public:
|
||||
|
||||
refcount_ptr():
|
||||
px_(0)
|
||||
{
|
||||
}
|
||||
|
||||
~refcount_ptr()
|
||||
{
|
||||
release();
|
||||
}
|
||||
|
||||
refcount_ptr( refcount_ptr const & x ):
|
||||
px_(x.px_)
|
||||
{
|
||||
add_ref();
|
||||
}
|
||||
|
||||
refcount_ptr &
|
||||
operator=( refcount_ptr const & x )
|
||||
{
|
||||
adopt(x.px_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
adopt( T * px )
|
||||
{
|
||||
release();
|
||||
px_=px;
|
||||
add_ref();
|
||||
}
|
||||
|
||||
T *
|
||||
get() const
|
||||
{
|
||||
return px_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
T * px_;
|
||||
|
||||
void
|
||||
add_ref()
|
||||
{
|
||||
if( px_ )
|
||||
px_->add_ref();
|
||||
}
|
||||
|
||||
void
|
||||
release()
|
||||
{
|
||||
if( px_ && px_->release() )
|
||||
px_=0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class Tag,class T>
|
||||
class error_info;
|
||||
|
||||
typedef error_info<struct throw_function_,char const *> throw_function;
|
||||
typedef error_info<struct throw_file_,char const *> throw_file;
|
||||
typedef error_info<struct throw_line_,int> throw_line;
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<throw_function_,char const *>
|
||||
{
|
||||
public:
|
||||
typedef char const * value_type;
|
||||
value_type v_;
|
||||
explicit
|
||||
error_info( value_type v ):
|
||||
v_(v)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<throw_file_,char const *>
|
||||
{
|
||||
public:
|
||||
typedef char const * value_type;
|
||||
value_type v_;
|
||||
explicit
|
||||
error_info( value_type v ):
|
||||
v_(v)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class
|
||||
error_info<throw_line_,int>
|
||||
{
|
||||
public:
|
||||
typedef int value_type;
|
||||
value_type v_;
|
||||
explicit
|
||||
error_info( value_type v ):
|
||||
v_(v)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class exception;
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
class shared_ptr;
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
class error_info_base;
|
||||
struct type_info_;
|
||||
|
||||
struct
|
||||
error_info_container
|
||||
{
|
||||
virtual char const * diagnostic_information( char const * ) const = 0;
|
||||
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
|
||||
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
|
||||
virtual void add_ref() const = 0;
|
||||
virtual bool release() const = 0;
|
||||
virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
~error_info_container() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class>
|
||||
struct get_info;
|
||||
|
||||
template <>
|
||||
struct get_info<throw_function>;
|
||||
|
||||
template <>
|
||||
struct get_info<throw_file>;
|
||||
|
||||
template <>
|
||||
struct get_info<throw_line>;
|
||||
|
||||
char const * get_diagnostic_information( exception const &, char const * );
|
||||
|
||||
void copy_boost_exception( exception *, exception const * );
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
E const & set_info( E const &, error_info<Tag,T> const & );
|
||||
|
||||
template <class E>
|
||||
E const & set_info( E const &, throw_function const & );
|
||||
|
||||
template <class E>
|
||||
E const & set_info( E const &, throw_file const & );
|
||||
|
||||
template <class E>
|
||||
E const & set_info( E const &, throw_line const & );
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
exception
|
||||
{
|
||||
protected:
|
||||
|
||||
exception():
|
||||
throw_function_(0),
|
||||
throw_file_(0),
|
||||
throw_line_(-1)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef __HP_aCC
|
||||
//On HP aCC, this protected copy constructor prevents throwing boost::exception.
|
||||
//On all other platforms, the same effect is achieved by the pure virtual destructor.
|
||||
exception( exception const & x ) throw():
|
||||
data_(x.data_),
|
||||
throw_function_(x.throw_function_),
|
||||
throw_file_(x.throw_file_),
|
||||
throw_line_(x.throw_line_)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~exception() throw()
|
||||
#ifndef __HP_aCC
|
||||
= 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.
|
||||
#endif
|
||||
;
|
||||
|
||||
#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
|
||||
public:
|
||||
#else
|
||||
private:
|
||||
|
||||
template <class E>
|
||||
friend E const & exception_detail::set_info( E const &, throw_function const & );
|
||||
|
||||
template <class E>
|
||||
friend E const & exception_detail::set_info( E const &, throw_file const & );
|
||||
|
||||
template <class E>
|
||||
friend E const & exception_detail::set_info( E const &, throw_line const & );
|
||||
|
||||
template <class E,class Tag,class T>
|
||||
friend E const & exception_detail::set_info( E const &, error_info<Tag,T> const & );
|
||||
|
||||
friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
|
||||
|
||||
template <class>
|
||||
friend struct exception_detail::get_info;
|
||||
friend struct exception_detail::get_info<throw_function>;
|
||||
friend struct exception_detail::get_info<throw_file>;
|
||||
friend struct exception_detail::get_info<throw_line>;
|
||||
friend void exception_detail::copy_boost_exception( exception *, exception const * );
|
||||
#endif
|
||||
mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
|
||||
mutable char const * throw_function_;
|
||||
mutable char const * throw_file_;
|
||||
mutable int throw_line_;
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
inline
|
||||
exception::
|
||||
~exception() throw()
|
||||
{
|
||||
}
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class E>
|
||||
E const &
|
||||
set_info( E const & x, throw_function const & y )
|
||||
{
|
||||
x.throw_function_=y.v_;
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class E>
|
||||
E const &
|
||||
set_info( E const & x, throw_file const & y )
|
||||
{
|
||||
x.throw_file_=y.v_;
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class E>
|
||||
E const &
|
||||
set_info( E const & x, throw_line const & y )
|
||||
{
|
||||
x.throw_line_=y.v_;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
template <class T>
|
||||
struct
|
||||
error_info_injector:
|
||||
public T,
|
||||
public exception
|
||||
{
|
||||
explicit
|
||||
error_info_injector( T const & x ):
|
||||
T(x)
|
||||
{
|
||||
}
|
||||
|
||||
~error_info_injector() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct large_size { char c[256]; };
|
||||
large_size dispatch_boost_exception( exception const * );
|
||||
|
||||
struct small_size { };
|
||||
small_size dispatch_boost_exception( void const * );
|
||||
|
||||
template <class,int>
|
||||
struct enable_error_info_helper;
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_helper<T,sizeof(large_size)>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_helper<T,sizeof(small_size)>
|
||||
{
|
||||
typedef error_info_injector<T> type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
enable_error_info_return_type
|
||||
{
|
||||
typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception(static_cast<T *>(0)))>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
typename
|
||||
exception_detail::enable_error_info_return_type<T>::type
|
||||
enable_error_info( T const & x )
|
||||
{
|
||||
typedef typename exception_detail::enable_error_info_return_type<T>::type rt;
|
||||
return rt(x);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
clone_base
|
||||
{
|
||||
public:
|
||||
|
||||
virtual clone_base const * clone() const = 0;
|
||||
virtual void rethrow() const = 0;
|
||||
|
||||
virtual
|
||||
~clone_base() throw()
|
||||
{
|
||||
}
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
inline
|
||||
void
|
||||
copy_boost_exception( exception * a, exception const * b )
|
||||
{
|
||||
refcount_ptr<error_info_container> data;
|
||||
if( error_info_container * d=b->data_.get() )
|
||||
data = d->clone();
|
||||
a->throw_file_ = b->throw_file_;
|
||||
a->throw_line_ = b->throw_line_;
|
||||
a->throw_function_ = b->throw_function_;
|
||||
a->data_ = data;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
copy_boost_exception( void *, void const * )
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class
|
||||
clone_impl:
|
||||
public T,
|
||||
public virtual clone_base
|
||||
{
|
||||
struct clone_tag { };
|
||||
clone_impl( clone_impl const & x, clone_tag ):
|
||||
T(x)
|
||||
{
|
||||
copy_boost_exception(this,&x);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit
|
||||
clone_impl( T const & x ):
|
||||
T(x)
|
||||
{
|
||||
copy_boost_exception(this,&x);
|
||||
}
|
||||
|
||||
~clone_impl() throw()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
clone_base const *
|
||||
clone() const
|
||||
{
|
||||
return new clone_impl(*this,clone_tag());
|
||||
}
|
||||
|
||||
void
|
||||
rethrow() const
|
||||
{
|
||||
throw*this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
exception_detail::clone_impl<T>
|
||||
enable_current_exception( T const & x )
|
||||
{
|
||||
return exception_detail::clone_impl<T>(x);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -15,8 +15,7 @@
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/detail/error_info_impl.hpp>
|
||||
#include <boost/exception/detail/type_info.hpp>
|
||||
#include <boost/exception/detail/shared_ptr.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/to_string_stub.hpp>
|
||||
#include <boost/exception/detail/error_info_impl.hpp>
|
||||
#include <boost/exception/detail/shared_ptr.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <map>
|
||||
|
||||
@ -46,30 +46,6 @@ boost
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
error_info<Tag,T>::
|
||||
error_info( error_info const & x ):
|
||||
value_(x.value_)
|
||||
{
|
||||
}
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
error_info<Tag,T>::
|
||||
error_info( value_type && value ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(value)))):
|
||||
value_(std::move(value))
|
||||
{
|
||||
}
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
error_info<Tag,T>::
|
||||
error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.value_)))):
|
||||
value_(std::move(x.value_))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class Tag,class T>
|
||||
inline
|
||||
error_info<Tag,T>::
|
||||
@ -199,85 +175,6 @@ boost
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class E,class Tag,class T>
|
||||
E const & set_info( E const &, error_info<Tag,T> && );
|
||||
template <class T>
|
||||
struct set_info_rv;
|
||||
template <class Tag,class T>
|
||||
struct
|
||||
set_info_rv<error_info<Tag,T> >
|
||||
{
|
||||
template <class E,class Tag1,class T1>
|
||||
friend E const & set_info( E const &, error_info<Tag1,T1> && );
|
||||
template <class E>
|
||||
static
|
||||
E const &
|
||||
set( E const & x, error_info<Tag,T> && v )
|
||||
{
|
||||
typedef error_info<Tag,T> error_info_tag_t;
|
||||
shared_ptr<error_info_tag_t> p( new error_info_tag_t(std::move(v)) );
|
||||
exception_detail::error_info_container * c=x.data_.get();
|
||||
if( !c )
|
||||
x.data_.adopt(c=new exception_detail::error_info_container_impl);
|
||||
c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
|
||||
return x;
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct
|
||||
set_info_rv<throw_function>
|
||||
{
|
||||
template <class E,class Tag1,class T1>
|
||||
friend E const & set_info( E const &, error_info<Tag1,T1> && );
|
||||
template <class E>
|
||||
static
|
||||
E const &
|
||||
set( E const & x, throw_function && y )
|
||||
{
|
||||
x.throw_function_=y.v_;
|
||||
return x;
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct
|
||||
set_info_rv<throw_file>
|
||||
{
|
||||
template <class E,class Tag1,class T1>
|
||||
friend E const & set_info( E const &, error_info<Tag1,T1> && );
|
||||
template <class E>
|
||||
static
|
||||
E const &
|
||||
set( E const & x, throw_file && y )
|
||||
{
|
||||
x.throw_file_=y.v_;
|
||||
return x;
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct
|
||||
set_info_rv<throw_line>
|
||||
{
|
||||
template <class E,class Tag1,class T1>
|
||||
friend E const & set_info( E const &, error_info<Tag1,T1> && );
|
||||
template <class E>
|
||||
static
|
||||
E const &
|
||||
set( E const & x, throw_line && y )
|
||||
{
|
||||
x.throw_line_=y.v_;
|
||||
return x;
|
||||
}
|
||||
};
|
||||
template <class E,class Tag,class T>
|
||||
inline
|
||||
E const &
|
||||
set_info( E const & x, error_info<Tag,T> && v )
|
||||
{
|
||||
return set_info_rv<error_info<Tag,T> >::template set<E>(x,std::move(v));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
derives_boost_exception
|
||||
@ -293,16 +190,6 @@ boost
|
||||
{
|
||||
return exception_detail::set_info(x,v);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class E,class Tag,class T>
|
||||
inline
|
||||
typename enable_if<exception_detail::derives_boost_exception<E>,E const &>::type
|
||||
operator<<( E const & x, error_info<Tag,T> && v )
|
||||
{
|
||||
return exception_detail::set_info(x,std::move(v));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
|
103
include/boost/throw_exception.hpp
Normal file
103
include/boost/throw_exception.hpp
Normal file
@ -0,0 +1,103 @@
|
||||
#ifndef UUID_AA15E74A856F11E08B8D93F24824019B
|
||||
#define UUID_AA15E74A856F11E08B8D93F24824019B
|
||||
#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/throw_exception.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2008-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// http://www.boost.org/libs/utility/throw_exception.html
|
||||
//
|
||||
|
||||
#include <boost/exception/detail/attribute_noreturn.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <exception>
|
||||
|
||||
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
|
||||
# define BOOST_EXCEPTION_DISABLE
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 )
|
||||
# define BOOST_EXCEPTION_DISABLE
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_EXCEPTION_DISABLE )
|
||||
# include <boost/exception/exception.hpp>
|
||||
#if !defined(BOOST_THROW_EXCEPTION_CURRENT_FUNCTION)
|
||||
# include <boost/current_function.hpp>
|
||||
# define BOOST_THROW_EXCEPTION_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION
|
||||
#endif
|
||||
# define BOOST_THROW_EXCEPTION(x) ::boost::exception_detail::throw_exception_(x,BOOST_THROW_EXCEPTION_CURRENT_FUNCTION,__FILE__,__LINE__)
|
||||
#else
|
||||
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
void throw_exception( std::exception const & e ); // user defined
|
||||
|
||||
#else
|
||||
|
||||
inline void throw_exception_assert_compatibility( std::exception const & ) { }
|
||||
|
||||
template<class E> BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const & e )
|
||||
{
|
||||
//All boost exceptions are required to derive from std::exception,
|
||||
//to ensure compatibility with BOOST_NO_EXCEPTIONS.
|
||||
throw_exception_assert_compatibility(e);
|
||||
|
||||
#ifndef BOOST_EXCEPTION_DISABLE
|
||||
throw enable_current_exception(enable_error_info(e));
|
||||
#else
|
||||
throw e;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_EXCEPTION_DISABLE )
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class E>
|
||||
BOOST_ATTRIBUTE_NORETURN
|
||||
void
|
||||
throw_exception_( E const & x, char const * current_function, char const * file, int line )
|
||||
{
|
||||
boost::throw_exception(
|
||||
set_info(
|
||||
set_info(
|
||||
set_info(
|
||||
enable_error_info(x),
|
||||
throw_function(current_function)),
|
||||
throw_file(file)),
|
||||
throw_line(line)));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // namespace boost
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"key": "exception",
|
||||
"name": "Exception",
|
||||
"authors": [
|
||||
"Emil Dotchevski"
|
||||
],
|
||||
"description": "The Boost Exception library supports transporting of arbitrary data in exception objects, and transporting of exceptions between threads.",
|
||||
"documentation": "doc/boost-exception.html",
|
||||
"category": [
|
||||
"Emulation"
|
||||
],
|
||||
"maintainers": [
|
||||
"Emil Dotchevski <emil -at- revergestudios.com>"
|
||||
]
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
# Boost Exception Library test Jamfile
|
||||
#
|
||||
# Copyright (c) 2006-2013 Emil Dotchevski and Reverge Studios, Inc.
|
||||
# Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -34,10 +34,7 @@ run exception_test.cpp ;
|
||||
run enable_error_info_test.cpp helper1.cpp ;
|
||||
run throw_exception_test.cpp helper2.cpp ;
|
||||
run errno_test.cpp ;
|
||||
run error_info_lv_test.cpp ;
|
||||
run error_info_lv_const_test.cpp ;
|
||||
run error_info_rv_test.cpp ;
|
||||
run error_info_rv_const_test.cpp ;
|
||||
run error_info_test.cpp ;
|
||||
run diagnostic_information_test.cpp ;
|
||||
run refcount_ptr_test.cpp ;
|
||||
run current_exception_cast_test.cpp ;
|
||||
@ -45,7 +42,6 @@ run no_exceptions_test.cpp : : : <exception-handling>off ;
|
||||
run errinfos_test.cpp ;
|
||||
run exception_ptr_test.cpp/<define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ../../thread/src/tss_null.cpp /boost/exception /boost//thread : : : <threading>multi : non_intrusive_exception_ptr_test ;
|
||||
run exception_ptr_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : <threading>multi ;
|
||||
run N3757_test.cpp ;
|
||||
|
||||
compile-fail exception_fail.cpp ;
|
||||
compile-fail throw_exception_fail.cpp ;
|
||||
|
@ -1,67 +0,0 @@
|
||||
//Copyright (c) 2006-2013 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
//This file tests the N3757 syntax for adding error info to std::exception, which is
|
||||
//different from the syntax used by Boost Exception.
|
||||
|
||||
#include <boost/exception/N3757.hpp>
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <ostream>
|
||||
|
||||
struct tag1 { typedef int type; };
|
||||
struct tag2 { typedef std::string type; };
|
||||
struct tag3 { typedef int type; };
|
||||
|
||||
struct my_error_code { int ec; my_error_code(int ec):ec(ec){ } };
|
||||
struct tag_error_code { typedef my_error_code type; };
|
||||
|
||||
bool my_error_code_to_string_called=false;
|
||||
|
||||
std::ostream &
|
||||
operator<<( std::ostream & s, my_error_code const & x )
|
||||
{
|
||||
my_error_code_to_string_called=true;
|
||||
return s << "my_error_code(" << x.ec << ')';
|
||||
}
|
||||
|
||||
struct my_exception: virtual std::exception, virtual boost::exception { };
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw my_exception();
|
||||
}
|
||||
catch(
|
||||
boost::exception & e )
|
||||
{
|
||||
e.set<tag1>(42);
|
||||
e.set<tag2>("42");
|
||||
e.set<tag_error_code>(42); //Implicit conversion
|
||||
try
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(
|
||||
my_exception & e )
|
||||
{
|
||||
BOOST_TEST(e.get<tag1>() && *e.get<tag1>()==42);
|
||||
BOOST_TEST(e.get<tag2>() && *e.get<tag2>()=="42");
|
||||
BOOST_TEST(!e.get<tag3>());
|
||||
BOOST_TEST(e.get<tag_error_code>() && e.get<tag_error_code>()->ec==42);
|
||||
|
||||
//Below we're verifying that an error code wrapped in a user-defined type
|
||||
//invokes the correct op<< to convert the error code to string.
|
||||
//Note that N3757 diagnostic_information uses different syntax, it is a
|
||||
//member of of std::exception.
|
||||
std::string di=boost::diagnostic_information(e);
|
||||
BOOST_TEST(!di.empty());
|
||||
BOOST_TEST(my_error_code_to_string_called);
|
||||
}
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
//Copyright (c) 2006-2015 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
template <class E,class I>
|
||||
E const &
|
||||
add_info( E const & e, I const & i )
|
||||
{
|
||||
return e << i;
|
||||
}
|
||||
#include "error_info_test.hpp"
|
@ -1,13 +0,0 @@
|
||||
//Copyright (c) 2006-2015 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
template <class E,class I>
|
||||
E const &
|
||||
add_info( E const & e, I i )
|
||||
{
|
||||
return e << i;
|
||||
}
|
||||
#include "error_info_test.hpp"
|
@ -1,28 +0,0 @@
|
||||
//Copyright (c) 2006-2015 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
int
|
||||
main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
template <class I>
|
||||
I const
|
||||
rv_const( I i )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
template <class E,class I>
|
||||
E const &
|
||||
add_info( E const & e, I i )
|
||||
{
|
||||
return e << rv_const(i);
|
||||
}
|
||||
#include "error_info_test.hpp"
|
||||
#endif
|
@ -1,22 +0,0 @@
|
||||
//Copyright (c) 2006-2015 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/exception/info.hpp>
|
||||
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
int
|
||||
main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
template <class E,class I>
|
||||
E const &
|
||||
add_info( E const & e, I i )
|
||||
{
|
||||
return e << std::move(i);
|
||||
}
|
||||
#include "error_info_test.hpp"
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
//Copyright (c) 2006-2015 Emil Dotchevski and Reverge Studios, Inc.
|
||||
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -69,7 +69,7 @@ basic_test()
|
||||
try
|
||||
{
|
||||
test_exception x;
|
||||
add_info(add_info(add_info(x,test_1(1)),test_2(2u)),test_3(3.14159f));
|
||||
x << test_1(1) << test_2(2u) << test_3(3.14159f);
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
@ -86,7 +86,7 @@ basic_test()
|
||||
try
|
||||
{
|
||||
test_exception x;
|
||||
add_info(add_info(add_info(x,test_1(1)),test_2(2u)),test_3(3.14159f));
|
||||
x << test_1(1) << test_2(2u) << test_3(3.14159f);
|
||||
throw x;
|
||||
}
|
||||
catch(
|
||||
@ -105,7 +105,7 @@ exception_safety_test()
|
||||
test_exception x;
|
||||
try
|
||||
{
|
||||
add_info(x,test_4(throws_on_copy()));
|
||||
x << test_4(throws_on_copy());
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch(
|
||||
@ -124,13 +124,13 @@ throw_empty()
|
||||
void
|
||||
throw_test_1( char const * value )
|
||||
{
|
||||
throw add_info(test_exception(),test_5(std::string(value)));
|
||||
throw test_exception() << test_5(std::string(value));
|
||||
}
|
||||
|
||||
void
|
||||
throw_test_2()
|
||||
{
|
||||
throw add_info(test_exception(),test_6(non_printable()));
|
||||
throw test_exception() << test_6(non_printable());
|
||||
}
|
||||
|
||||
void
|
||||
@ -144,7 +144,7 @@ throw_catch_add_file_name( char const * name )
|
||||
catch(
|
||||
boost::exception & x )
|
||||
{
|
||||
add_info(x,test_5(std::string(name)));
|
||||
x << test_5(std::string(name));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -256,10 +256,10 @@ test_add_tuple()
|
||||
typedef boost::tuple<test_1,test_2,test_3,test_5> tuple_test_1235;
|
||||
try
|
||||
{
|
||||
throw add_info(test_exception(),tuple_test_());
|
||||
throw test_exception() << tuple_test_();
|
||||
}
|
||||
catch(
|
||||
test_exception & )
|
||||
test_exception & x )
|
||||
{
|
||||
}
|
||||
catch(
|
||||
@ -269,7 +269,7 @@ test_add_tuple()
|
||||
}
|
||||
try
|
||||
{
|
||||
throw add_info(test_exception(),tuple_test_1(42));
|
||||
throw test_exception() << tuple_test_1(42);
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
@ -283,7 +283,7 @@ test_add_tuple()
|
||||
}
|
||||
try
|
||||
{
|
||||
throw add_info(test_exception(),tuple_test_12(42,42u));
|
||||
throw test_exception() << tuple_test_12(42,42u);
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
@ -298,7 +298,7 @@ test_add_tuple()
|
||||
}
|
||||
try
|
||||
{
|
||||
throw add_info(test_exception(),tuple_test_123(42,42u,42.0f));
|
||||
throw test_exception() << tuple_test_123(42,42u,42.0f);
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
@ -314,7 +314,7 @@ test_add_tuple()
|
||||
}
|
||||
try
|
||||
{
|
||||
throw add_info(test_exception(),tuple_test_1235(42,42u,42.0f,std::string("42")));
|
||||
throw test_exception() << tuple_test_1235(42,42u,42.0f,std::string("42"));
|
||||
}
|
||||
catch(
|
||||
test_exception & x )
|
||||
@ -337,7 +337,7 @@ test_lifetime1()
|
||||
int count=0;
|
||||
try
|
||||
{
|
||||
throw add_info(test_exception(),test_7(user_data(count)));
|
||||
throw test_exception() << test_7(user_data(count));
|
||||
}
|
||||
catch(
|
||||
boost::exception & x )
|
||||
@ -359,7 +359,7 @@ test_lifetime2()
|
||||
int count=0;
|
||||
{
|
||||
boost::exception_ptr ep;
|
||||
test_exception e; add_info(e,test_7(user_data(count)));
|
||||
test_exception e; e<<test_7(user_data(count));
|
||||
ep=boost::copy_exception(e);
|
||||
BOOST_TEST(count>0);
|
||||
}
|
Reference in New Issue
Block a user