diff options
author | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2020-04-16 15:52:17 -0400 |
---|---|---|
committer | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2020-04-23 22:22:07 -0400 |
commit | 766ac2e1a413e87d42d67e3286c70f0af4853679 (patch) | |
tree | c9768ae1a96fee8146c0327f90db0ce0be060b8d /googlemock/include/gmock/gmock-actions.h | |
parent | 4f002f1e236c1a0e7bdb096cd845f1a9c6c129c6 (diff) | |
download | googletest-766ac2e1a413e87d42d67e3286c70f0af4853679.tar.gz googletest-766ac2e1a413e87d42d67e3286c70f0af4853679.tar.bz2 googletest-766ac2e1a413e87d42d67e3286c70f0af4853679.zip |
Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_.
None of these are strictly needed for correctness.
A large number of them (maybe all of them?) trigger `-Wdeprecated`
warnings on Clang trunk as soon as you try to use the implicitly
defaulted (but deprecated) copy constructor of a class that has
deleted its copy assignment operator.
By declaring a deleted copy assignment operator, the old code
also caused the move constructor and move assignment operator
to be non-declared. This means that the old code never got move
semantics -- "move-construction" would simply call the defaulted
(but deprecated) copy constructor instead. With the new code,
"move-construction" calls the defaulted move constructor, which
I believe is what we want to happen. So this is a runtime
performance optimization.
Unfortunately we can't yet physically remove the definitions
of these macros from gtest-port.h, because they are being used
by other code internally at Google (according to zhangxy988).
But no new uses should be added going forward.
Diffstat (limited to 'googlemock/include/gmock/gmock-actions.h')
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index 615651b3..58089e3c 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -570,13 +570,9 @@ class PolymorphicAction { private: Impl impl_; - - GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); }; Impl impl_; - - GTEST_DISALLOW_ASSIGN_(PolymorphicAction); }; // Creates an Action from its implementation and returns it. The @@ -717,13 +713,9 @@ class ReturnAction { private: bool performed_; const std::shared_ptr<R> wrapper_; - - GTEST_DISALLOW_ASSIGN_(Impl); }; const std::shared_ptr<R> value_; - - GTEST_DISALLOW_ASSIGN_(ReturnAction); }; // Implements the ReturnNull() action. @@ -784,13 +776,9 @@ class ReturnRefAction { private: T& ref_; - - GTEST_DISALLOW_ASSIGN_(Impl); }; T& ref_; - - GTEST_DISALLOW_ASSIGN_(ReturnRefAction); }; // Implements the polymorphic ReturnRefOfCopy(x) action, which can be @@ -831,13 +819,9 @@ class ReturnRefOfCopyAction { private: T value_; - - GTEST_DISALLOW_ASSIGN_(Impl); }; const T value_; - - GTEST_DISALLOW_ASSIGN_(ReturnRefOfCopyAction); }; // Implements the polymorphic ReturnRoundRobin(v) action, which can be @@ -894,8 +878,6 @@ class AssignAction { private: T1* const ptr_; const T2 value_; - - GTEST_DISALLOW_ASSIGN_(AssignAction); }; #if !GTEST_OS_WINDOWS_MOBILE @@ -917,8 +899,6 @@ class SetErrnoAndReturnAction { private: const int errno_; const T result_; - - GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction); }; #endif // !GTEST_OS_WINDOWS_MOBILE @@ -1024,13 +1004,9 @@ class IgnoreResultAction { OriginalFunction; const Action<OriginalFunction> action_; - - GTEST_DISALLOW_ASSIGN_(Impl); }; const A action_; - - GTEST_DISALLOW_ASSIGN_(IgnoreResultAction); }; template <typename InnerAction, size_t... I> @@ -1467,13 +1443,7 @@ auto InvokeArgumentAdl(AdlTag, F f, Args... args) -> decltype(f(args...)) { template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \ return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ GMOCK_ACTION_FIELD_PARAMS_(params) \ - \ - private: \ - GTEST_DISALLOW_ASSIGN_(gmock_Impl); \ }; \ - \ - private: \ - GTEST_DISALLOW_ASSIGN_(full_name); \ }; \ template <GMOCK_ACTION_TYPENAME_PARAMS_(params)> \ inline full_name<GMOCK_ACTION_TYPE_PARAMS_(params)> name( \ @@ -1512,13 +1482,7 @@ auto InvokeArgumentAdl(AdlTag, F f, Args... args) -> decltype(f(args...)) { } \ template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \ return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ - \ - private: \ - GTEST_DISALLOW_ASSIGN_(gmock_Impl); \ }; \ - \ - private: \ - GTEST_DISALLOW_ASSIGN_(name##Action); \ }; \ inline name##Action name() { return name##Action(); } \ template <typename F> \ |