summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-spec-builders.h
diff options
context:
space:
mode:
authorDerek Mauro <dmauro@google.com>2022-06-01 21:07:23 (GMT)
committerCopybara-Service <copybara-worker@google.com>2022-06-01 21:08:04 (GMT)
commit0320f517fd920866d918e564105d68fd4362040a (patch)
tree2bdf487ae48b0a51c41d7df0c22a438c22c9e004 /googlemock/include/gmock/gmock-spec-builders.h
parent548b13dc3c02b93f60eeff9a0cc6e11c1ea722ca (diff)
downloadgoogletest-0320f517fd920866d918e564105d68fd4362040a.zip
googletest-0320f517fd920866d918e564105d68fd4362040a.tar.gz
googletest-0320f517fd920866d918e564105d68fd4362040a.tar.bz2
Work around a maybe-uninitialized warning under GCC 12
Some Mock constructors insert the pointer to the Mock itself into a global registry. Since GCC cannot see how the pointer is used (only as an identifier), it cannot tell that the object doesn't need to be initialized at that point at all. Work around this by using uintptr_t instead. PiperOrigin-RevId: 452380347 Change-Id: Ia5a493057ed90719de1d0efab71de9a8a08ddf8b
Diffstat (limited to 'googlemock/include/gmock/gmock-spec-builders.h')
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index b2911bf..45cc605 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -61,6 +61,7 @@
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
+#include <cstdint>
#include <functional>
#include <map>
#include <memory>
@@ -404,22 +405,22 @@ class GTEST_API_ Mock {
// Tells Google Mock to allow uninteresting calls on the given mock
// object.
- static void AllowUninterestingCalls(const void* mock_obj)
+ static void AllowUninterestingCalls(uintptr_t mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Tells Google Mock to warn the user about uninteresting calls on
// the given mock object.
- static void WarnUninterestingCalls(const void* mock_obj)
+ static void WarnUninterestingCalls(uintptr_t mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Tells Google Mock to fail uninteresting calls on the given mock
// object.
- static void FailUninterestingCalls(const void* mock_obj)
+ static void FailUninterestingCalls(uintptr_t mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Tells Google Mock the given mock object is being destroyed and
// its entry in the call-reaction table should be removed.
- static void UnregisterCallReaction(const void* mock_obj)
+ static void UnregisterCallReaction(uintptr_t mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Returns the reaction Google Mock will have on uninteresting calls