Commit Graph

4 Commits

Author SHA1 Message Date
Gennadiy Civil
d6bfdebf36 merging 2018-04-12 14:00:38 -04:00
Victor Costan
75b1be4ad1 Remove multiple inheritance from "unintesting call" mock classes.
Internal CL 156157936, which was published in commit
fe402c2779, 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
2018-04-12 00:48:30 -07:00
Gennadiy Civil
f906f8446e Merging gMock, 2 2018-04-05 16:09:17 -04:00
Billy Donahue
affb09edf0 move googlemock files into googlemock/ subdir 2015-08-25 17:47:18 -04:00