Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65161 - in trunk/libs/exception: build src test
From: emil_at_[hidden]
Date: 2010-09-01 03:59:39


Author: emildotchevski
Date: 2010-09-01 03:59:35 EDT (Wed, 01 Sep 2010)
New Revision: 65161
URL: http://svn.boost.org/trac/boost/changeset/65161

Log:
disabling the non-intrusive exception_ptr support in tests, seems buggy..
Text files modified:
   trunk/libs/exception/build/Jamfile.v2 | 2
   trunk/libs/exception/src/clone_current_exception_msvc.cpp | 66 ++++++++++++++++++++-------------------
   trunk/libs/exception/test/Jamfile.v2 | 9 ++++-
   trunk/libs/exception/test/exception_ptr_test.cpp | 3 +
   4 files changed, 44 insertions(+), 36 deletions(-)

Modified: trunk/libs/exception/build/Jamfile.v2
==============================================================================
--- trunk/libs/exception/build/Jamfile.v2 (original)
+++ trunk/libs/exception/build/Jamfile.v2 2010-09-01 03:59:35 EDT (Wed, 01 Sep 2010)
@@ -5,7 +5,7 @@
 # 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)
 
-lib boost_exception ;
+alias boost_exception ;
 lib boost_exception : ../src/clone_current_exception_msvc.cpp : <toolset>msvc ;
 
 boost-install boost_exception ;

Modified: trunk/libs/exception/src/clone_current_exception_msvc.cpp
==============================================================================
--- trunk/libs/exception/src/clone_current_exception_msvc.cpp (original)
+++ trunk/libs/exception/src/clone_current_exception_msvc.cpp 2010-09-01 03:59:35 EDT (Wed, 01 Sep 2010)
@@ -72,7 +72,8 @@
         class_has_virtual_base=4
         };
 
- struct cpp_type_info
+ struct
+ cpp_type_info
         {
         unsigned flags;
         void const * type_info; //std::type_info * type_info;
@@ -103,9 +104,11 @@
     exception_object_deleter
         {
         cpp_exception_type const * exception_type_;
+ bool run_destructor_;
 
- exception_object_deleter( cpp_exception_type const * exception_type ):
- exception_type_(exception_type)
+ exception_object_deleter( cpp_exception_type const * exception_type, bool run_destructor ):
+ exception_type_(exception_type),
+ run_destructor_(run_destructor)
             {
             BOOST_ASSERT(exception_type_!=0);
             }
@@ -114,14 +117,17 @@
         operator()( void * exception_object )
             {
             BOOST_ASSERT(exception_object!=0);
- dummy_exception_type * dummy_exception_ptr=reinterpret_cast<dummy_exception_type *>(exception_object);
- (dummy_exception_ptr->*(exception_type_->destructor))();
+ if( run_destructor_ )
+ {
+ dummy_exception_type * dummy_exception_ptr=reinterpret_cast<dummy_exception_type *>(exception_object);
+ (dummy_exception_ptr->*(exception_type_->destructor))();
+ }
             free(exception_object);
             }
         };
 
     boost::shared_ptr<void>
- copy_msvc_exception( void * source_object, cpp_exception_type const * exception_type )
+ copy_msvc_exception( void * source_object, cpp_exception_type const * exception_type, bool run_destructor )
         {
         void * exception_object = malloc(exception_type->type_info_table->info[0]->size);
         if( !exception_object )
@@ -137,7 +143,7 @@
             }
         else
             memmove(exception_object,source_object,type->size);
- return boost::shared_ptr<void>(exception_object,exception_object_deleter(exception_type));
+ return boost::shared_ptr<void>(exception_object,exception_object_deleter(exception_type,run_destructor));
         }
 
     class
@@ -154,7 +160,7 @@
 
         cloned_exception( void * source_object, cpp_exception_type const * exception_type ):
             exception_type_(exception_type),
- exception_object_(copy_msvc_exception(source_object,exception_type_))
+ exception_object_(copy_msvc_exception(source_object,exception_type_,true))
             {
             }
 
@@ -171,7 +177,7 @@
         void
         rethrow() const
             {
- boost::shared_ptr<void const> clone=copy_msvc_exception(exception_object_.get(),exception_type_);
+ boost::shared_ptr<void const> clone=copy_msvc_exception(exception_object_.get(),exception_type_,false);
             ULONG_PTR args[cpp_exception_parameter_count];
             args[0]=cpp_exception_magic_flag;
             args[1]=reinterpret_cast<ULONG_PTR>(clone.get());
@@ -181,7 +187,7 @@
         };
 
     bool
- is_cpp_exception( EXCEPTION_RECORD * record )
+ is_cpp_exception( EXCEPTION_RECORD const * record )
         {
         return record &&
             (record->ExceptionCode==cpp_exception_code) &&
@@ -190,30 +196,27 @@
         }
 
     unsigned long
- exception_cloning_filter( boost::exception_detail::clone_base const * * ptr, void * info_ )
+ exception_cloning_filter( int & result, boost::exception_detail::clone_base const * & ptr, void * info_ )
         {
- BOOST_ASSERT(ptr!=0);
- BOOST_ASSERT(!*ptr);
         BOOST_ASSERT(info_!=0);
         EXCEPTION_POINTERS * info=reinterpret_cast<EXCEPTION_POINTERS *>(info_);
         EXCEPTION_RECORD * record=info->ExceptionRecord;
         if( is_cpp_exception(record) )
             {
             if( !record->ExceptionInformation[2] )
- {
                 record = *reinterpret_cast<EXCEPTION_RECORD * *>(reinterpret_cast<char *>(_errno())+exception_info_offset);
- }
             if( is_cpp_exception(record) && record->ExceptionInformation[2] )
                 try
                     {
- *ptr = new cloned_exception(
+ ptr = new cloned_exception(
                             reinterpret_cast<void *>(record->ExceptionInformation[1]),
                             reinterpret_cast<cpp_exception_type const *>(record->ExceptionInformation[2]));
+ result = boost::exception_detail::clone_current_exception_result::success;
                     }
                 catch(
                 std::bad_alloc & )
                     {
- BOOST_ASSERT(!*ptr);
+ result = boost::exception_detail::clone_current_exception_result::bad_alloc;
                     }
                 catch(
                 ... )
@@ -235,23 +238,22 @@
         clone_current_exception_msvc( clone_base const * & cloned )
             {
             BOOST_ASSERT(!cloned);
- if( exception_info_offset<0 )
- return clone_current_exception_result::not_supported;
- clone_base const * res=0;
- __try
+ int result = clone_current_exception_result::not_supported;
+ if( exception_info_offset>=0 )
                 {
- throw;
- }
- __except(exception_cloning_filter(&res,GetExceptionInformation()))
- {
- }
- if( !res )
- return clone_current_exception_result::bad_alloc;
- else
- {
- cloned=res;
- return clone_current_exception_result::success;
+ clone_base const * ptr=0;
+ __try
+ {
+ throw;
+ }
+ __except(exception_cloning_filter(result,ptr,GetExceptionInformation()))
+ {
+ }
+ if( result==clone_current_exception_result::success )
+ cloned=ptr;
                 }
+ BOOST_ASSERT(result!=clone_current_exception_result::success || cloned);
+ return result;
             }
         }
     }

Modified: trunk/libs/exception/test/Jamfile.v2
==============================================================================
--- trunk/libs/exception/test/Jamfile.v2 (original)
+++ trunk/libs/exception/test/Jamfile.v2 2010-09-01 03:59:35 EDT (Wed, 01 Sep 2010)
@@ -7,7 +7,12 @@
 
 import testing ;
 
-project : requirements <exception-handling>on <define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ;
+project
+ : requirements
+ <exception-handling>on
+ <source>/boost//exception
+# <define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR
+ ;
 
 #to_string
 
@@ -36,7 +41,7 @@
 run current_exception_cast_test.cpp ;
 run no_exceptions_test.cpp : : : <exception-handling>off ;
 run errinfos_test.cpp ;
-run exception_ptr_test.cpp /boost//thread /boost//exception : : : <threading>multi ;
+run exception_ptr_test.cpp /boost//thread : : : <threading>multi ;
 
 compile-fail exception_fail.cpp ;
 compile-fail throw_exception_fail.cpp ;

Modified: trunk/libs/exception/test/exception_ptr_test.cpp
==============================================================================
--- trunk/libs/exception/test/exception_ptr_test.cpp (original)
+++ trunk/libs/exception/test/exception_ptr_test.cpp 2010-09-01 03:59:35 EDT (Wed, 01 Sep 2010)
@@ -84,7 +84,8 @@
         ++exc_count;
         }
 
- ~exc()
+ virtual
+ ~exc() throw()
         {
         --exc_count;
         }


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