From 29be92385e118de1b2ef45daf38dfd1dabbea63f Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Fri, 1 Mar 2013 06:53:35 +0000 Subject: [PATCH] Removes unused variables and functions. --- test/gmock-actions_test.cc | 58 +-------------------------- test/gmock-generated-actions_test.cc | 13 ++++++ test/gmock-generated-matchers_test.cc | 13 ++++++ 3 files changed, 27 insertions(+), 57 deletions(-) diff --git a/test/gmock-actions_test.cc b/test/gmock-actions_test.cc index 1210d464..68bdadee 100644 --- a/test/gmock-actions_test.cc +++ b/test/gmock-actions_test.cc @@ -1031,68 +1031,12 @@ class VoidNullaryFunctor { void operator()() { g_done = true; } }; -bool Unary(int x) { return x < 0; } - -const char* Plus1(const char* s) { return s + 1; } - -void VoidUnary(int /* n */) { g_done = true; } - -bool ByConstRef(const std::string& s) { return s == "Hi"; } - -const double g_double = 0; -bool ReferencesGlobalDouble(const double& x) { return &x == &g_double; } - -std::string ByNonConstRef(std::string& s) { return s += "+"; } // NOLINT - -struct UnaryFunctor { - int operator()(bool x) { return x ? 1 : -1; } -}; - -const char* Binary(const char* input, short n) { return input + n; } // NOLINT - -void VoidBinary(int, char) { g_done = true; } - -int Ternary(int x, char y, short z) { return x + y + z; } // NOLINT - -void VoidTernary(int, char, bool) { g_done = true; } - -int SumOf4(int a, int b, int c, int d) { return a + b + c + d; } - -void VoidFunctionWithFourArguments(char, int, float, double) { g_done = true; } - -int SumOf5(int a, int b, int c, int d, int e) { return a + b + c + d + e; } - -struct SumOf5Functor { - int operator()(int a, int b, int c, int d, int e) { - return a + b + c + d + e; - } -}; - -int SumOf6(int a, int b, int c, int d, int e, int f) { - return a + b + c + d + e + f; -} - -struct SumOf6Functor { - int operator()(int a, int b, int c, int d, int e, int f) { - return a + b + c + d + e + f; - } -}; - class Foo { public: Foo() : value_(123) {} int Nullary() const { return value_; } - short Unary(long x) { return static_cast(value_ + x); } // NOLINT - std::string Binary(const std::string& str, char c) const { return str + c; } - int Ternary(int x, bool y, char z) { return value_ + x + y*z; } - int SumOf4(int a, int b, int c, int d) const { - return a + b + c + d + value_; - } - int SumOf5(int a, int b, int c, int d, int e) { return a + b + c + d + e; } - int SumOf6(int a, int b, int c, int d, int e, int f) { - return a + b + c + d + e + f; - } + private: int value_; }; diff --git a/test/gmock-generated-actions_test.cc b/test/gmock-generated-actions_test.cc index 436f1a2e..23f8c8b0 100644 --- a/test/gmock-generated-actions_test.cc +++ b/test/gmock-generated-actions_test.cc @@ -956,6 +956,19 @@ TEST(ActionPnMacroTest, TypesAreCorrect) { Plus(1, 2, 3, 4, 5, 6, 7, 8, '9'); PlusActionP10 a10 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, '0'); + + // Avoid "unused variable" warnings. + (void)a0; + (void)a1; + (void)a2; + (void)a3; + (void)a4; + (void)a5; + (void)a6; + (void)a7; + (void)a8; + (void)a9; + (void)a10; } // Tests that an ACTION_P*() action can be explicitly instantiated diff --git a/test/gmock-generated-matchers_test.cc b/test/gmock-generated-matchers_test.cc index 4b7e6e05..0a750de1 100644 --- a/test/gmock-generated-matchers_test.cc +++ b/test/gmock-generated-matchers_test.cc @@ -1039,6 +1039,19 @@ TEST(MatcherPnMacroTest, TypesAreCorrect) { EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, '9'); EqualsSumOfMatcherP10 a10 = EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, 9, '0'); + + // Avoid "unused variable" warnings. + (void)a0; + (void)a1; + (void)a2; + (void)a3; + (void)a4; + (void)a5; + (void)a6; + (void)a7; + (void)a8; + (void)a9; + (void)a10; } // Tests that matcher-typed parameters can be used in Value() inside a