clarify precedence: made the short message shorter
This commit is contained in:
parent
33f743875b
commit
29422b8552
|
@ -127,7 +127,7 @@ void CheckOther::clarifyCalculationError(const Token *tok, char op)
|
|||
reportError(tok,
|
||||
Severity::style,
|
||||
"clarifyCalculation",
|
||||
"Suspicious calculation, " + calc + " can be clarified as either " + s1 + " or " + s2 + "\n" +
|
||||
std::string("Clarify calculation precedence for ") + op + " and ?\n" +
|
||||
"Suspicious calculation. Please use parentheses to clarify the code. "
|
||||
"The code " + calc + " should be written as either " + s1 + " or " + s2 + ".");
|
||||
}
|
||||
|
|
|
@ -2274,12 +2274,12 @@ private:
|
|||
check("int f(char c) {\n"
|
||||
" return 10 * (c == 0) ? 1 : 2;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Suspicious calculation, 'a*b?c:d' can be clarified as either '(a*b)?c:d' or 'a*(b?c:d)'\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Clarify calculation precedence for * and ?\n", errout.str());
|
||||
|
||||
check("void f(char c) {\n"
|
||||
" printf(\"%i\", 10 * (c == 0) ? 1 : 2);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Suspicious calculation, 'a*b?c:d' can be clarified as either '(a*b)?c:d' or 'a*(b?c:d)'\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Clarify calculation precedence for * and ?\n", errout.str());
|
||||
|
||||
// Ticket #2585 - segmentation fault for invalid code
|
||||
check("abcdef?" "?<"
|
||||
|
@ -2290,7 +2290,7 @@ private:
|
|||
check("void f(char c) {\n"
|
||||
" printf(\"%i\", 1 + 1 ? 1 : 2);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Suspicious calculation, 'a+b?c:d' can be clarified as either '(a+b)?c:d' or 'a+(b?c:d)'\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Clarify calculation precedence for + and ?\n", errout.str());
|
||||
}
|
||||
|
||||
// clarify conditions with = and comparison
|
||||
|
|
Loading…
Reference in New Issue