summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-spec-builders.h
diff options
context:
space:
mode:
authorVictor Costan <costan@gmail.com>2018-04-10 04:57:54 (GMT)
committerVictor Costan <costan@gmail.com>2018-04-12 07:48:30 (GMT)
commit1324e2d706d739217cceae361259a5cc01d1ff41 (patch)
tree70bb7c7b555713db2fe60166863bf147c8387d76 /googlemock/include/gmock/gmock-spec-builders.h
parentfdb57f85710ccb17076acb1870a881964f5e04af (diff)
downloadgoogletest-1324e2d706d739217cceae361259a5cc01d1ff41.zip
googletest-1324e2d706d739217cceae361259a5cc01d1ff41.tar.gz
googletest-1324e2d706d739217cceae361259a5cc01d1ff41.tar.bz2
Remove multiple inheritance from "unintesting call" mock classes.refs/pull/1557/head
Internal CL 156157936, which was published in commit fe402c27790ff1cc9a7e17c5d0aea4ebe7fd8a71, introduced undefined behavior by casting a base class (internal::{Naggy,Nice,Strict}Base<MockClass>, using the curiously recurring template pattern) pointer to a derived class ({Naggy,Nice,Strict}Mock<MockClass>), in the base class' constructor. At that point, the object isn't guaranteed to have taken on the shape of the derived class, and casting is undefined behavior. The undefined behavior was caught by Chrome's CFI build bot [1], and prevents rolling googletest past that commit / CL. This commit simplifies the {Naggy,Nice,Strict}Mock class hierarchy in a way that removes the undefined behavior. [1] https://www.chromium.org/developers/testing/control-flow-integrity
Diffstat (limited to 'googlemock/include/gmock/gmock-spec-builders.h')
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index 6d7f920..a7be7d1 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -103,11 +103,6 @@ class ExpectationTester;
// Base class for function mockers.
template <typename F> class FunctionMockerBase;
-// Uninteresting call behavior mixins.
-template <typename M> class NiceMockBase;
-template <typename M> class NaggyMockBase;
-template <typename M> class StrictMockBase;
-
// Protects the mock object registry (in class Mock), all function
// mockers, and all expectations.
//
@@ -408,13 +403,13 @@ class GTEST_API_ Mock {
friend class internal::FunctionMockerBase;
template <typename M>
- friend class internal::NiceMockBase;
+ friend class NiceMock;
template <typename M>
- friend class internal::NaggyMockBase;
+ friend class NaggyMock;
template <typename M>
- friend class internal::StrictMockBase;
+ friend class StrictMock;
// Tells Google Mock to allow uninteresting calls on the given mock
// object.