mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Improve check for std::uncaught_exceptions
GCC 8 on MinGW still warns about that. Check the version of the feature macro and add parens to ensure correct evaluation.
This commit is contained in:
parent
3980cc97e1
commit
d8809dca2a
2 changed files with 8 additions and 6 deletions
|
|
@ -25,8 +25,9 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_uncaught_exceptions) || defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||
# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
||||
#ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
||||
# if(defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411) || \
|
||||
(defined(_MSC_VER) && _MSC_VER >= 1900)
|
||||
# define MOCK_UNCAUGHT_EXCEPTIONS
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2012
|
||||
// Copyright 2012 Mathieu Champlon
|
||||
// Copyright 2025 Alexander Grund
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
|
@ -80,7 +81,7 @@ namespace mock { namespace detail {
|
|||
typedef safe_error<R, MOCK_ERROR_POLICY<R>> error_type;
|
||||
|
||||
public:
|
||||
function_impl() : context_(0), valid_(true), exceptions_(exceptions()), mutex_(std::make_shared<mutex>()) {}
|
||||
function_impl() : exceptions_(exceptions()), mutex_(std::make_shared<mutex>()) {}
|
||||
virtual ~function_impl()
|
||||
{
|
||||
if(valid_ && exceptions_ >= exceptions())
|
||||
|
|
@ -314,8 +315,8 @@ namespace mock { namespace detail {
|
|||
};
|
||||
|
||||
std::list<expectation_type> expectations_;
|
||||
context* context_;
|
||||
mutable bool valid_;
|
||||
context* context_ = nullptr;
|
||||
mutable bool valid_ = true;
|
||||
const int exceptions_;
|
||||
const std::shared_ptr<mutex> mutex_;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue