Commit Graph

4 Commits

Author SHA1 Message Date
Victor Costan
1324e2d706 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
e1071eb949 RE-Doing the merge, this time with gcc on mac in the PR so I can catch errors before merging the PR 2018-04-10 15:57:16 -04:00
Victor Costan
51f8ad47df Sync gmock-generated-nice-strict.h.pump with gmock-generated-nice-strict.h.
Commit fe402c2779 published the changes in
internal CL 156157936, but missed the diff in
gmock-generated-nice-strict.h.pump. This makes it difficult to reason
about the change, because the .pump file is more concise than the
generated file.

This PR was tested by re-generating the .h file using the command below
and checking the git diff.

./googletest/scripts/pump.py \
    googlemock/include/gmock/gmock-generated-nice-strict.h.pump
2018-04-06 17:21:05 -07:00
Billy Donahue
affb09edf0 move googlemock files into googlemock/ subdir 2015-08-25 17:47:18 -04:00