summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/internal
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/include/gmock/internal
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/include/gmock/internal')
-rw-r--r--googlemock/include/gmock/internal/gmock-internal-utils.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index 2678920..36ab8e2 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -95,6 +95,24 @@ inline Element* GetRawPointer(Element* p) {
return p;
}
+// Default definitions for all compilers.
+// NOTE: If you implement support for other compilers, make sure to avoid
+// unexpected overlaps.
+// (e.g., Clang also processes #pragma GCC, and clang-cl also handles _MSC_VER.)
+#define GMOCK_INTERNAL_WARNING_PUSH()
+#define GMOCK_INTERNAL_WARNING_CLANG(Level, Name)
+#define GMOCK_INTERNAL_WARNING_POP()
+
+#if defined(__clang__)
+#undef GMOCK_INTERNAL_WARNING_PUSH
+#define GMOCK_INTERNAL_WARNING_PUSH() _Pragma("clang diagnostic push")
+#undef GMOCK_INTERNAL_WARNING_CLANG
+#define GMOCK_INTERNAL_WARNING_CLANG(Level, Warning) \
+ _Pragma(GMOCK_PP_INTERNAL_STRINGIZE(clang diagnostic Level Warning))
+#undef GMOCK_INTERNAL_WARNING_POP
+#define GMOCK_INTERNAL_WARNING_POP() _Pragma("clang diagnostic pop")
+#endif
+
// MSVC treats wchar_t as a native type usually, but treats it as the
// same as unsigned short when the compiler option /Zc:wchar_t- is
// specified. It defines _NATIVE_WCHAR_T_DEFINED symbol when wchar_t