mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Add support for C++17 noexcept as part of function type
This commit is contained in:
parent
a6a1f7f291
commit
1367d827d5
1 changed files with 29 additions and 20 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
// http://turtle.sourceforge.net
|
// http://turtle.sourceforge.net
|
||||||
//
|
//
|
||||||
// Copyright Mathieu Champlon 2012
|
// Copyright Mathieu Champlon 2012
|
||||||
|
// Copyright 2020-2025 Alexander Grund
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
|
@ -10,36 +11,44 @@
|
||||||
#define MOCK_SIGNATURE_HPP_INCLUDED
|
#define MOCK_SIGNATURE_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
|
#include <boost/preprocessor/empty.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock { namespace detail {
|
||||||
#define MOCK_NOARG
|
#define MOCK_STRIP_FUNCTION_QUALIFIERS(ne, cv, ref) \
|
||||||
#define MOCK_STRIP_FUNCTION_QUALIFIERS(cv, ref) \
|
|
||||||
template<typename R, typename... Args> \
|
template<typename R, typename... Args> \
|
||||||
struct strip_function_qualifiers<R(Args...) cv ref> \
|
struct strip_function_qualifiers<R(Args...) cv ref ne> \
|
||||||
{ \
|
{ \
|
||||||
using type = R(Args...); \
|
using type = R(Args...); \
|
||||||
}; \
|
}; \
|
||||||
template<typename R, typename... Args> \
|
template<typename R, typename... Args> \
|
||||||
struct strip_function_qualifiers<R(Args..., ...) cv ref> \
|
struct strip_function_qualifiers<R(Args..., ...) cv ref ne> \
|
||||||
{ \
|
{ \
|
||||||
using type = R(Args..., ...); \
|
using type = R(Args..., ...); \
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MOCK_STRIP_FUNCTION_QUALIFIERS_REF(cv) \
|
#define MOCK_STRIP_FUNCTION_QUALIFIERS_REF(ne, cv) \
|
||||||
MOCK_STRIP_FUNCTION_QUALIFIERS(cv, ) \
|
MOCK_STRIP_FUNCTION_QUALIFIERS(ne, cv, ) \
|
||||||
MOCK_STRIP_FUNCTION_QUALIFIERS(cv, &) \
|
MOCK_STRIP_FUNCTION_QUALIFIERS(ne, cv, &) \
|
||||||
MOCK_STRIP_FUNCTION_QUALIFIERS(cv, &&)
|
MOCK_STRIP_FUNCTION_QUALIFIERS(ne, cv, &&)
|
||||||
|
#define MOCK_STRIP_FUNCTION_QUALIFIERS_CV_REF(except_spec) \
|
||||||
|
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(except_spec, BOOST_PP_EMPTY()) \
|
||||||
|
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(except_spec, const) \
|
||||||
|
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(except_spec, volatile) \
|
||||||
|
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(except_spec, const volatile)
|
||||||
|
|
||||||
template<typename>
|
template<typename>
|
||||||
struct strip_function_qualifiers;
|
struct strip_function_qualifiers;
|
||||||
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(MOCK_NOARG)
|
MOCK_STRIP_FUNCTION_QUALIFIERS_CV_REF(BOOST_PP_EMPTY())
|
||||||
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(const)
|
|
||||||
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(volatile)
|
// C++17 includes noexcept in the function type
|
||||||
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(const volatile)
|
#if MOCK_CXX_VERSION >= 201703L
|
||||||
#undef MOCK_NOARG
|
MOCK_STRIP_FUNCTION_QUALIFIERS_CV_REF(noexcept)
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef MOCK_STRIP_FUNCTION_QUALIFIERS
|
#undef MOCK_STRIP_FUNCTION_QUALIFIERS
|
||||||
#undef MOCK_STRIP_FUNCTION_QUALIFIERS_REF
|
#undef MOCK_STRIP_FUNCTION_QUALIFIERS_REF
|
||||||
|
#undef MOCK_STRIP_FUNCTION_QUALIFIERS_CV_REF
|
||||||
|
|
||||||
template<typename M>
|
template<typename M>
|
||||||
struct signature;
|
struct signature;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue