From 12d740faef11779b27b17c558ca92622bc0d2b54 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Thu, 17 Sep 2009 05:04:08 +0000 Subject: Makes gtest compile clean with MSVC's warning 4100 (unused formal parameter) enabled. --- include/gtest/internal/gtest-internal.h | 4 ++-- scons/SConstruct.common | 4 ---- src/gtest.cc | 3 ++- test/gtest-death-test_test.cc | 7 ++++--- test/gtest-listener_test.cc | 22 +++++++++++----------- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 72272d9..49e104a 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -725,8 +725,8 @@ class TypeParameterizedTestCase { template class TypeParameterizedTestCase { public: - static bool Register(const char* prefix, const char* case_name, - const char* test_names) { + static bool Register(const char* /*prefix*/, const char* /*case_name*/, + const char* /*test_names*/) { return true; } }; diff --git a/scons/SConstruct.common b/scons/SConstruct.common index 1407bd4..2fc0dde 100644 --- a/scons/SConstruct.common +++ b/scons/SConstruct.common @@ -99,10 +99,6 @@ class SConstructHelper: # Disables warnings that are either uninteresting or # hard to fix. - '/wd4100', - # unreferenced formal parameter. The violation is in - # gcc's TR1 tuple and hard to fix. - '/wd4127', # constant conditional expression. The macro # GTEST_IS_NULL_LITERAL_() triggers it and I cannot find diff --git a/src/gtest.cc b/src/gtest.cc index 677396d..5b33d31 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -4134,7 +4134,8 @@ TestInfoImpl::~TestInfoImpl() { // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. -String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, int skip_count) { +String GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, + int skip_count) { // We pass skip_count + 1 to skip this wrapper function in addition // to what the user really wants to skip. return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1); diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc index 1b0061a..7cc4caf 100644 --- a/test/gtest-death-test_test.cc +++ b/test/gtest-death-test_test.cc @@ -824,9 +824,10 @@ void MockDeathTestFactory::SetParameters(bool create, // Sets test to NULL (if create_ is false) or to the address of a new // MockDeathTest object with parameters taken from the last call // to SetParameters (if create_ is true). Always returns true. -bool MockDeathTestFactory::Create(const char* statement, - const ::testing::internal::RE* regex, - const char* file, int line, +bool MockDeathTestFactory::Create(const char* /*statement*/, + const ::testing::internal::RE* /*regex*/, + const char* /*file*/, + int /*line*/, DeathTest** test) { test_deleted_ = false; if (create_) { diff --git a/test/gtest-listener_test.cc b/test/gtest-listener_test.cc index fb6fcf4..75c2c18 100644 --- a/test/gtest-listener_test.cc +++ b/test/gtest-listener_test.cc @@ -74,47 +74,47 @@ class UnitTestAccessor { class EventRecordingListener : public UnitTestEventListenerInterface { protected: - virtual void OnUnitTestStart(const UnitTest& unit_test) { + virtual void OnUnitTestStart(const UnitTest& /*unit_test*/) { g_events->PushBack(String("TestEventListener::OnUnitTestStart")); } - virtual void OnGlobalSetUpStart(const UnitTest& unit_test) { + virtual void OnGlobalSetUpStart(const UnitTest& /*unit_test*/) { g_events->PushBack(String("TestEventListener::OnGlobalSetUpStart")); } - virtual void OnGlobalSetUpEnd(const UnitTest& unit_test) { + virtual void OnGlobalSetUpEnd(const UnitTest& /*unit_test*/) { g_events->PushBack(String("TestEventListener::OnGlobalSetUpEnd")); } - virtual void OnTestCaseStart(const TestCase& test_case) { + virtual void OnTestCaseStart(const TestCase& /*test_case*/) { g_events->PushBack(String("TestEventListener::OnTestCaseStart")); } - virtual void OnTestStart(const TestInfo& test_info) { + virtual void OnTestStart(const TestInfo& /*test_info*/) { g_events->PushBack(String("TestEventListener::OnTestStart")); } - virtual void OnNewTestPartResult(const TestPartResult& test_part_result) { + virtual void OnNewTestPartResult(const TestPartResult& /*test_part_result*/) { g_events->PushBack(String("TestEventListener::OnNewTestPartResult")); } - virtual void OnTestEnd(const TestInfo& test_info) { + virtual void OnTestEnd(const TestInfo& /*test_info*/) { g_events->PushBack(String("TestEventListener::OnTestEnd")); } - virtual void OnTestCaseEnd(const TestCase& test_case) { + virtual void OnTestCaseEnd(const TestCase& /*test_case*/) { g_events->PushBack(String("TestEventListener::OnTestCaseEnd")); } - virtual void OnGlobalTearDownStart(const UnitTest& unit_test) { + virtual void OnGlobalTearDownStart(const UnitTest& /*unit_test*/) { g_events->PushBack(String("TestEventListener::OnGlobalTearDownStart")); } - virtual void OnGlobalTearDownEnd(const UnitTest& unit_test) { + virtual void OnGlobalTearDownEnd(const UnitTest& /*unit_test*/) { g_events->PushBack(String("TestEventListener::OnGlobalTearDownEnd")); } - virtual void OnUnitTestEnd(const UnitTest& unit_test) { + virtual void OnUnitTestEnd(const UnitTest& /*unit_test*/) { g_events->PushBack(String("TestEventListener::OnUnitTestEnd")); } }; -- cgit v0.12