summaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock-matchers-misc_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2022-11-29 16:43:37 (GMT)
committerCopybara-Service <copybara-worker@google.com>2022-11-29 16:44:15 (GMT)
commita16bfcfda1ea994c1abec23cca8f530953042dfa (patch)
treeed86559e95c65a40b9508ab6e5393be0f98317bf /googlemock/test/gmock-matchers-misc_test.cc
parente68764c147ea0dac1e8811925c531d937396878e (diff)
downloadgoogletest-a16bfcfda1ea994c1abec23cca8f530953042dfa.zip
googletest-a16bfcfda1ea994c1abec23cca8f530953042dfa.tar.gz
googletest-a16bfcfda1ea994c1abec23cca8f530953042dfa.tar.bz2
Disables `-Wunused-member-function` and `-Wused-but-marked-unused` that trigger via `MOCK_METHOD()` and `EXPECT_THAT()` macros.
Fixes: #4052, #4055 PiperOrigin-RevId: 491647393 Change-Id: I8e2ad838156fa8c7e9dccd1740af797e694992b6
Diffstat (limited to 'googlemock/test/gmock-matchers-misc_test.cc')
-rw-r--r--googlemock/test/gmock-matchers-misc_test.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/googlemock/test/gmock-matchers-misc_test.cc b/googlemock/test/gmock-matchers-misc_test.cc
index 53f4962..42a0e44 100644
--- a/googlemock/test/gmock-matchers-misc_test.cc
+++ b/googlemock/test/gmock-matchers-misc_test.cc
@@ -1615,6 +1615,20 @@ TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
EXPECT_THAT(p, Not(UniquePointee(2)));
}
+MATCHER(EnsureNoUnusedButMarkedUnusedWarning, "") { return (arg % 2) == 0; }
+
+TEST(MockMethodMockFunctionTest, EnsureNoUnusedButMarkedUnusedWarning) {
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic error "-Wused-but-marked-unused"
+#endif
+ // https://github.com/google/googletest/issues/4055
+ EXPECT_THAT(0, EnsureNoUnusedButMarkedUnusedWarning());
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+}
+
#if GTEST_HAS_EXCEPTIONS
// std::function<void()> is used below for compatibility with older copies of