mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Merge pull request #40 from mat007/fix-c++17-compliance
Fix c++17 compliance
This commit is contained in:
commit
07c73ad616
5 changed files with 30 additions and 4 deletions
13
appveyor.yml
13
appveyor.yml
|
|
@ -9,11 +9,16 @@ skip_branch_with_pr: true
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
BOOST_ROOT: C:\Libraries\boost_1_59_0
|
BOOST: 1_59_0
|
||||||
TOOLSET: msvc-14.0
|
TOOLSET: msvc-14.0
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
BOOST_ROOT: C:\Libraries\boost_1_65_1
|
BOOST: 1_65_1
|
||||||
TOOLSET: msvc-14.1
|
TOOLSET: msvc-14.1
|
||||||
|
CXX_STANDARD: 14
|
||||||
|
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
# BOOST: 1_65_1
|
||||||
|
# TOOLSET: msvc-14.1
|
||||||
|
# CXX_STANDARD: 17
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- 32
|
- 32
|
||||||
|
|
@ -36,7 +41,9 @@ install:
|
||||||
- xsltproc -V
|
- xsltproc -V
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
- set BOOST_ROOT=C:\Libraries\boost_%BOOST%
|
||||||
- cd %BOOST_ROOT%
|
- cd %BOOST_ROOT%
|
||||||
- call bootstrap.bat
|
- call bootstrap.bat
|
||||||
- cd C:\projects\turtle\build
|
- cd C:\projects\turtle\build
|
||||||
- call build.bat --toolset=%TOOLSET% address-model=%PLATFORM% --build-type=complete %CONFIGURATION%
|
- if NOT "%CXX_STANDARD%"=="" set CXX_FLAGS=cxxflags=/std:c++%CXX_STANDARD%
|
||||||
|
- call build.bat --toolset=%TOOLSET% address-model=%PLATFORM% %CXX_FLAGS% --build-type=complete %CONFIGURATION%
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ Not yet released
|
||||||
* Fixed move-only type support in constraints
|
* Fixed move-only type support in constraints
|
||||||
* Added support for dereferencing in mock::equal
|
* Added support for dereferencing in mock::equal
|
||||||
* Added support for movable objects in mock::retrieve
|
* Added support for movable objects in mock::retrieve
|
||||||
|
* Fixed deprecation warning about std::uncaught_exception in c++17 for msvc
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,4 +94,11 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && (__cplusplus >= 201703L) || \
|
||||||
|
defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||||
|
# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
||||||
|
# define MOCK_UNCAUGHT_EXCEPTIONS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // MOCK_CONFIG_HPP_INCLUDED
|
#endif // MOCK_CONFIG_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,15 @@ namespace detail
|
||||||
|
|
||||||
E* e_;
|
E* e_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline int uncaught_exceptions()
|
||||||
|
{
|
||||||
|
#ifdef MOCK_UNCAUGHT_EXCEPTIONS
|
||||||
|
return std::uncaught_exceptions();
|
||||||
|
#else
|
||||||
|
return std::uncaught_exception() ? 1 : 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // mock
|
} // mock
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,11 @@ namespace detail
|
||||||
: context_( 0 )
|
: context_( 0 )
|
||||||
, valid_( true )
|
, valid_( true )
|
||||||
, mutex_( boost::make_shared< mutex >() )
|
, mutex_( boost::make_shared< mutex >() )
|
||||||
|
, exceptions_( uncaught_exceptions() )
|
||||||
{}
|
{}
|
||||||
virtual ~function_impl()
|
virtual ~function_impl()
|
||||||
{
|
{
|
||||||
if( valid_ && ! std::uncaught_exception() )
|
if( valid_ && exceptions_ >= uncaught_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() )
|
||||||
|
|
@ -300,6 +301,7 @@ namespace detail
|
||||||
expectations_type expectations_;
|
expectations_type expectations_;
|
||||||
context* context_;
|
context* context_;
|
||||||
mutable bool valid_;
|
mutable bool valid_;
|
||||||
|
const int exceptions_;
|
||||||
const boost::shared_ptr< mutex > mutex_;
|
const boost::shared_ptr< mutex > mutex_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue