diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-05-06 17:44:27 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-05-06 17:44:27 (GMT) |
commit | d76ada0ab59634e3333f9eb5a92d0e850f60d7bf (patch) | |
tree | 5eaae441173fad2ec19ba67d6589f28ecd740991 /3rdParty/Boost/src/boost/exception/detail | |
parent | 6f49e5abee37d37b351d68c01374232eccdac458 (diff) | |
download | swift-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.zip swift-d76ada0ab59634e3333f9eb5a92d0e850f60d7bf.tar.bz2 |
Updated Boost to 1.43.0.
Diffstat (limited to '3rdParty/Boost/src/boost/exception/detail')
4 files changed, 101 insertions, 145 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 } |