CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError: "evaluates always" -> "always evaluates"
This commit is contained in:
parent
c1f719aa68
commit
391194579c
|
@ -2092,7 +2092,7 @@ void CheckOther::selfAssignmentError(const Token *tok, const std::string &varnam
|
|||
// Check is a comparison of two variables leads to condition, which is
|
||||
// always true or false.
|
||||
// For instance: int a = 1; if(isless(a,a)){...}
|
||||
// In this case isless(a,a) evaluates always to false.
|
||||
// In this case isless(a,a) always evaluates to false.
|
||||
//
|
||||
// Reference:
|
||||
// - http://www.cplusplus.com/reference/cmath/
|
||||
|
@ -2131,7 +2131,7 @@ void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError(const Token* to
|
|||
{
|
||||
const std::string strResult = result ? "true" : "false";
|
||||
reportError(tok, Severity::warning, "comparisonFunctionIsAlwaysTrueOrFalse",
|
||||
"Comparison of two identical variables with " + functionName + "(" + varName + "," + varName + ") evaluates always to " + strResult + ".\n"
|
||||
"Comparison of two identical variables with " + functionName + "(" + varName + "," + varName + ") always evaluates to " + strResult + ".\n"
|
||||
"The function " + functionName + " is designed to compare two variables. Calling this function with one variable (" + varName + ") "
|
||||
"for both parameters leads to a statement which is always " + strResult + ".");
|
||||
}
|
||||
|
|
|
@ -6077,27 +6077,27 @@ private:
|
|||
check("bool f(int x){\n"
|
||||
" return isless(x,x);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with isless(x,x) evaluates always to false.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with isless(x,x) always evaluates to false.\n", errout.str());
|
||||
|
||||
check("bool f(int x){\n"
|
||||
" return isgreater(x,x);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with isgreater(x,x) evaluates always to false.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with isgreater(x,x) always evaluates to false.\n", errout.str());
|
||||
|
||||
check("bool f(int x){\n"
|
||||
" return islessgreater(x,x);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with islessgreater(x,x) evaluates always to false.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with islessgreater(x,x) always evaluates to false.\n", errout.str());
|
||||
|
||||
check("bool f(int x){\n"
|
||||
" return islessequal(x,x);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with islessequal(x,x) evaluates always to true.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with islessequal(x,x) always evaluates to true.\n", errout.str());
|
||||
|
||||
check("bool f(int x){\n"
|
||||
" return isgreaterequal(x,x);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with isgreaterequal(x,x) evaluates always to true.\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of two identical variables with isgreaterequal(x,x) always evaluates to true.\n", errout.str());
|
||||
|
||||
// no warning should be reported for
|
||||
check("bool f(int x, int y){\n"
|
||||
|
|
Loading…
Reference in New Issue