summaryrefslogtreecommitdiffstats
path: root/googlemock/include
diff options
context:
space:
mode:
authorDerek Mauro <dmauro@google.com>2024-04-16 20:15:51 (GMT)
committerCopybara-Service <copybara-worker@google.com>2024-04-16 20:16:40 (GMT)
commit5a37b517ad4ab6738556f0284c256cae1466c5b4 (patch)
treec0da707ac6a19f0aacd05199bcd53d42a77481ed /googlemock/include
parent5197b1a8e6a1ef9f214f4aa537b0be17cbf91946 (diff)
downloadgoogletest-5a37b517ad4ab6738556f0284c256cae1466c5b4.zip
googletest-5a37b517ad4ab6738556f0284c256cae1466c5b4.tar.gz
googletest-5a37b517ad4ab6738556f0284c256cae1466c5b4.tar.bz2
Use `[[maybe_unused]]` when it is available to avoid
-Wused-but-marked-unused warnings PiperOrigin-RevId: 625430612 Change-Id: Ia9d2e47984e1e6f91966afae8a6750119ae69446
Diffstat (limited to 'googlemock/include')
-rw-r--r--googlemock/include/gmock/gmock-actions.h6
-rw-r--r--googlemock/include/gmock/gmock-matchers.h92
2 files changed, 49 insertions, 49 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index 7e17b30..cd12996 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -2174,9 +2174,9 @@ template <typename F, typename Impl>
}
#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \
- , const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_
-#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \
- const args_type& args GTEST_ATTRIBUTE_UNUSED_ GMOCK_PP_REPEAT( \
+ , GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED const arg##i##_type& arg##i
+#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \
+ GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED const args_type& args GMOCK_PP_REPEAT( \
GMOCK_INTERNAL_ARG_UNUSED, , 10)
#define GMOCK_INTERNAL_ARG(i, data, el) , const arg##i##_type& arg##i
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 6b6b437..33a6716 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -5445,47 +5445,47 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
// MATCHER* macros itself are listed below.
-#define MATCHER(name, description) \
- class name##Matcher \
- : public ::testing::internal::MatcherBaseImpl<name##Matcher> { \
- public: \
- template <typename arg_type> \
- class gmock_Impl : public ::testing::MatcherInterface<const arg_type&> { \
- public: \
- gmock_Impl() {} \
- bool MatchAndExplain( \
- const arg_type& arg, \
- ::testing::MatchResultListener* result_listener) const override; \
- void DescribeTo(::std::ostream* gmock_os) const override { \
- *gmock_os << FormatDescription(false); \
- } \
- void DescribeNegationTo(::std::ostream* gmock_os) const override { \
- *gmock_os << FormatDescription(true); \
- } \
- \
- private: \
- ::std::string FormatDescription(bool negation) const { \
- /* NOLINTNEXTLINE readability-redundant-string-init */ \
- ::std::string gmock_description = (description); \
- if (!gmock_description.empty()) { \
- return gmock_description; \
- } \
- return ::testing::internal::FormatMatcherDescription(negation, #name, \
- {}, {}); \
- } \
- }; \
- }; \
- 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()() { \
- return {}; \
- } \
- template <typename arg_type> \
- bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain( \
- const arg_type& arg, \
- ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_) \
- const
+#define MATCHER(name, description) \
+ class name##Matcher \
+ : public ::testing::internal::MatcherBaseImpl<name##Matcher> { \
+ public: \
+ template <typename arg_type> \
+ class gmock_Impl : public ::testing::MatcherInterface<const arg_type&> { \
+ public: \
+ gmock_Impl() {} \
+ bool MatchAndExplain( \
+ const arg_type& arg, \
+ ::testing::MatchResultListener* result_listener) const override; \
+ void DescribeTo(::std::ostream* gmock_os) const override { \
+ *gmock_os << FormatDescription(false); \
+ } \
+ void DescribeNegationTo(::std::ostream* gmock_os) const override { \
+ *gmock_os << FormatDescription(true); \
+ } \
+ \
+ private: \
+ ::std::string FormatDescription(bool negation) const { \
+ /* NOLINTNEXTLINE readability-redundant-string-init */ \
+ ::std::string gmock_description = (description); \
+ if (!gmock_description.empty()) { \
+ return gmock_description; \
+ } \
+ return ::testing::internal::FormatMatcherDescription(negation, #name, \
+ {}, {}); \
+ } \
+ }; \
+ }; \
+ 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()() { \
+ return {}; \
+ } \
+ template <typename arg_type> \
+ bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain( \
+ const arg_type& arg, \
+ GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED ::testing::MatchResultListener* \
+ result_listener) const
#define MATCHER_P(name, p0, description) \
GMOCK_INTERNAL_MATCHER(name, name##MatcherP, description, (#p0), (p0))
@@ -5567,11 +5567,11 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
} \
template <GMOCK_INTERNAL_MATCHER_TEMPLATE_PARAMS(args)> \
template <typename arg_type> \
- bool full_name<GMOCK_INTERNAL_MATCHER_TYPE_PARAMS(args)>::gmock_Impl< \
- arg_type>::MatchAndExplain(const arg_type& arg, \
- ::testing::MatchResultListener* \
- result_listener GTEST_ATTRIBUTE_UNUSED_) \
- const
+ bool full_name<GMOCK_INTERNAL_MATCHER_TYPE_PARAMS(args)>:: \
+ gmock_Impl<arg_type>::MatchAndExplain( \
+ const arg_type& arg, \
+ GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED ::testing:: \
+ MatchResultListener* result_listener) const
#define GMOCK_INTERNAL_MATCHER_TEMPLATE_PARAMS(args) \
GMOCK_PP_TAIL( \