mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Fixed uncaught_exceptions usage with clang
For some reason clang seems so believe uncaught_exceptions does not belong to the std namespace:
no member named 'uncaught_exceptions' in namespace 'std'; did you mean
simply 'uncaught_exceptions'?
I haven't found any indication confirming this, but let's just support both…
This commit is contained in:
parent
9e572eca3e
commit
b8e8b6ffbf
3 changed files with 6 additions and 5 deletions
|
|
@ -94,7 +94,7 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus) && (__cplusplus >= 201703L) || \
|
#if defined(__cpp_lib_uncaught_exceptions) || \
|
||||||
defined(_MSC_VER) && (_MSC_VER >= 1900)
|
defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||||
# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
||||||
# define MOCK_UNCAUGHT_EXCEPTIONS
|
# define MOCK_UNCAUGHT_EXCEPTIONS
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,11 @@ namespace detail
|
||||||
E* e_;
|
E* e_;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int uncaught_exceptions()
|
inline int exceptions()
|
||||||
{
|
{
|
||||||
#ifdef MOCK_UNCAUGHT_EXCEPTIONS
|
#ifdef MOCK_UNCAUGHT_EXCEPTIONS
|
||||||
return std::uncaught_exceptions();
|
using namespace std;
|
||||||
|
return uncaught_exceptions();
|
||||||
#else
|
#else
|
||||||
return std::uncaught_exception() ? 1 : 0;
|
return std::uncaught_exception() ? 1 : 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,12 @@ namespace detail
|
||||||
function_impl()
|
function_impl()
|
||||||
: context_( 0 )
|
: context_( 0 )
|
||||||
, valid_( true )
|
, valid_( true )
|
||||||
|
, exceptions_( exceptions() )
|
||||||
, mutex_( boost::make_shared< mutex >() )
|
, mutex_( boost::make_shared< mutex >() )
|
||||||
, exceptions_( uncaught_exceptions() )
|
|
||||||
{}
|
{}
|
||||||
virtual ~function_impl()
|
virtual ~function_impl()
|
||||||
{
|
{
|
||||||
if( valid_ && exceptions_ >= uncaught_exceptions() )
|
if( valid_ && exceptions_ >= exceptions() )
|
||||||
for( expectations_cit it = expectations_.begin();
|
for( expectations_cit it = expectations_.begin();
|
||||||
it != expectations_.end(); ++it )
|
it != expectations_.end(); ++it )
|
||||||
if( ! it->verify() )
|
if( ! it->verify() )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue