Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69816 - in branches/release: boost/exception boost/exception/detail libs/exception/src libs/exception/test
From: dnljms_at_[hidden]
Date: 2011-03-10 02:34:17


Author: danieljames
Date: 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
New Revision: 69816
URL: http://svn.boost.org/trac/boost/changeset/69816

Log:
Revert r69620.

It's breaking the tests and probably isn't appropriate for a bug fix release.

Removed:
   branches/release/boost/exception/detail/clone_current_exception.hpp
   branches/release/libs/exception/src/
Text files modified:
   branches/release/boost/exception/detail/exception_ptr.hpp | 313 +++++++++++++++------------------------
   branches/release/boost/exception/detail/type_info.hpp | 6
   branches/release/boost/exception/diagnostic_information.hpp | 2
   branches/release/boost/exception/errinfo_nested_exception.hpp | 5
   branches/release/boost/exception/exception.hpp | 12 -
   branches/release/libs/exception/test/Jamfile.v2 | 9 -
   branches/release/libs/exception/test/cloning_test.cpp | 33 ---
   branches/release/libs/exception/test/copy_exception_test.cpp | 24 ---
   branches/release/libs/exception/test/exception_ptr_test.cpp | 32 ---
   branches/release/libs/exception/test/unknown_exception_test.cpp | 19 --
   10 files changed, 134 insertions(+), 321 deletions(-)

Deleted: branches/release/boost/exception/detail/clone_current_exception.hpp
==============================================================================
--- branches/release/boost/exception/detail/clone_current_exception.hpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
+++ (empty file)
@@ -1,44 +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)
-
-#ifndef UUID_81522C0EB56511DFAB613DB0DFD72085
-#define UUID_81522C0EB56511DFAB613DB0DFD72085
-
-#ifdef BOOST_NO_EXCEPTIONS
-#error This header requires exception handling to be enabled.
-#endif
-
-namespace
-boost
- {
- namespace
- exception_detail
- {
- namespace
- clone_current_exception_result
- {
- int const success=0;
- int const bad_alloc=1;
- int const bad_exception=2;
- int const not_supported=3;
- }
-
- class clone_base;
- int clone_current_exception_msvc_x86( clone_base const * & cloned );
-
- inline
- int
- clone_current_exception( clone_base const * & cloned )
- {
-#if defined(BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR) && defined(_MSC_VER) && defined(_M_IX86) && !defined(_M_X64)
- return clone_current_exception_msvc_x86(cloned);
-#else
- return clone_current_exception_result::not_supported;
-#endif
- }
- }
- }
-
-#endif

Modified: branches/release/boost/exception/detail/exception_ptr.hpp
==============================================================================
--- branches/release/boost/exception/detail/exception_ptr.hpp (original)
+++ branches/release/boost/exception/detail/exception_ptr.hpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -20,7 +20,6 @@
 #include <boost/exception/info.hpp>
 #include <boost/exception/diagnostic_information.hpp>
 #include <boost/exception/detail/type_info.hpp>
-#include <boost/exception/detail/clone_current_exception.hpp>
 #include <boost/shared_ptr.hpp>
 #include <stdexcept>
 #include <new>
@@ -29,41 +28,9 @@
 namespace
 boost
     {
- class exception_ptr;
- BOOST_ATTRIBUTE_NORETURN void rethrow_exception( exception_ptr const & );
- exception_ptr current_exception();
+ typedef shared_ptr<exception_detail::clone_base const> exception_ptr;
 
- class
- exception_ptr
- {
- typedef boost::shared_ptr<exception_detail::clone_base const> impl;
- impl ptr_;
- friend void rethrow_exception( exception_ptr const & );
- typedef exception_detail::clone_base const * (impl::*unspecified_bool_type)() const;
- public:
- exception_ptr()
- {
- }
- explicit
- exception_ptr( impl const & ptr ):
- ptr_(ptr)
- {
- }
- bool
- operator==( exception_ptr const & other ) const
- {
- return ptr_==other.ptr_;
- }
- bool
- operator!=( exception_ptr const & other ) const
- {
- return ptr_!=other.ptr_;
- }
- operator unspecified_bool_type() const
- {
- return ptr_?&impl::get:0;
- }
- };
+ exception_ptr current_exception();
 
     template <class T>
     inline
@@ -100,49 +67,35 @@
             boost::exception,
             std::bad_alloc
                 {
- ~bad_alloc_() throw() { }
                 };
 
- struct
- bad_exception_:
- boost::exception,
- std::bad_exception
- {
- ~bad_exception_() throw() { }
- };
-
- template <class Exception>
+ template <int Dummy>
         exception_ptr
- get_static_exception_object()
+ get_bad_alloc()
             {
- Exception ba;
- exception_detail::clone_impl<Exception> c(ba);
+ bad_alloc_ ba;
+ exception_detail::clone_impl<bad_alloc_> c(ba);
             c <<
                 throw_function(BOOST_CURRENT_FUNCTION) <<
                 throw_file(__FILE__) <<
                 throw_line(__LINE__);
- static exception_ptr ep(shared_ptr<exception_detail::clone_base const>(new exception_detail::clone_impl<Exception>(c)));
+ static exception_ptr ep(new exception_detail::clone_impl<bad_alloc_>(c));
             return ep;
             }
 
- template <class Exception>
+ template <int Dummy>
         struct
- exception_ptr_static_exception_object
+ exception_ptr_bad_alloc
             {
             static exception_ptr const e;
             };
 
- template <class Exception>
+ template <int Dummy>
         exception_ptr const
- exception_ptr_static_exception_object<Exception>::
- e = get_static_exception_object<Exception>();
+ exception_ptr_bad_alloc<Dummy>::
+ e = get_bad_alloc<Dummy>();
         }
 
-#if defined(__GNUC__)
-# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
-# pragma GCC visibility push (default)
-# endif
-#endif
     class
     unknown_exception:
         public boost::exception,
@@ -182,11 +135,6 @@
 #endif
             }
         };
-#if defined(__GNUC__)
-# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
-# pragma GCC visibility pop
-# endif
-#endif
 
     namespace
     exception_detail
@@ -296,131 +244,101 @@
         exception_ptr
         current_exception_impl()
             {
- exception_detail::clone_base const * e=0;
- switch(
- exception_detail::clone_current_exception(e) )
- {
- case exception_detail::clone_current_exception_result::
- success:
- {
- BOOST_ASSERT(e!=0);
- return exception_ptr(shared_ptr<exception_detail::clone_base const>(e));
- }
- case exception_detail::clone_current_exception_result::
- bad_alloc:
- {
- BOOST_ASSERT(!e);
- return exception_detail::exception_ptr_static_exception_object<bad_alloc_>::e;
- }
- case exception_detail::clone_current_exception_result::
- bad_exception:
- {
- BOOST_ASSERT(!e);
- return exception_detail::exception_ptr_static_exception_object<bad_exception_>::e;
- }
- default:
- BOOST_ASSERT(0);
- case exception_detail::clone_current_exception_result::
- not_supported:
- {
- BOOST_ASSERT(!e);
- try
- {
- throw;
- }
- catch(
- exception_detail::clone_base & e )
- {
- return exception_ptr(shared_ptr<exception_detail::clone_base const>(e.clone()));
- }
- catch(
- std::domain_error & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::invalid_argument & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::length_error & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::out_of_range & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::logic_error & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::range_error & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::overflow_error & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::underflow_error & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::ios_base::failure & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::runtime_error & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::bad_alloc & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
+ try
+ {
+ throw;
+ }
+ catch(
+ exception_detail::clone_base & e )
+ {
+ return exception_ptr(e.clone());
+ }
+ catch(
+ std::domain_error & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::invalid_argument & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::length_error & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::out_of_range & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::logic_error & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::range_error & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::overflow_error & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::underflow_error & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::ios_base::failure & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::runtime_error & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::bad_alloc & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
 #ifndef BOOST_NO_TYPEID
- catch(
- std::bad_cast & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::bad_typeid & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
+ catch(
+ std::bad_cast & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::bad_typeid & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
 #endif
- catch(
- std::bad_exception & e )
- {
- return exception_detail::current_exception_std_exception(e);
- }
- catch(
- std::exception & e )
- {
- return exception_detail::current_exception_unknown_std_exception(e);
- }
- catch(
- boost::exception & e )
- {
- return exception_detail::current_exception_unknown_boost_exception(e);
- }
- catch(
- ... )
- {
- return exception_detail::current_exception_unknown_exception();
- }
- }
+ catch(
+ std::bad_exception & e )
+ {
+ return exception_detail::current_exception_std_exception(e);
+ }
+ catch(
+ std::exception & e )
+ {
+ return exception_detail::current_exception_unknown_std_exception(e);
+ }
+ catch(
+ boost::exception & e )
+ {
+ return exception_detail::current_exception_unknown_boost_exception(e);
+ }
+ catch(
+ ... )
+ {
+ return exception_detail::current_exception_unknown_exception();
                 }
             }
         }
@@ -430,6 +348,7 @@
     current_exception()
         {
         exception_ptr ret;
+ BOOST_ASSERT(!ret);
         try
             {
             ret=exception_detail::current_exception_impl();
@@ -437,24 +356,36 @@
         catch(
         std::bad_alloc & )
             {
- ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_alloc_>::e;
+ ret=exception_detail::exception_ptr_bad_alloc<42>::e;
             }
         catch(
         ... )
             {
- ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_exception_>::e;
+ try
+ {
+ ret=exception_detail::current_exception_std_exception(std::bad_exception());
+ }
+ catch(
+ std::bad_alloc & )
+ {
+ ret=exception_detail::exception_ptr_bad_alloc<42>::e;
+ }
+ catch(
+ ... )
+ {
+ BOOST_ASSERT(0);
+ }
             }
         BOOST_ASSERT(ret);
         return ret;
         }
 
- BOOST_ATTRIBUTE_NORETURN
     inline
     void
     rethrow_exception( exception_ptr const & p )
         {
         BOOST_ASSERT(p);
- p.ptr_->rethrow();
+ p->rethrow();
         }
 
     inline

Modified: branches/release/boost/exception/detail/type_info.hpp
==============================================================================
--- branches/release/boost/exception/detail/type_info.hpp (original)
+++ branches/release/boost/exception/detail/type_info.hpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -53,11 +53,11 @@
         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)
                 {
                 }
 
@@ -65,7 +65,7 @@
             bool
             operator<( type_info_ const & a, type_info_ const & b )
                 {
- return 0!=(a.type_->before(*b.type_));
+ return 0!=(a.type_.before(b.type_));
                 }
             };
         }

Modified: branches/release/boost/exception/diagnostic_information.hpp
==============================================================================
--- branches/release/boost/exception/diagnostic_information.hpp (original)
+++ branches/release/boost/exception/diagnostic_information.hpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -137,7 +137,7 @@
                 }
 #ifndef BOOST_NO_RTTI
             tmp << std::string("Dynamic exception type: ") <<
- units::detail::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 )
                 tmp << "std::exception::what: " << wh << '\n';

Modified: branches/release/boost/exception/errinfo_nested_exception.hpp
==============================================================================
--- branches/release/boost/exception/errinfo_nested_exception.hpp (original)
+++ branches/release/boost/exception/errinfo_nested_exception.hpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -9,9 +9,10 @@
 namespace
 boost
     {
- namespace exception_detail { class clone_base; }
+ namespace exception_detail { class clone_base; };
     template <class Tag,class T> class error_info;
- class exception_ptr;
+ template <class T> class shared_ptr;
+ typedef shared_ptr<exception_detail::clone_base const> exception_ptr;
     typedef error_info<struct errinfo_nested_exception_,exception_ptr> errinfo_nested_exception;
     }
 

Modified: branches/release/boost/exception/exception.hpp
==============================================================================
--- branches/release/boost/exception/exception.hpp (original)
+++ branches/release/boost/exception/exception.hpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -189,11 +189,6 @@
         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
         {
@@ -255,11 +250,6 @@
         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::
@@ -344,7 +334,7 @@
         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;
+ typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type;
             };
         }
 

Modified: branches/release/libs/exception/test/Jamfile.v2
==============================================================================
--- branches/release/libs/exception/test/Jamfile.v2 (original)
+++ branches/release/libs/exception/test/Jamfile.v2 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -7,13 +7,7 @@
 
 import testing ;
 
-project
- : requirements
- <link>static
- <exception-handling>on
- <source>/boost//exception
- <define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR
- ;
+project : requirements <exception-handling>on ;
 
 #to_string
 
@@ -43,7 +37,6 @@
 run no_exceptions_test.cpp : : : <exception-handling>off ;
 run errinfos_test.cpp ;
 run exception_ptr_test.cpp /boost//thread : : : <threading>multi ;
-
 compile-fail exception_fail.cpp ;
 compile-fail throw_exception_fail.cpp ;
 compile-fail error_info_const_fail.cpp ;

Modified: branches/release/libs/exception/test/cloning_test.cpp
==============================================================================
--- branches/release/libs/exception/test/cloning_test.cpp (original)
+++ branches/release/libs/exception/test/cloning_test.cpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -146,10 +146,6 @@
 #endif
             }
         catch(
- T & )
- {
- }
- catch(
         ... )
             {
             BOOST_TEST(false);
@@ -180,7 +176,7 @@
         catch(
         T & x )
             {
- BOOST_TEST(std::string(x.what()).find("what")!=std::string::npos);
+ BOOST_TEST(std::string("what")==x.what());
             boost::exception_ptr p = boost::current_exception();
             BOOST_TEST(!(p==boost::exception_ptr()));
             BOOST_TEST(p!=boost::exception_ptr());
@@ -193,7 +189,7 @@
             catch(
             T & x )
                 {
- BOOST_TEST(std::string(x.what()).find("what")!=std::string::npos);
+ BOOST_TEST(std::string("what")==x.what());
                 }
             catch(
             ... )
@@ -220,10 +216,6 @@
 #endif
             }
         catch(
- T & )
- {
- }
- catch(
         ... )
             {
             BOOST_TEST(false);
@@ -393,11 +385,6 @@
             BOOST_TEST(false);
             }
         catch(
- derives_std_exception & )
- {
- //Yay! Non-intrusive cloning supported!
- }
- catch(
         boost::unknown_exception & e )
             {
 #ifndef BOOST_NO_RTTI
@@ -447,14 +434,6 @@
             BOOST_TEST(false);
             }
         catch(
- derives_std_boost_exception & x )
- {
- //Yay! Non-intrusive cloning supported!
- BOOST_TEST(boost::get_error_info<my_info>(x));
- if( int const * p=boost::get_error_info<my_info>(x) )
- BOOST_TEST(*p==42);
- }
- catch(
         boost::unknown_exception & x )
             {
             BOOST_TEST(boost::get_error_info<my_info>(x));
@@ -516,14 +495,6 @@
             BOOST_TEST(false);
             }
         catch(
- derives_boost_exception & x )
- {
- //Yay! Non-intrusive cloning supported!
- BOOST_TEST(boost::get_error_info<my_info>(x));
- if( int const * p=boost::get_error_info<my_info>(x) )
- BOOST_TEST(*p==42);
- }
- catch(
         boost::unknown_exception & x )
             {
             BOOST_TEST(boost::get_error_info<my_info>(x));

Modified: branches/release/libs/exception/test/copy_exception_test.cpp
==============================================================================
--- branches/release/libs/exception/test/copy_exception_test.cpp (original)
+++ branches/release/libs/exception/test/copy_exception_test.cpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -6,37 +6,15 @@
 #include <boost/exception_ptr.hpp>
 #include <boost/exception/get_error_info.hpp>
 #include <boost/thread.hpp>
-#include <boost/detail/atomic_count.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
 typedef boost::error_info<struct tag_answer,int> answer;
 
-boost::detail::atomic_count exc_count(0);
-
 struct
 err:
     virtual boost::exception,
     virtual std::exception
     {
- err()
- {
- ++exc_count;
- }
-
- err( err const & )
- {
- ++exc_count;
- }
-
- virtual
- ~err() throw()
- {
- --exc_count;
- }
-
- private:
-
- err & operator=( err const & );
     };
 
 class
@@ -138,9 +116,7 @@
 int
 main()
     {
- BOOST_TEST(++exc_count==1);
     simple_test();
     thread_test();
- BOOST_TEST(!--exc_count);
     return boost::report_errors();
     }

Modified: branches/release/libs/exception/test/exception_ptr_test.cpp
==============================================================================
--- branches/release/libs/exception/test/exception_ptr_test.cpp (original)
+++ branches/release/libs/exception/test/exception_ptr_test.cpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -10,7 +10,6 @@
 #include <boost/function.hpp>
 #include <boost/bind.hpp>
 #include <boost/thread.hpp>
-#include <boost/detail/atomic_count.hpp>
 #include <boost/detail/lightweight_test.hpp>
 #include <iostream>
 
@@ -67,34 +66,7 @@
         rethrow_exception(t.err_);
     }
 
-boost::detail::atomic_count exc_count(0);
-
-struct
-exc:
- virtual boost::exception,
- virtual std::exception
- {
- exc()
- {
- ++exc_count;
- }
-
- exc( exc const & )
- {
- ++exc_count;
- }
-
- virtual
- ~exc() throw()
- {
- --exc_count;
- }
-
- private:
-
- exc & operator=( exc const & );
- };
-
+struct exc: boost::exception, std::exception { };
 typedef boost::error_info<struct answer_,int> answer;
 
 void
@@ -121,7 +93,6 @@
 int
 main()
     {
- BOOST_TEST(++exc_count==1);
     try
         {
         std::vector< boost::shared_ptr<thread_handle> > threads;
@@ -138,5 +109,4 @@
             boost::current_exception_diagnostic_information() << std::endl;
         return 42;
         }
- BOOST_TEST(!--exc_count);
     }

Modified: branches/release/libs/exception/test/unknown_exception_test.cpp
==============================================================================
--- branches/release/libs/exception/test/unknown_exception_test.cpp (original)
+++ branches/release/libs/exception/test/unknown_exception_test.cpp 2011-03-10 02:34:15 EST (Thu, 10 Mar 2011)
@@ -62,15 +62,6 @@
                 BOOST_TEST(false);
             }
         catch(
- boost::exception & x )
- {
- //Yay! Non-intrusive cloning supported!
- if( int const * d=boost::get_error_info<test>(x) )
- BOOST_TEST( 42==*d );
- else
- BOOST_TEST(false);
- }
- catch(
         ... )
             {
             BOOST_TEST(false);
@@ -110,11 +101,6 @@
             {
             }
         catch(
- std::exception & )
- {
- //Yay! Non-intrusive cloning supported!
- }
- catch(
         ... )
             {
             BOOST_TEST(false);
@@ -128,11 +114,6 @@
             {
             }
         catch(
- std::exception & )
- {
- //Yay! Non-intrusive cloning supported!
- }
- catch(
         ... )
             {
             BOOST_TEST(false);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk