aboutsummaryrefslogtreecommitdiffstats
path: root/test/gmock_link_test.h
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-12-23 00:13:23 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-12-23 00:13:23 +0000
commit32de5f53763125925e078498250f7e73a88de9ed (patch)
treecb5de0206e38598a12f10403de146faadcf9cdb0 /test/gmock_link_test.h
parent284b54d3047254a8787e4f5eb9ba62a866caaabd (diff)
downloadgoogletest-32de5f53763125925e078498250f7e73a88de9ed.tar.gz
googletest-32de5f53763125925e078498250f7e73a88de9ed.tar.bz2
googletest-32de5f53763125925e078498250f7e73a88de9ed.zip
Fixes a slew of compiler warnings and turns on "warning as error" in the scons build.
Diffstat (limited to 'test/gmock_link_test.h')
-rw-r--r--test/gmock_link_test.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/gmock_link_test.h b/test/gmock_link_test.h
index 40554bfe..d9635907 100644
--- a/test/gmock_link_test.h
+++ b/test/gmock_link_test.h
@@ -206,6 +206,8 @@ class Interface {
class Mock: public Interface {
public:
+ Mock() {}
+
MOCK_METHOD1(VoidFromString, void(char* str));
MOCK_METHOD1(StringFromString, char*(char* str));
MOCK_METHOD1(IntFromString, int(char* str));
@@ -215,6 +217,9 @@ class Mock: public Interface {
MOCK_METHOD1(VoidFromFloat, void(float n));
MOCK_METHOD1(VoidFromDouble, void(double n));
MOCK_METHOD1(VoidFromVector, void(const std::vector<int>& v));
+
+ private:
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock);
};
class InvokeHelper {
@@ -229,7 +234,7 @@ class InvokeHelper {
class FieldHelper {
public:
- FieldHelper(int field) : field_(field) {}
+ FieldHelper(int a_field) : field_(a_field) {}
int field() const { return field_; }
int field_; // NOLINT -- need external access to field_ to test
// the Field matcher.
@@ -410,6 +415,16 @@ TEST(LinkTest, TestThrow) {
}
#endif // GTEST_HAS_EXCEPTIONS
+// The ACTION*() macros trigger warning C4100 (unreferenced formal
+// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
+// the macro definition, as the warnings are generated when the macro
+// is expanded and macro expansion cannot contain #pragma. Therefore
+// we suppress them here.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4100)
+#endif
+
// Tests the linkage of actions created using ACTION macro.
namespace {
ACTION(Return1) { return 1; }
@@ -441,6 +456,10 @@ ACTION_P2(ReturnEqualsEitherOf, first, second) {
}
}
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
TEST(LinkTest, TestActionP2Macro) {
Mock mock;
char ch = 'x';