Fixes a slew of compiler warnings and turns on "warning as error" in the scons build.

This commit is contained in:
zhanyong.wan
2009-12-23 00:13:23 +00:00
parent 284b54d304
commit 32de5f5376
31 changed files with 703 additions and 105 deletions

View File

@@ -58,8 +58,11 @@ class InvokeAction {
Result Perform(const ArgumentTuple& args) {
return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args);
}
private:
FunctionImpl function_impl_;
GTEST_DISALLOW_ASSIGN_(InvokeAction);
};
// Implements the Invoke(object_ptr, &Class::Method) action.
@@ -74,9 +77,12 @@ class InvokeMethodAction {
return InvokeHelper<Result, ArgumentTuple>::InvokeMethod(
obj_ptr_, method_ptr_, args);
}
private:
Class* const obj_ptr_;
const MethodPtr method_ptr_;
GTEST_DISALLOW_ASSIGN_(InvokeMethodAction);
};
} // namespace internal
@@ -122,6 +128,16 @@ WithArg(const InnerAction& action) {
return internal::WithArgsAction<InnerAction, k>(action);
}
// 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
// Action ReturnArg<k>() returns the k-th argument of the mock function.
ACTION_TEMPLATE(ReturnArg,
HAS_1_TEMPLATE_PARAMS(int, k),
@@ -185,6 +201,10 @@ ACTION_TEMPLATE(DeleteArg,
ACTION_P(Throw, exception) { throw exception; }
#endif // GTEST_HAS_EXCEPTIONS
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace testing
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_