summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-05-06 17:44:27 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-05-06 17:44:27 (GMT)
commitd76ada0ab59634e3333f9eb5a92d0e850f60d7bf (patch)
tree5eaae441173fad2ec19ba67d6589f28ecd740991 /3rdParty/Boost/src/boost/exception
parent6f49e5abee37d37b351d68c01374232eccdac458 (diff)
downloadswift-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.zip
swift-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.tar.bz2
Updated Boost to 1.43.0.
Diffstat (limited to '3rdParty/Boost/src/boost/exception')
-rw-r--r--3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp6
-rw-r--r--3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp209
-rw-r--r--3rdParty/Boost/src/boost/exception/detail/is_output_streamable.hpp17
-rw-r--r--3rdParty/Boost/src/boost/exception/detail/type_info.hpp14
-rw-r--r--3rdParty/Boost/src/boost/exception/diagnostic_information.hpp8
-rw-r--r--3rdParty/Boost/src/boost/exception/exception.hpp98
-rw-r--r--3rdParty/Boost/src/boost/exception/info.hpp48
7 files changed, 200 insertions, 200 deletions
diff --git a/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp b/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp
index 32113b1..883d313 100644
--- a/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp
+++ b/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp
@@ -1,4 +1,4 @@
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 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)
@@ -25,7 +25,7 @@ boost
{
public:
- virtual char const * tag_typeid_name() const = 0;
+ virtual std::string tag_typeid_name() const = 0;
virtual std::string value_as_string() const = 0;
protected:
@@ -62,7 +62,7 @@ boost
private:
- char const * tag_typeid_name() const;
+ std::string tag_typeid_name() const;
std::string value_as_string() const;
value_type value_;
diff --git a/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp b/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp
index 78db17c..59686e9 100644
--- a/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp
+++ b/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp
@@ -28,6 +28,26 @@
namespace
boost
{
+ typedef shared_ptr<exception_detail::clone_base const> exception_ptr;
+
+ exception_ptr current_exception();
+
+ template <class T>
+ inline
+ exception_ptr
+ copy_exception( T const & e )
+ {
+ try
+ {
+ throw enable_current_exception(e);
+ }
+ catch(
+ ... )
+ {
+ return current_exception();
+ }
+ }
+
#ifndef BOOST_NO_RTTI
typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;
@@ -39,91 +59,45 @@ boost
}
#endif
- class exception_ptr;
- exception_ptr current_exception();
- void rethrow_exception( exception_ptr const & );
-
- class
- exception_ptr
+ namespace
+ exception_detail
{
- typedef bool exception_ptr::*unspecified_bool_type;
- friend exception_ptr current_exception();
- friend void rethrow_exception( exception_ptr const & );
-
- shared_ptr<exception_detail::clone_base const> c_;
- bool bad_alloc_;
-
struct
- bad_alloc_tag
- {
- };
-
- explicit
- exception_ptr( bad_alloc_tag ):
- bad_alloc_(true)
- {
- }
-
- explicit
- exception_ptr( shared_ptr<exception_detail::clone_base const> const & c ):
- c_(c),
- bad_alloc_(false)
- {
- BOOST_ASSERT(c);
- }
-
- void
- rethrow() const
- {
- BOOST_ASSERT(*this);
- if( bad_alloc_ )
- throw enable_current_exception(std::bad_alloc());
- else
- c_->rethrow();
- }
-
- bool
- empty() const
- {
- return !bad_alloc_ && !c_;
- }
-
- public:
-
- exception_ptr():
- bad_alloc_(false)
- {
- }
-
- ~exception_ptr() throw()
- {
- }
+ bad_alloc_:
+ boost::exception,
+ std::bad_alloc
+ {
+ };
- operator unspecified_bool_type() const
+ template <int Dummy>
+ exception_ptr
+ get_bad_alloc()
{
- return empty() ? 0 : &exception_ptr::bad_alloc_;
+ static exception_ptr e = boost::copy_exception(
+ bad_alloc_() <<
+ throw_function("boost::current_exception()") <<
+ throw_file(__FILE__) <<
+ throw_line(__LINE__) );
+ return e;
}
- friend
- bool
- operator==( exception_ptr const & a, exception_ptr const & b )
+ template <int Dummy>
+ struct
+ exception_ptr_bad_alloc
{
- return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_;
- }
+ static exception_ptr const e;
+ };
- friend
- bool
- operator!=( exception_ptr const & a, exception_ptr const & b )
- {
- return !(a==b);
- }
- };
+ template <int Dummy>
+ exception_ptr const
+ exception_ptr_bad_alloc<Dummy>::
+ e = get_bad_alloc<Dummy>();
+ }
class
unknown_exception:
- public exception,
- public std::exception,
- public exception_detail::clone_base
+ public boost::exception,
+ public std::exception
{
public:
@@ -150,18 +124,6 @@ boost
private:
- exception_detail::clone_base const *
- clone() const
- {
- return new unknown_exception(*this);
- }
-
- void
- rethrow() const
- {
- throw*this;
- }
-
template <class E>
void
add_original_type( E const & e )
@@ -179,8 +141,7 @@ boost
class
current_exception_std_exception_wrapper:
public T,
- public boost::exception,
- public clone_base
+ public boost::exception
{
public:
@@ -204,18 +165,6 @@ boost
private:
- clone_base const *
- clone() const
- {
- return new current_exception_std_exception_wrapper(*this);
- }
-
- void
- rethrow() const
- {
- throw *this;
- }
-
template <class E>
void
add_original_type( E const & e )
@@ -228,7 +177,7 @@ boost
#ifdef BOOST_NO_RTTI
template <class T>
- exception const *
+ boost::exception const *
get_boost_exception( T const * )
{
try
@@ -236,7 +185,7 @@ boost
throw;
}
catch(
- exception & x )
+ boost::exception & x )
{
return &x;
}
@@ -247,50 +196,50 @@ boost
}
#else
template <class T>
- exception const *
+ boost::exception const *
get_boost_exception( T const * x )
{
- return dynamic_cast<exception const *>(x);
+ return dynamic_cast<boost::exception const *>(x);
}
#endif
template <class T>
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_std_exception( T const & e1 )
{
if( boost::exception const * e2 = get_boost_exception(&e1) )
- return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1,*e2));
+ return boost::copy_exception(current_exception_std_exception_wrapper<T>(e1,*e2));
else
- return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1));
+ return boost::copy_exception(current_exception_std_exception_wrapper<T>(e1));
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_unknown_exception()
{
- return shared_ptr<unknown_exception const>(new unknown_exception());
+ return boost::copy_exception(unknown_exception());
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_unknown_boost_exception( boost::exception const & e )
{
- return shared_ptr<unknown_exception const>(new unknown_exception(e));
+ return boost::copy_exception(unknown_exception(e));
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_unknown_std_exception( std::exception const & e )
{
if( boost::exception const * be = get_boost_exception(&e) )
return current_exception_unknown_boost_exception(*be);
else
- return shared_ptr<unknown_exception const>(new unknown_exception(e));
+ return boost::copy_exception(unknown_exception(e));
}
inline
- shared_ptr<clone_base const>
+ exception_ptr
current_exception_impl()
{
try
@@ -300,7 +249,7 @@ boost
catch(
exception_detail::clone_base & e )
{
- return shared_ptr<exception_detail::clone_base const>(e.clone());
+ return exception_ptr(e.clone());
}
catch(
std::domain_error & e )
@@ -396,24 +345,28 @@ boost
exception_ptr
current_exception()
{
+ exception_ptr ret;
+ BOOST_ASSERT(!ret);
try
{
- return exception_ptr(exception_detail::current_exception_impl());
+ ret=exception_detail::current_exception_impl();
}
catch(
std::bad_alloc & )
{
+ ret=exception_detail::exception_ptr_bad_alloc<42>::e;
}
catch(
... )
{
try
{
- return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception()));
+ ret=exception_detail::current_exception_std_exception(std::bad_exception());
}
catch(
std::bad_alloc & )
{
+ ret=exception_detail::exception_ptr_bad_alloc<42>::e;
}
catch(
... )
@@ -421,30 +374,16 @@ boost
BOOST_ASSERT(0);
}
}
- return exception_ptr(exception_ptr::bad_alloc_tag());
- }
-
- template <class T>
- inline
- exception_ptr
- copy_exception( T const & e )
- {
- try
- {
- throw enable_current_exception(e);
- }
- catch(
- ... )
- {
- return current_exception();
- }
+ BOOST_ASSERT(ret);
+ return ret;
}
inline
void
rethrow_exception( exception_ptr const & p )
{
- p.rethrow();
+ BOOST_ASSERT(p);
+ p->rethrow();
}
inline
diff --git a/3rdParty/Boost/src/boost/exception/detail/is_output_streamable.hpp b/3rdParty/Boost/src/boost/exception/detail/is_output_streamable.hpp
index 5eb1695..743313c 100644
--- a/3rdParty/Boost/src/boost/exception/detail/is_output_streamable.hpp
+++ b/3rdParty/Boost/src/boost/exception/detail/is_output_streamable.hpp
@@ -20,8 +20,21 @@ boost
namespace
to_string_detail
{
- template <class T,class CharT,class Traits>
- char operator<<( std::basic_ostream<CharT,Traits> &, T const & );
+ struct
+ partial_ordering_helper1
+ {
+ template <class CharT,class Traits>
+ partial_ordering_helper1( std::basic_ostream<CharT,Traits> & );
+ };
+
+ struct
+ partial_ordering_helper2
+ {
+ template <class T>
+ partial_ordering_helper2( T const & );
+ };
+
+ char operator<<( partial_ordering_helper1, partial_ordering_helper2 );
template <class T,class CharT,class Traits>
struct
diff --git a/3rdParty/Boost/src/boost/exception/detail/type_info.hpp b/3rdParty/Boost/src/boost/exception/detail/type_info.hpp
index 60709a1..9ab1c57 100644
--- a/3rdParty/Boost/src/boost/exception/detail/type_info.hpp
+++ b/3rdParty/Boost/src/boost/exception/detail/type_info.hpp
@@ -1,4 +1,4 @@
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 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)
@@ -15,31 +15,35 @@
#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
boost
{
template <class T>
inline
- char const *
+ std::string
tag_type_name()
{
#ifdef BOOST_NO_TYPEID
return BOOST_CURRENT_FUNCTION;
#else
- return typeid(T*).name();
+ return units::detail::demangle(typeid(T*).name());
#endif
}
template <class T>
inline
- char const *
+ std::string
type_name()
{
#ifdef BOOST_NO_TYPEID
return BOOST_CURRENT_FUNCTION;
#else
- return typeid(T).name();
+ return units::detail::demangle(typeid(T).name());
#endif
}
diff --git a/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp b/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp
index 632a5a3..1d6bc2c 100644
--- a/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp
+++ b/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp
@@ -1,4 +1,4 @@
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 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)
@@ -15,7 +15,9 @@
#include <boost/config.hpp>
#include <boost/exception/get_error_info.hpp>
#include <boost/utility/enable_if.hpp>
-#include <boost/config.hpp>
+#ifndef BOOST_NO_RTTI
+#include <boost/units/detail/utility.hpp>
+#endif
#include <exception>
#include <sstream>
#include <string>
@@ -135,7 +137,7 @@ boost
}
#ifndef BOOST_NO_RTTI
tmp << std::string("Dynamic exception type: ") <<
- (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 )
tmp << "std::exception::what: " << wh << '\n';
diff --git a/3rdParty/Boost/src/boost/exception/exception.hpp b/3rdParty/Boost/src/boost/exception/exception.hpp
index 79b2739..fd516dd 100644
--- a/3rdParty/Boost/src/boost/exception/exception.hpp
+++ b/3rdParty/Boost/src/boost/exception/exception.hpp
@@ -132,18 +132,6 @@ boost
}
};
- template <class E,class Tag,class T>
- E const & operator<<( E const &, error_info<Tag,T> const & );
-
- template <class E>
- E const & operator<<( E const &, throw_function const & );
-
- template <class E>
- E const & operator<<( E const &, throw_file const & );
-
- template <class E>
- E const & operator<<( E const &, throw_line const & );
-
class exception;
template <class>
@@ -163,6 +151,7 @@ boost
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
virtual void add_ref() const = 0;
virtual void release() const = 0;
+ virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
protected:
@@ -184,6 +173,20 @@ boost
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 & );
}
class
@@ -216,30 +219,31 @@ boost
#endif
;
-#if defined(__MWERKS__) && __MWERKS__<=0x3207
+#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
public:
#else
private:
template <class E>
- friend E const & operator<<( E const &, throw_function const & );
+ friend E const & exception_detail::set_info( E const &, throw_function const & );
template <class E>
- friend E const & operator<<( E const &, throw_file const & );
+ friend E const & exception_detail::set_info( E const &, throw_file const & );
template <class E>
- friend E const & operator<<( E const &, throw_line const & );
-
- friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
+ friend E const & exception_detail::set_info( E const &, throw_line const & );
template <class E,class Tag,class T>
- friend E const & operator<<( E const &, error_info<Tag,T> const & );
+ 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_;
@@ -253,28 +257,32 @@ boost
{
}
- template <class E>
- E const &
- operator<<( E const & x, throw_function const & y )
+ namespace
+ exception_detail
{
- x.throw_function_=y.v_;
- return x;
- }
+ 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 &
- operator<<( 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_file const & y )
+ {
+ x.throw_file_=y.v_;
+ return x;
+ }
- template <class E>
- E const &
- operator<<( E const & x, throw_line const & y )
- {
- x.throw_line_=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;
+ }
}
////////////////////////////////////////////////////////////////////////
@@ -300,10 +308,10 @@ boost
};
struct large_size { char c[256]; };
- large_size dispatch( exception * );
+ large_size dispatch_boost_exception( exception const * );
struct small_size { };
- small_size dispatch( void * );
+ small_size dispatch_boost_exception( void const * );
template <class,int>
struct enable_error_info_helper;
@@ -326,7 +334,7 @@ boost
struct
enable_error_info_return_type
{
- typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch((T*)0))>::type type;
+ typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type;
};
}
@@ -363,7 +371,13 @@ boost
void
copy_boost_exception( exception * a, exception const * b )
{
- *a = *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
diff --git a/3rdParty/Boost/src/boost/exception/info.hpp b/3rdParty/Boost/src/boost/exception/info.hpp
index cbbc2c0..7aeeee5 100644
--- a/3rdParty/Boost/src/boost/exception/info.hpp
+++ b/3rdParty/Boost/src/boost/exception/info.hpp
@@ -1,4 +1,4 @@
-//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+//Copyright (c) 2006-2010 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)
@@ -47,7 +47,7 @@ boost
template <class Tag,class T>
inline
- char const *
+ std::string
error_info<Tag,T>::
tag_typeid_name() const
{
@@ -131,6 +131,9 @@ boost
mutable std::string diagnostic_info_str_;
mutable int count_;
+ error_info_container_impl( error_info_container_impl const & );
+ error_info_container_impl & operator=( error_info_container const & );
+
void
add_ref() const
{
@@ -143,21 +146,46 @@ boost
if( !--count_ )
delete this;
}
+
+ refcount_ptr<error_info_container>
+ clone() const
+ {
+ refcount_ptr<error_info_container> p;
+ error_info_container_impl * c=new error_info_container_impl;
+ p.adopt(c);
+ c->info_ = info_;
+ return p;
+ }
+ };
+
+ template <class E,class Tag,class T>
+ inline
+ E const &
+ set_info( E const & x, error_info<Tag,T> const & v )
+ {
+ typedef error_info<Tag,T> error_info_tag_t;
+ shared_ptr<error_info_tag_t> p( new error_info_tag_t(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 <class T>
+ struct
+ derives_boost_exception
+ {
+ enum e { value = (sizeof(dispatch_boost_exception((T*)0))==sizeof(large_size)) };
};
}
template <class E,class Tag,class T>
inline
- E const &
+ typename enable_if<exception_detail::derives_boost_exception<E>,E const &>::type
operator<<( E const & x, error_info<Tag,T> const & v )
{
- typedef error_info<Tag,T> error_info_tag_t;
- shared_ptr<error_info_tag_t> p( new error_info_tag_t(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;
+ return exception_detail::set_info(x,v);
}
}