Deprecate single-argument DoAll and Invoke.

PiperOrigin-RevId: 795969677
Change-Id: I56d88ec715475d91fb527a9281bc62574fb4608b
This commit is contained in:
Abseil Team
2025-08-16 20:08:07 -07:00
committed by Copybara-Service
parent 244cec869d
commit a05c091507
4 changed files with 59 additions and 51 deletions
+8
View File
@@ -1866,6 +1866,13 @@ struct RethrowAction {
// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
typedef internal::IgnoredValue Unused;
// Deprecated single-argument DoAll.
template <typename Action>
GMOCK_DEPRECATE_AND_INLINE()
typename std::decay<Action>::type DoAll(Action&& action) {
return std::forward<Action>(action);
}
// Creates an action that does actions a1, a2, ..., sequentially in
// each invocation. All but the last action will have a readonly view of the
// arguments.
@@ -2035,6 +2042,7 @@ PolymorphicAction<internal::SetErrnoAndReturnAction<T>> SetErrnoAndReturn(
// wrapper objects.
// This function exists for backwards compatibility.
template <typename FunctionImpl>
GMOCK_DEPRECATE_AND_INLINE()
typename std::decay<FunctionImpl>::type Invoke(FunctionImpl&& function_impl) {
return std::forward<FunctionImpl>(function_impl);
}
+11 -2
View File
@@ -57,10 +57,19 @@
#include "gmock/internal/custom/gmock-port.h"
#include "gtest/internal/gtest-port.h"
#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS)
#if defined(GTEST_HAS_ABSL)
#include "absl/base/macros.h"
#define GMOCK_DEPRECATE_AND_INLINE() ABSL_DEPRECATE_AND_INLINE()
#if !defined(GTEST_NO_ABSL_FLAGS)
#include "absl/flags/declare.h"
#include "absl/flags/flag.h"
#endif
#endif // !defined(GTEST_NO_ABSL_FLAGS)
#else // defined(GTEST_HAS_ABSL)
#define GMOCK_DEPRECATE_AND_INLINE()
#endif // defined(GTEST_HAS_ABSL)
// For MS Visual C++, check the compiler version. At least VS 2015 is
// required to compile Google Mock.