diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-08-19 23:25:59 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-08-20 00:09:53 +0300 |
commit | 759857fab05dac463877ff6ef8b8776ff2076f47 (patch) | |
tree | 4fe3b988759a9301a8ad04cbd4abc83765d549e3 /contrib/restricted/googletest/googlemock/include/gmock | |
parent | fe66a32be1aa1ad38fecdd32a7c4fd1ba72d3685 (diff) | |
download | ydb-759857fab05dac463877ff6ef8b8776ff2076f47.tar.gz |
Update contrib/restricted/googletest to 1.14.0
Diffstat (limited to 'contrib/restricted/googletest/googlemock/include/gmock')
10 files changed, 144 insertions, 117 deletions
diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-actions.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-actions.h index aad07d51cc..bd9ba73ee6 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-actions.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-actions.h @@ -146,10 +146,7 @@ #include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-pp.h" -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) namespace testing { @@ -614,7 +611,7 @@ class DefaultValue { private: class ValueProducer { public: - virtual ~ValueProducer() {} + virtual ~ValueProducer() = default; virtual T Produce() = 0; }; @@ -702,8 +699,8 @@ class ActionInterface { typedef typename internal::Function<F>::Result Result; typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; - ActionInterface() {} - virtual ~ActionInterface() {} + ActionInterface() = default; + virtual ~ActionInterface() = default; // Performs the action. This method is not const, as in general an // action can have side effects and be stateful. For example, a @@ -752,7 +749,7 @@ class Action<R(Args...)> { // Constructs a null Action. Needed for storing Action objects in // STL containers. - Action() {} + Action() = default; // Construct an Action from a specified callable. // This cannot take std::function directly, because then Action would not be @@ -1276,7 +1273,7 @@ class AssignAction { const T2 value_; }; -#if !GTEST_OS_WINDOWS_MOBILE +#ifndef GTEST_OS_WINDOWS_MOBILE // Implements the SetErrnoAndReturn action to simulate return from // various system calls and libc functions. @@ -1420,19 +1417,19 @@ struct WithArgsAction { // providing a call operator because even with a particular set of arguments // they don't have a fixed return type. - template <typename R, typename... Args, - typename std::enable_if< - std::is_convertible< - InnerAction, - // Unfortunately we can't use the InnerSignature alias here; - // MSVC complains about the I parameter pack not being - // expanded (error C3520) despite it being expanded in the - // type alias. - // TupleElement is also an MSVC workaround. - // See its definition for details. - OnceAction<R(internal::TupleElement< - I, std::tuple<Args...>>...)>>::value, - int>::type = 0> + template < + typename R, typename... Args, + typename std::enable_if< + std::is_convertible<InnerAction, + // Unfortunately we can't use the InnerSignature + // alias here; MSVC complains about the I + // parameter pack not being expanded (error C3520) + // despite it being expanded in the type alias. + // TupleElement is also an MSVC workaround. + // See its definition for details. + OnceAction<R(internal::TupleElement< + I, std::tuple<Args...>>...)>>::value, + int>::type = 0> operator OnceAction<R(Args...)>() && { // NOLINT struct OA { OnceAction<InnerSignature<R, Args...>> inner_action; @@ -1447,19 +1444,19 @@ struct WithArgsAction { return OA{std::move(inner_action)}; } - template <typename R, typename... Args, - typename std::enable_if< - std::is_convertible< - const InnerAction&, - // Unfortunately we can't use the InnerSignature alias here; - // MSVC complains about the I parameter pack not being - // expanded (error C3520) despite it being expanded in the - // type alias. - // TupleElement is also an MSVC workaround. - // See its definition for details. - Action<R(internal::TupleElement< - I, std::tuple<Args...>>...)>>::value, - int>::type = 0> + template < + typename R, typename... Args, + typename std::enable_if< + std::is_convertible<const InnerAction&, + // Unfortunately we can't use the InnerSignature + // alias here; MSVC complains about the I + // parameter pack not being expanded (error C3520) + // despite it being expanded in the type alias. + // TupleElement is also an MSVC workaround. + // See its definition for details. + Action<R(internal::TupleElement< + I, std::tuple<Args...>>...)>>::value, + int>::type = 0> operator Action<R(Args...)>() const { // NOLINT Action<InnerSignature<R, Args...>> converted(inner_action); @@ -1929,7 +1926,7 @@ PolymorphicAction<internal::AssignAction<T1, T2>> Assign(T1* ptr, T2 val) { return MakePolymorphicAction(internal::AssignAction<T1, T2>(ptr, val)); } -#if !GTEST_OS_WINDOWS_MOBILE +#ifndef GTEST_OS_WINDOWS_MOBILE // Creates an action that sets errno and returns the appropriate error. template <typename T> @@ -2295,8 +2292,6 @@ template <typename F, typename Impl> } // namespace testing -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 #endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-cardinalities.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-cardinalities.h index b6ab648e50..533e604f32 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-cardinalities.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-cardinalities.h @@ -65,7 +65,7 @@ namespace testing { // The implementation of a cardinality. class CardinalityInterface { public: - virtual ~CardinalityInterface() {} + virtual ~CardinalityInterface() = default; // Conservative estimate on the lower/upper bound of the number of // calls allowed. @@ -92,7 +92,7 @@ class GTEST_API_ Cardinality { public: // Constructs a null cardinality. Needed for storing Cardinality // objects in STL containers. - Cardinality() {} + Cardinality() = default; // Constructs a Cardinality from its implementation. explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-function-mocker.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-function-mocker.h index 73065493b3..1a1f126e49 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-function-mocker.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-function-mocker.h @@ -180,8 +180,9 @@ using internal::FunctionMocker; _Signature)>::Result \ GMOCK_INTERNAL_EXPAND(_CallType) \ _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \ - GMOCK_PP_IF(_Constness, const, ) _RefSpec _NoexceptSpec \ - GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \ + GMOCK_PP_IF(_Constness, const, ) \ + _RefSpec _NoexceptSpec GMOCK_PP_IF(_Override, override, ) \ + GMOCK_PP_IF(_Final, final, ) { \ GMOCK_MOCKER_(_N, _Constness, _MethodName) \ .SetOwnerAndName(this, #_MethodName); \ return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-matchers.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-matchers.h index 9e634f7f1c..0f67713776 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-matchers.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-matchers.h @@ -257,6 +257,8 @@ #include <algorithm> #include <cmath> +#include <exception> +#include <functional> #include <initializer_list> #include <ios> #include <iterator> @@ -562,7 +564,7 @@ namespace internal { // If the explanation is not empty, prints it to the ostream. inline void PrintIfNotEmpty(const std::string& explanation, ::std::ostream* os) { - if (explanation != "" && os != nullptr) { + if (!explanation.empty() && os != nullptr) { *os << ", " << explanation; } } @@ -1199,27 +1201,27 @@ class PairMatchBase { }; }; -class Eq2Matcher : public PairMatchBase<Eq2Matcher, AnyEq> { +class Eq2Matcher : public PairMatchBase<Eq2Matcher, std::equal_to<>> { public: static const char* Desc() { return "an equal pair"; } }; -class Ne2Matcher : public PairMatchBase<Ne2Matcher, AnyNe> { +class Ne2Matcher : public PairMatchBase<Ne2Matcher, std::not_equal_to<>> { public: static const char* Desc() { return "an unequal pair"; } }; -class Lt2Matcher : public PairMatchBase<Lt2Matcher, AnyLt> { +class Lt2Matcher : public PairMatchBase<Lt2Matcher, std::less<>> { public: static const char* Desc() { return "a pair where the first < the second"; } }; -class Gt2Matcher : public PairMatchBase<Gt2Matcher, AnyGt> { +class Gt2Matcher : public PairMatchBase<Gt2Matcher, std::greater<>> { public: static const char* Desc() { return "a pair where the first > the second"; } }; -class Le2Matcher : public PairMatchBase<Le2Matcher, AnyLe> { +class Le2Matcher : public PairMatchBase<Le2Matcher, std::less_equal<>> { public: static const char* Desc() { return "a pair where the first <= the second"; } }; -class Ge2Matcher : public PairMatchBase<Ge2Matcher, AnyGe> { +class Ge2Matcher : public PairMatchBase<Ge2Matcher, std::greater_equal<>> { public: static const char* Desc() { return "a pair where the first >= the second"; } }; @@ -1473,6 +1475,7 @@ class SomeOfArrayMatcher { operator Matcher<U>() const { // NOLINT using RawU = typename std::decay<U>::type; std::vector<Matcher<RawU>> matchers; + matchers.reserve(matchers_.size()); for (const auto& matcher : matchers_) { matchers.push_back(MatcherCast<RawU>(matcher)); } @@ -2964,7 +2967,7 @@ class KeyMatcherImpl : public MatcherInterface<PairType> { const bool match = inner_matcher_.MatchAndExplain( pair_getters::First(key_value, Rank0()), &inner_listener); const std::string explanation = inner_listener.str(); - if (explanation != "") { + if (!explanation.empty()) { *listener << "whose first field is a value " << explanation; } return match; @@ -3111,12 +3114,12 @@ class PairMatcherImpl : public MatcherInterface<PairType> { const std::string& second_explanation, MatchResultListener* listener) const { *listener << "whose both fields match"; - if (first_explanation != "") { + if (!first_explanation.empty()) { *listener << ", where the first field is a value " << first_explanation; } - if (second_explanation != "") { + if (!second_explanation.empty()) { *listener << ", "; - if (first_explanation != "") { + if (!first_explanation.empty()) { *listener << "and "; } else { *listener << "where "; @@ -3317,8 +3320,8 @@ class FieldsAreMatcherImpl<Struct, IndexSequence<I...>> std::vector<StringMatchResultListener> inner_listener(sizeof...(I)); VariadicExpand( - {failed_pos == ~size_t{}&& !std::get<I>(matchers_).MatchAndExplain( - std::get<I>(tuple), &inner_listener[I]) + {failed_pos == ~size_t{} && !std::get<I>(matchers_).MatchAndExplain( + std::get<I>(tuple), &inner_listener[I]) ? failed_pos = I : 0 ...}); if (failed_pos != ~size_t{}) { @@ -5474,8 +5477,7 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage( inline name##Matcher GMOCK_INTERNAL_WARNING_PUSH() \ GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-function") \ GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-member-function") \ - name \ - GMOCK_INTERNAL_WARNING_POP()() { \ + name GMOCK_INTERNAL_WARNING_POP()() { \ return {}; \ } \ template <typename arg_type> \ @@ -5543,7 +5545,8 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage( \ private: \ ::std::string FormatDescription(bool negation) const { \ - ::std::string gmock_description = (description); \ + ::std::string gmock_description; \ + gmock_description = (description); \ if (!gmock_description.empty()) { \ return gmock_description; \ } \ diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-actions.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-actions.h index 148ac01721..40300766f0 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-actions.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-actions.h @@ -526,9 +526,10 @@ GMOCK_INTERNAL_LIST_##value_params)){}) \ GMOCK_ACTION_CLASS_(name, value_params)(const GMOCK_ACTION_CLASS_( \ name, value_params) &) noexcept GMOCK_INTERNAL_DEFN_COPY_ \ - ##value_params GMOCK_ACTION_CLASS_(name, value_params)( \ - GMOCK_ACTION_CLASS_(name, value_params) &&) noexcept \ - GMOCK_INTERNAL_DEFN_COPY_##value_params template <typename F> \ + ##value_params \ + GMOCK_ACTION_CLASS_(name, value_params)(GMOCK_ACTION_CLASS_( \ + name, value_params) &&) noexcept GMOCK_INTERNAL_DEFN_COPY_ \ + ##value_params template <typename F> \ operator ::testing::Action<F>() const { \ return GMOCK_PP_IF( \ GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \ @@ -582,10 +583,7 @@ namespace testing { // the macro definition, as the warnings are generated when the macro // is expanded and macro expansion cannot contain #pragma. Therefore // we suppress them here. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) namespace internal { @@ -602,13 +600,13 @@ template <std::size_t index, typename... Params> struct InvokeArgumentAction { template <typename... Args, typename = typename std::enable_if<(index < sizeof...(Args))>::type> - auto operator()(Args&&... args) const -> decltype(internal::InvokeArgument( + auto operator()(Args &&...args) const -> decltype(internal::InvokeArgument( std::get<index>(std::forward_as_tuple(std::forward<Args>(args)...)), - std::declval<const Params&>()...)) { - internal::FlatTuple<Args&&...> args_tuple(FlatTupleConstructTag{}, - std::forward<Args>(args)...); - return params.Apply([&](const Params&... unpacked_params) { - auto&& callable = args_tuple.template Get<index>(); + std::declval<const Params &>()...)) { + internal::FlatTuple<Args &&...> args_tuple(FlatTupleConstructTag{}, + std::forward<Args>(args)...); + return params.Apply([&](const Params &...unpacked_params) { + auto &&callable = args_tuple.template Get<index>(); return internal::InvokeArgument( std::forward<decltype(callable)>(callable), unpacked_params...); }); @@ -648,14 +646,12 @@ struct InvokeArgumentAction { // later. template <std::size_t index, typename... Params> internal::InvokeArgumentAction<index, typename std::decay<Params>::type...> -InvokeArgument(Params&&... params) { +InvokeArgument(Params &&...params) { return {internal::FlatTuple<typename std::decay<Params>::type...>( internal::FlatTupleConstructTag{}, std::forward<Params>(params)...)}; } -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 } // namespace testing diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-matchers.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-matchers.h index d9a9210738..54ea68be96 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-matchers.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-more-matchers.h @@ -49,14 +49,11 @@ namespace testing { // Silence C4100 (unreferenced formal // parameter) for MSVC -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#if (_MSC_VER == 1900) +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) +#if defined(_MSC_VER) && (_MSC_VER == 1900) // and silence C4800 (C4800: 'int *const ': forcing value // to bool 'true' or 'false') for MSVC 14 -#pragma warning(disable : 4800) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800) #endif namespace internal { @@ -113,9 +110,10 @@ MATCHER(IsFalse, negation ? "is true" : "is false") { return !static_cast<bool>(arg); } -#ifdef _MSC_VER -#pragma warning(pop) +#if defined(_MSC_VER) && (_MSC_VER == 1900) +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4800 #endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 } // namespace testing diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-nice-strict.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-nice-strict.h index 4f0eb35db7..056d471417 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-nice-strict.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-nice-strict.h @@ -98,7 +98,7 @@ constexpr bool HasStrictnessModifier() { // deregistration. This guarantees that MockClass's constructor and destructor // run with the same level of strictness as its instance methods. -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW && \ +#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_MINGW) && \ (defined(_MSC_VER) || defined(__clang__)) // We need to mark these classes with this declspec to ensure that // the empty base class optimization is performed. diff --git a/contrib/restricted/googletest/googlemock/include/gmock/gmock-spec-builders.h b/contrib/restricted/googletest/googlemock/include/gmock/gmock-spec-builders.h index 4e498d8f54..78ca15d05e 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/gmock-spec-builders.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/gmock-spec-builders.h @@ -204,6 +204,9 @@ class GTEST_API_ UntypedFunctionMockerBase { using UntypedExpectations = std::vector<std::shared_ptr<ExpectationBase>>; + struct UninterestingCallCleanupHandler; + struct FailureCleanupHandler; + // Returns an Expectation object that references and co-owns exp, // which must be an expectation on this mock function. Expectation GetHandleOf(ExpectationBase* exp); @@ -563,7 +566,7 @@ class ExpectationSet { typedef Expectation::Set::value_type value_type; // Constructs an empty set. - ExpectationSet() {} + ExpectationSet() = default; // This single-argument ctor must not be explicit, in order to support the // ExpectationSet es = EXPECT_CALL(...); @@ -1396,6 +1399,41 @@ class Cleanup final { std::function<void()> f_; }; +struct UntypedFunctionMockerBase::UninterestingCallCleanupHandler { + CallReaction reaction; + std::stringstream& ss; + + ~UninterestingCallCleanupHandler() { + ReportUninterestingCall(reaction, ss.str()); + } +}; + +struct UntypedFunctionMockerBase::FailureCleanupHandler { + std::stringstream& ss; + std::stringstream& why; + std::stringstream& loc; + const ExpectationBase* untyped_expectation; + bool found; + bool is_excessive; + + ~FailureCleanupHandler() { + ss << "\n" << why.str(); + + if (!found) { + // No expectation matches this call - reports a failure. + Expect(false, nullptr, -1, ss.str()); + } else if (is_excessive) { + // We had an upper-bound violation and the failure message is in ss. + Expect(false, untyped_expectation->file(), untyped_expectation->line(), + ss.str()); + } else { + // We had an expected call and the matching expectation is + // described in ss. + Log(kInfo, loc.str() + ss.str(), 2); + } + } +}; + template <typename F> class FunctionMocker; @@ -1408,7 +1446,7 @@ class FunctionMocker<R(Args...)> final : public UntypedFunctionMockerBase { using ArgumentTuple = std::tuple<Args...>; using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>; - FunctionMocker() {} + FunctionMocker() = default; // There is no generally useful and implementable semantics of // copying a mock object, so copying a mock is usually a user error. @@ -1794,8 +1832,15 @@ R FunctionMocker<R(Args...)>::InvokeWith(ArgumentTuple&& args) // // We use RAII to do the latter in case R is void or a non-moveable type. In // either case we can't assign it to a local variable. - const Cleanup report_uninteresting_call( - [&] { ReportUninterestingCall(reaction, ss.str()); }); + // + // Note that std::bind() is essential here. + // We *don't* use any local callback types (like lambdas). + // Doing so slows down compilation dramatically because the *constructor* of + // std::function<T> is re-instantiated with different template + // parameters each time. + const UninterestingCallCleanupHandler report_uninteresting_call = { + reaction, ss + }; return PerformActionAndPrintResult(nullptr, std::move(args), ss.str(), ss); } @@ -1839,22 +1884,14 @@ R FunctionMocker<R(Args...)>::InvokeWith(ArgumentTuple&& args) // // We use RAII to do the latter in case R is void or a non-moveable type. In // either case we can't assign it to a local variable. - const Cleanup handle_failures([&] { - ss << "\n" << why.str(); - - if (!found) { - // No expectation matches this call - reports a failure. - Expect(false, nullptr, -1, ss.str()); - } else if (is_excessive) { - // We had an upper-bound violation and the failure message is in ss. - Expect(false, untyped_expectation->file(), untyped_expectation->line(), - ss.str()); - } else { - // We had an expected call and the matching expectation is - // described in ss. - Log(kInfo, loc.str() + ss.str(), 2); - } - }); + // + // Note that we *don't* use any local callback types (like lambdas) here. + // Doing so slows down compilation dramatically because the *constructor* of + // std::function<T> is re-instantiated with different template + // parameters each time. + const FailureCleanupHandler handle_failures = { + ss, why, loc, untyped_expectation, found, is_excessive + }; return PerformActionAndPrintResult(untyped_action, std::move(args), ss.str(), ss); diff --git a/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h b/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h index 36ab8e26a8..ead6d7c805 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -58,11 +58,7 @@ namespace internal { // Silence MSVC C4100 (unreferenced formal parameter) and // C4805('==': unsafe mix of type 'const int' and type 'const bool') -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#pragma warning(disable : 4805) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100 4805) // Joins a vector of strings as if they are fields of a tuple; returns // the joined string. @@ -228,7 +224,7 @@ class FailureReporterInterface { // The type of a failure (either non-fatal or fatal). enum FailureType { kNonfatal, kFatal }; - virtual ~FailureReporterInterface() {} + virtual ~FailureReporterInterface() = default; // Reports a failure that occurred at the given source file location. virtual void ReportFailure(FailureType type, const char* file, int line, @@ -315,7 +311,8 @@ GTEST_API_ WithoutMatchers GetWithoutMatchers(); // crashes). template <typename T> inline T Invalid() { - Assert(false, "", -1, "Internal error: attempt to return invalid value"); + Assert(/*condition=*/false, /*file=*/"", /*line=*/-1, + "Internal error: attempt to return invalid value"); #if defined(__GNUC__) || defined(__clang__) __builtin_unreachable(); #elif defined(_MSC_VER) @@ -468,8 +465,10 @@ struct Function<R(Args...)> { using MakeResultIgnoredValue = IgnoredValue(Args...); }; +#ifdef GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL template <typename R, typename... Args> constexpr size_t Function<R(Args...)>::ArgumentCount; +#endif // Workaround for MSVC error C2039: 'type': is not a member of 'std' // when std::tuple_element is used. @@ -480,9 +479,7 @@ using TupleElement = typename std::tuple_element<I, T>::type; bool Base64Unescape(const std::string& encoded, std::string* decoded); -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 4805 } // namespace internal } // namespace testing diff --git a/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-port.h b/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-port.h index f399e28b49..0fe58798d4 100644 --- a/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-port.h +++ b/contrib/restricted/googletest/googlemock/include/gmock/internal/gmock-port.h @@ -56,7 +56,7 @@ #include "gmock/internal/custom/gmock-port.h" #include "gtest/internal/gtest-port.h" -#if GTEST_HAS_ABSL +#ifdef GTEST_HAS_ABSL #error #include "absl/flags/declare.h" #error #include "absl/flags/flag.h" #endif @@ -73,7 +73,7 @@ #define GMOCK_FLAG(name) FLAGS_gmock_##name // Pick a command line flags implementation. -#if GTEST_HAS_ABSL +#ifdef GTEST_HAS_ABSL // Macros for defining flags. #define GMOCK_DEFINE_bool_(name, default_val, doc) \ |