diff options
Diffstat (limited to 'googlemock/include/gmock')
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 8 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 2 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-more-actions.h | 2 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-spec-builders.h | 6 | ||||
-rw-r--r-- | googlemock/include/gmock/internal/gmock-internal-utils.h | 27 |
5 files changed, 9 insertions, 36 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index e921cf4a..9605c43a 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -532,7 +532,7 @@ class ReturnAction { // in the Impl class. But both definitions must be the same. typedef typename Function<F>::Result Result; GTEST_COMPILE_ASSERT_( - !is_reference<Result>::value, + !std::is_reference<Result>::value, use_ReturnRef_instead_of_Return_to_return_a_reference); static_assert(!std::is_void<Result>::value, "Can't use Return() on an action expected to return `void`."); @@ -561,7 +561,7 @@ class ReturnAction { Result Perform(const ArgumentTuple&) override { return value_; } private: - GTEST_COMPILE_ASSERT_(!is_reference<Result>::value, + GTEST_COMPILE_ASSERT_(!std::is_reference<Result>::value, Result_cannot_be_a_reference_type); // We save the value before casting just in case it is being cast to a // wrapper type. @@ -640,7 +640,7 @@ class ReturnRefAction { // Asserts that the function return type is a reference. This // catches the user error of using ReturnRef(x) when Return(x) // should be used, and generates some helpful error message. - GTEST_COMPILE_ASSERT_(internal::is_reference<Result>::value, + GTEST_COMPILE_ASSERT_(std::is_reference<Result>::value, use_Return_instead_of_ReturnRef_to_return_a_value); return Action<F>(new Impl<F>(ref_)); } @@ -687,7 +687,7 @@ class ReturnRefOfCopyAction { // catches the user error of using ReturnRefOfCopy(x) when Return(x) // should be used, and generates some helpful error message. GTEST_COMPILE_ASSERT_( - internal::is_reference<Result>::value, + std::is_reference<Result>::value, use_Return_instead_of_ReturnRefOfCopy_to_return_a_value); return Action<F>(new Impl<F>(value_)); } diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 7185390e..5fe38205 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -280,7 +280,7 @@ class SafeMatcherCastImpl { // Enforce that we are not converting a non-reference type T to a reference // type U. GTEST_COMPILE_ASSERT_( - internal::is_reference<T>::value || !internal::is_reference<U>::value, + std::is_reference<T>::value || !std::is_reference<U>::value, cannot_convert_non_reference_arg_to_reference); // In case both T and U are arithmetic types, enforce that the // conversion is not lossy. diff --git a/googlemock/include/gmock/gmock-more-actions.h b/googlemock/include/gmock/gmock-more-actions.h index a052495d..d42484ae 100644 --- a/googlemock/include/gmock/gmock-more-actions.h +++ b/googlemock/include/gmock/gmock-more-actions.h @@ -105,7 +105,7 @@ ACTION_TEMPLATE(SetArgReferee, // Ensures that argument #k is a reference. If you get a compiler // error on the next line, you are using SetArgReferee<k>(value) in // a mock function whose k-th (0-based) argument is not a reference. - GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value, + GTEST_COMPILE_ASSERT_(std::is_reference<argk_type>::value, SetArgReferee_must_be_used_with_a_reference_argument); ::std::get<k>(args) = value; } diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index 735a3bcb..0d1adda5 100644 --- a/googlemock/include/gmock/gmock-spec-builders.h +++ b/googlemock/include/gmock/gmock-spec-builders.h @@ -67,6 +67,7 @@ #include <set> #include <sstream> #include <string> +#include <type_traits> #include <utility> #include <vector> #include "gmock/gmock-actions.h" @@ -1653,9 +1654,8 @@ class FunctionMocker<R(Args...)> final : public UntypedFunctionMockerBase { const OnCallSpec<F>* const spec = FindOnCallSpec(args); if (spec == nullptr) { - *os << (internal::type_equals<Result, void>::value ? - "returning directly.\n" : - "returning default value.\n"); + *os << (std::is_void<Result>::value ? "returning directly.\n" + : "returning default value.\n"); } else { *os << "taking default action specified at:\n" << FormatFileLocation(spec->file(), spec->line()) << "\n"; diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index 4d754836..c49e28e2 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -106,25 +106,6 @@ inline Element* GetRawPointer(Element* p) { return p; } # define GMOCK_WCHAR_T_IS_NATIVE_ 1 #endif -// signed wchar_t and unsigned wchar_t are NOT in the C++ standard. -// Using them is a bad practice and not portable. So DON'T use them. -// -// Still, Google Mock is designed to work even if the user uses signed -// wchar_t or unsigned wchar_t (obviously, assuming the compiler -// supports them). -// -// To gcc, -// wchar_t == signed wchar_t != unsigned wchar_t == unsigned int -// -// gcc-9 appears to treat signed/unsigned wchar_t as ill-formed -// regardless of the signage of its underlying type. -#ifdef __GNUC__ -#if !defined(__WCHAR_UNSIGNED__) && (__GNUC__ < 9) -// signed/unsigned wchar_t are valid types. -# define GMOCK_HAS_SIGNED_WCHAR_T_ 1 -#endif -#endif - // In what follows, we use the term "kind" to indicate whether a type // is bool, an integer type (excluding bool), a floating-point type, // or none of them. This categorization is useful for determining @@ -355,14 +336,6 @@ GTEST_API_ WithoutMatchers GetWithoutMatchers(); // Type traits. -// is_reference<T>::value is non-zero if T is a reference type. -template <typename T> struct is_reference : public false_type {}; -template <typename T> struct is_reference<T&> : public true_type {}; - -// type_equals<T1, T2>::value is non-zero if T1 and T2 are the same type. -template <typename T1, typename T2> struct type_equals : public false_type {}; -template <typename T> struct type_equals<T, T> : public true_type {}; - // remove_reference<T>::type removes the reference from type T, if any. template <typename T> struct remove_reference { typedef T type; }; // NOLINT template <typename T> struct remove_reference<T&> { typedef T type; }; // NOLINT |