Fixing a build glitch in the non-intrusive exception_ptr support (Authorized by Eric)

[SVN r72995]
This commit is contained in:
Emil Dotchevski
2011-07-10 05:45:57 +00:00
parent f5dc3715bc
commit a73deaa3f3
6 changed files with 60 additions and 17 deletions

View File

@ -5,7 +5,10 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying # 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) # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
alias boost_exception ; project boost/exception
lib boost_exception : ../src/clone_current_exception_msvc.cpp : <toolset>msvc ; : source-location ../src
: requirements <link>static
;
lib boost_exception : clone_current_exception_non_intrusive.cpp ;
boost-install boost_exception ; boost-install boost_exception ;

View File

@ -16,6 +16,12 @@ boost
namespace namespace
exception_detail exception_detail
{ {
class clone_base;
#ifdef BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR
int clone_current_exception_non_intrusive( clone_base const * & cloned );
#endif
namespace namespace
clone_current_exception_result clone_current_exception_result
{ {
@ -25,15 +31,12 @@ boost
int const not_supported=3; int const not_supported=3;
} }
class clone_base;
int clone_current_exception_msvc_x86( clone_base const * & cloned );
inline inline
int int
clone_current_exception( clone_base const * & cloned ) clone_current_exception( clone_base const * & cloned )
{ {
#if defined(BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR) && defined(_MSC_VER) && defined(_M_IX86) && !defined(_M_X64) #ifdef BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR
return clone_current_exception_msvc_x86(cloned); return clone_current_exception_non_intrusive(cloned);
#else #else
return clone_current_exception_result::not_supported; return clone_current_exception_result::not_supported;
#endif #endif

View File

@ -25,6 +25,7 @@
#include <stdexcept> #include <stdexcept>
#include <new> #include <new>
#include <ios> #include <ios>
#include <cstdlib>
namespace namespace
boost boost
@ -455,6 +456,8 @@ boost
{ {
BOOST_ASSERT(p); BOOST_ASSERT(p);
p.ptr_->rethrow(); p.ptr_->rethrow();
BOOST_ASSERT(0);
std::abort();
} }
inline inline

View File

@ -132,7 +132,17 @@ boost
} }
}; };
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility push (default)
# endif
#endif
class exception; class exception;
#if defined(__GNUC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# pragma GCC visibility pop
# endif
#endif
template <class T> template <class T>
class shared_ptr; class shared_ptr;

View File

@ -10,9 +10,13 @@
#error This file requires exception handling to be enabled. #error This file requires exception handling to be enabled.
#endif #endif
#if defined(_MSC_VER) && defined(_M_IX86) && !defined(_M_X64)
#include <boost/exception/detail/clone_current_exception.hpp> #include <boost/exception/detail/clone_current_exception.hpp>
#if defined(BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR) && defined(_MSC_VER) && defined(_M_IX86) && !defined(_M_X64)
//Non-intrusive cloning support implemented below, only for MSVC versions mentioned above.
//Thanks Anthony Williams!
#include <boost/exception/exception.hpp> #include <boost/exception/exception.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#ifndef BOOST_NO_RTTI #ifndef BOOST_NO_RTTI
@ -269,7 +273,7 @@ boost
exception_detail exception_detail
{ {
int int
clone_current_exception_msvc_x86( clone_base const * & cloned ) clone_current_exception_non_intrusive( clone_base const * & cloned )
{ {
BOOST_ASSERT(!cloned); BOOST_ASSERT(!cloned);
int result = clone_current_exception_result::not_supported; int result = clone_current_exception_result::not_supported;
@ -292,4 +296,25 @@ boost
} }
} }
#else
//On all other compilers, return clone_current_exception_result::not_supported.
//On such platforms, only the intrusive enable_current_exception() cloning will work.
#include <boost/config.hpp>
namespace
boost
{
namespace
exception_detail
{
int
clone_current_exception_non_intrusive( clone_base const * & )
{
return clone_current_exception_result::not_supported;
}
}
}
#endif #endif

View File

@ -11,8 +11,6 @@ project
: requirements : requirements
<link>static <link>static
<exception-handling>on <exception-handling>on
<source>/boost//exception
<define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR
; ;
#to_string #to_string
@ -42,6 +40,7 @@ run refcount_ptr_test.cpp ;
run current_exception_cast_test.cpp ; run current_exception_cast_test.cpp ;
run no_exceptions_test.cpp : : : <exception-handling>off ; run no_exceptions_test.cpp : : : <exception-handling>off ;
run errinfos_test.cpp ; run errinfos_test.cpp ;
run exception_ptr_test.cpp/<define>BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR /boost/exception /boost//thread : : : <threading>multi : non_intrusive_exception_ptr_test ;
run exception_ptr_test.cpp /boost//thread : : : <threading>multi ; run exception_ptr_test.cpp /boost//thread : : : <threading>multi ;
compile-fail exception_fail.cpp ; compile-fail exception_fail.cpp ;