Removes unused variables and functions.
This commit is contained in:
parent
844fa94976
commit
29be92385e
@ -1031,68 +1031,12 @@ class VoidNullaryFunctor {
|
|||||||
void operator()() { g_done = true; }
|
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 {
|
class Foo {
|
||||||
public:
|
public:
|
||||||
Foo() : value_(123) {}
|
Foo() : value_(123) {}
|
||||||
|
|
||||||
int Nullary() const { return value_; }
|
int Nullary() const { return value_; }
|
||||||
short Unary(long x) { return static_cast<short>(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:
|
private:
|
||||||
int value_;
|
int value_;
|
||||||
};
|
};
|
||||||
|
@ -956,6 +956,19 @@ TEST(ActionPnMacroTest, TypesAreCorrect) {
|
|||||||
Plus(1, 2, 3, 4, 5, 6, 7, 8, '9');
|
Plus(1, 2, 3, 4, 5, 6, 7, 8, '9');
|
||||||
PlusActionP10<int, int, int, int, int, int, int, int, int, char> a10 =
|
PlusActionP10<int, int, int, int, int, int, int, int, int, char> a10 =
|
||||||
Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, '0');
|
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
|
// Tests that an ACTION_P*() action can be explicitly instantiated
|
||||||
|
@ -1039,6 +1039,19 @@ TEST(MatcherPnMacroTest, TypesAreCorrect) {
|
|||||||
EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, '9');
|
EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, '9');
|
||||||
EqualsSumOfMatcherP10<int, int, int, int, int, int, int, int, int, char> a10 =
|
EqualsSumOfMatcherP10<int, int, int, int, int, int, int, int, int, char> a10 =
|
||||||
EqualsSumOf(1, 2, 3, 4, 5, 6, 7, 8, 9, '0');
|
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
|
// Tests that matcher-typed parameters can be used in Value() inside a
|
||||||
|
Loading…
Reference in New Issue
Block a user