Use an internal symbol for deprecate-and-inline that allows

the use of a deprecation message

PiperOrigin-RevId: 807753856
Change-Id: I34b0c7c6faf34cad11ea2aca5ccd16bca16acdec
This commit is contained in:
Derek Mauro
2025-09-16 10:39:10 -07:00
committed by Copybara-Service
parent 4969d0ad54
commit 0934b7e112
3 changed files with 13 additions and 15 deletions
+4 -4
View File
@@ -1868,7 +1868,7 @@ typedef internal::IgnoredValue Unused;
// Deprecated single-argument DoAll.
template <typename Action>
GMOCK_DEPRECATE_AND_INLINE()
GTEST_INTERNAL_DEPRECATE_AND_INLINE("Avoid using DoAll() for single actions")
typename std::decay<Action>::type DoAll(Action&& action) {
return std::forward<Action>(action);
}
@@ -2038,11 +2038,11 @@ PolymorphicAction<internal::SetErrnoAndReturnAction<T>> SetErrnoAndReturn(
// Various overloads for Invoke().
// Legacy function.
// Actions can now be implicitly constructed from callables. No need to create
// wrapper objects.
// This function exists for backwards compatibility.
template <typename FunctionImpl>
GMOCK_DEPRECATE_AND_INLINE()
GTEST_INTERNAL_DEPRECATE_AND_INLINE(
"Actions can now be implicitly constructed from callables. No need to "
"create wrapper objects using Invoke().")
typename std::decay<FunctionImpl>::type Invoke(FunctionImpl&& function_impl) {
return std::forward<FunctionImpl>(function_impl);
}
+2 -11
View File
@@ -57,19 +57,10 @@
#include "gmock/internal/custom/gmock-port.h"
#include "gtest/internal/gtest-port.h"
#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)
#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS)
#include "absl/flags/declare.h"
#include "absl/flags/flag.h"
#endif // !defined(GTEST_NO_ABSL_FLAGS)
#else // defined(GTEST_HAS_ABSL)
#define GMOCK_DEPRECATE_AND_INLINE()
#endif // defined(GTEST_HAS_ABSL)
#endif
// For MS Visual C++, check the compiler version. At least VS 2015 is
// required to compile Google Mock.