fixed misspelled word 'Comparision' --> 'Comparison'

This commit is contained in:
Ettl Martin 2012-04-26 23:04:55 +02:00
parent 7c387f8260
commit bb8342fbb4
7 changed files with 27 additions and 27 deletions

View File

@ -2064,7 +2064,7 @@ void CheckBufferOverrun::arrayIndexThenCheck()
return;
// skip comparison
if (tok->type() == Token::eComparisionOp && tok->strAt(2) == "&&")
if (tok->type() == Token::eComparisonOp && tok->strAt(2) == "&&")
tok = tok->tokAt(2);
// check if array index is ok

View File

@ -153,7 +153,7 @@ void CheckOther::clarifyCondition()
for (const Token *tok2 = tok->tokAt(3); tok2; tok2 = tok2->next()) {
if (tok2->str() == "(" || tok2->str() == "[")
tok2 = tok2->link();
else if (tok2->type() == Token::eComparisionOp) {
else if (tok2->type() == Token::eComparisonOp) {
// This might be a template
if (!_tokenizer->isC() && Token::Match(tok2->previous(), "%var% <"))
break;
@ -1672,7 +1672,7 @@ void CheckOther::checkComparisonOfBoolWithInt()
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
if (tok->next() && tok->next()->type() == Token::eComparisionOp && (!tok->previous() || !tok->previous()->isArithmeticalOp()) && (!tok->tokAt(3) || !tok->tokAt(3)->isArithmeticalOp())) {
if (tok->next() && tok->next()->type() == Token::eComparisonOp && (!tok->previous() || !tok->previous()->isArithmeticalOp()) && (!tok->tokAt(3) || !tok->tokAt(3)->isArithmeticalOp())) {
const Token* const right = tok->tokAt(2);
if ((tok->varId() && right->isNumber()) || (tok->isNumber() && right->varId())) { // Comparing variable with number
const Token* varTok = tok;
@ -3130,9 +3130,9 @@ void CheckOther::alwaysTrueFalseStringCompareError(const Token *tok, const std::
const std::string string2 = (str2.size() < stringLen) ? str2 : (str2.substr(0, stringLen-2) + "..");
reportError(tok, Severity::warning, "staticStringCompare",
"Unnecessary comparision of static strings.\n"
"Unnecessary comparison of static strings.\n"
"The compared strings, '" + string1 + "' and '" + string2 + "', are always " + (str1==str2?"identical":"unequal") + ". "
"Therefore the comparision is unnecessary and looks suspicious.");
"Therefore the comparison is unnecessary and looks suspicious.");
}
void CheckOther::alwaysTrueStringVariableCompareError(const Token *tok, const std::string& str1, const std::string& str2)
@ -3158,7 +3158,7 @@ void CheckOther::checkModuloAlwaysTrueFalse()
void CheckOther::moduloAlwaysTrueFalseError(const Token* tok, const std::string& maxVal)
{
reportError(tok, Severity::warning, "moduloAlwaysTrueFalse",
"Comparision of modulo result is predetermined, because it is always less than " + maxVal + ".");
"Comparison of modulo result is predetermined, because it is always less than " + maxVal + ".");
}
//-----------------------------------------------------------------------------

View File

@ -437,7 +437,7 @@ private:
"* using bool in bitwise expression\n"
"* Suspicious use of ; at the end of 'if/for/while' statement.\n"
"* incorrect usage of functions from ctype library.\n"
"* Comparisions of modulo results that are always true/false.\n"
"* Comparisons of modulo results that are always true/false.\n"
// optimisations
"* optimisation: detect post increment/decrement\n";

View File

@ -97,7 +97,7 @@ void Token::update_property_info()
_str == "<=" ||
_str == ">" ||
_str == ">=")
_type = eComparisionOp;
_type = eComparisonOp;
else if (_str == "++" ||
_str == "--")
_type = eIncDecOp;

View File

@ -47,8 +47,8 @@ public:
enum Type {
eVariable, eType, eFunction, eName, // Names: Variable (varId), Type (typeId, later), Function (FuncId, later), Name (unknown identifier)
eNumber, eString, eChar, eBoolean, eLiteral, // Literals: Number, String, Character, User defined literal (C++11)
eArithmeticalOp, eComparisionOp, eAssignmentOp, eLogicalOp, eBitOp, eIncDecOp, eExtendedOp, // Operators: Arithmetical, Comparision, Assignment, Logical, Bitwise, ++/--, Extended
eBracket, // {, }, <, >: < and > only if link() is set. Otherwise they are comparision operators.
eArithmeticalOp, eComparisonOp, eAssignmentOp, eLogicalOp, eBitOp, eIncDecOp, eExtendedOp, // Operators: Arithmetical, Comparison, Assignment, Logical, Bitwise, ++/--, Extended
eBracket, // {, }, <, >: < and > only if link() is set. Otherwise they are comparison operators.
eOther,
eNone
};
@ -178,7 +178,7 @@ public:
bool isOp() const {
return (isArithmeticalOp() ||
_type == eLogicalOp ||
_type == eComparisionOp ||
_type == eComparisonOp ||
_type == eBitOp);
}
bool isExtendedOp() const {

View File

@ -2668,21 +2668,21 @@ private:
" b5 = a % 5 >= 5;\n"
" return a % 5 > 5;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:3]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:4]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:5]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:6]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:7]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n", errout.str());
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:3]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:4]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:5]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:6]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:7]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n", errout.str());
check("void f(bool& b1, bool& b2) {\n"
" b1 = bar() % 5 < 889;\n"
" if(x[593] % 5 <= 5)\n"
" b2 = x.a % 5 == 5;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:3]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:4]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n", errout.str());
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:3]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
"[test.cpp:4]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n", errout.str());
}
void incorrectLogicOperator1() {
@ -4196,7 +4196,7 @@ private:
" std::cout << \"Equal\n\""
" }"
"}");
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparision of static strings.\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparison of static strings.\n", errout.str());
check_preprocess_suppress(
"int main()\n"
@ -4206,7 +4206,7 @@ private:
" std::cout << \"Equal\n\""
" }"
"}");
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparision of static strings.\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparison of static strings.\n", errout.str());
check_preprocess_suppress(
"#define MACRO \"Hotdog\"\n"
@ -4217,7 +4217,7 @@ private:
" std::cout << \"Equal\n\""
" }"
"}");
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparision of static strings.\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparison of static strings.\n", errout.str());
check_preprocess_suppress(
"int main()\n"
@ -4237,7 +4237,7 @@ private:
" std::cout << \"Equal\n\""
" }"
"}");
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparision of static strings.\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparison of static strings.\n", errout.str());
check(
"int foo(const char *buf)\n"
@ -4255,7 +4255,7 @@ private:
" std::cout << \"Equal\n\"\n"
" }\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparision of static strings.\n", errout.str());
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparison of static strings.\n", errout.str());
check_preprocess_suppress(
"int main() {\n"
@ -4263,7 +4263,7 @@ private:
" std::cout << \"Equal\n\"\n"
" }\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparision of static strings.\n", errout.str());
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparison of static strings.\n", errout.str());
check_preprocess_suppress(
"int main() {\n"

View File

@ -563,7 +563,7 @@ private:
for (test_op = comparisionOps.begin(); test_op != comparisionOps.end(); ++test_op) {
Token tok(NULL);
tok.str(*test_op);
ASSERT_EQUALS(Token::eComparisionOp, tok.type());
ASSERT_EQUALS(Token::eComparisonOp, tok.type());
}
Token tok(NULL);
tok.str("++");