Skip to content

Commit

Permalink
Cherry-pick googletest/pull/2815
Browse files Browse the repository at this point in the history
Cherry-pick google/googletest#2815 to fix the
-Wdeprecated-copy warnings of recent versions of Clang (13 or later).

The patch was suggested by Mark Wachsler.

Change-Id: I0cc88543e7bc68af6292ddc3773dad38c459cc72
  • Loading branch information
wantehchang committed Apr 14, 2022
1 parent dac7181 commit 829a757
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 157 deletions.
2 changes: 2 additions & 0 deletions third_party/googletest/README.libaom
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ Local Modifications:
src
- Enable kErrorOnUninstantiatedParameterizedTest and
kErrorOnUninstantiatedTypeParameterizedTest in gtest.cc
- Cherry-pick https://github.com/google/googletest/pull/2815 to fix
Clang's -Wdeprecated-copy warnings.
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,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
Expand Down Expand Up @@ -687,13 +683,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.
Expand Down Expand Up @@ -754,13 +746,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
Expand Down Expand Up @@ -801,13 +789,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
Expand Down Expand Up @@ -864,8 +848,6 @@ class AssignAction {
private:
T1* const ptr_;
const T2 value_;

GTEST_DISALLOW_ASSIGN_(AssignAction);
};

#if !GTEST_OS_WINDOWS_MOBILE
Expand All @@ -887,8 +869,6 @@ class SetErrnoAndReturnAction {
private:
const int errno_;
const T result_;

GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction);
};

#endif // !GTEST_OS_WINDOWS_MOBILE
Expand Down Expand Up @@ -993,13 +973,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>
Expand Down Expand Up @@ -1436,13 +1412,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( \
Expand Down Expand Up @@ -1481,13 +1451,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> \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,12 @@
template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const;\
GMOCK_INTERNAL_DEFN_##value_params\
private:\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(\
new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
}\
GMOCK_INTERNAL_DEFN_##value_params\
private:\
GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
};\
template <GMOCK_INTERNAL_DECL_##template_params\
GMOCK_INTERNAL_DECL_TYPE_##value_params>\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,12 @@ $range k 0..n-1
template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const;\
GMOCK_INTERNAL_DEFN_##value_params\
private:\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\
template <typename F> operator ::testing::Action<F>() const {\
return ::testing::Action<F>(\
new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\
}\
GMOCK_INTERNAL_DEFN_##value_params\
private:\
GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\
};\
template <GMOCK_INTERNAL_DECL_##template_params\
GMOCK_INTERNAL_DECL_TYPE_##value_params>\
Expand Down
Loading

0 comments on commit 829a757

Please sign in to comment.