Skip to content

Commit bb8342f

Browse files
committed
fixed misspelled word 'Comparision' --> 'Comparison'
1 parent 7c387f8 commit bb8342f

7 files changed

Lines changed: 27 additions & 27 deletions

File tree

lib/checkbufferoverrun.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ void CheckBufferOverrun::arrayIndexThenCheck()
20642064
return;
20652065

20662066
// skip comparison
2067-
if (tok->type() == Token::eComparisionOp && tok->strAt(2) == "&&")
2067+
if (tok->type() == Token::eComparisonOp && tok->strAt(2) == "&&")
20682068
tok = tok->tokAt(2);
20692069

20702070
// check if array index is ok

lib/checkother.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void CheckOther::clarifyCondition()
153153
for (const Token *tok2 = tok->tokAt(3); tok2; tok2 = tok2->next()) {
154154
if (tok2->str() == "(" || tok2->str() == "[")
155155
tok2 = tok2->link();
156-
else if (tok2->type() == Token::eComparisionOp) {
156+
else if (tok2->type() == Token::eComparisonOp) {
157157
// This might be a template
158158
if (!_tokenizer->isC() && Token::Match(tok2->previous(), "%var% <"))
159159
break;
@@ -1672,7 +1672,7 @@ void CheckOther::checkComparisonOfBoolWithInt()
16721672
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
16731673

16741674
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
1675-
if (tok->next() && tok->next()->type() == Token::eComparisionOp && (!tok->previous() || !tok->previous()->isArithmeticalOp()) && (!tok->tokAt(3) || !tok->tokAt(3)->isArithmeticalOp())) {
1675+
if (tok->next() && tok->next()->type() == Token::eComparisonOp && (!tok->previous() || !tok->previous()->isArithmeticalOp()) && (!tok->tokAt(3) || !tok->tokAt(3)->isArithmeticalOp())) {
16761676
const Token* const right = tok->tokAt(2);
16771677
if ((tok->varId() && right->isNumber()) || (tok->isNumber() && right->varId())) { // Comparing variable with number
16781678
const Token* varTok = tok;
@@ -3130,9 +3130,9 @@ void CheckOther::alwaysTrueFalseStringCompareError(const Token *tok, const std::
31303130
const std::string string2 = (str2.size() < stringLen) ? str2 : (str2.substr(0, stringLen-2) + "..");
31313131

31323132
reportError(tok, Severity::warning, "staticStringCompare",
3133-
"Unnecessary comparision of static strings.\n"
3133+
"Unnecessary comparison of static strings.\n"
31343134
"The compared strings, '" + string1 + "' and '" + string2 + "', are always " + (str1==str2?"identical":"unequal") + ". "
3135-
"Therefore the comparision is unnecessary and looks suspicious.");
3135+
"Therefore the comparison is unnecessary and looks suspicious.");
31363136
}
31373137

31383138
void CheckOther::alwaysTrueStringVariableCompareError(const Token *tok, const std::string& str1, const std::string& str2)
@@ -3158,7 +3158,7 @@ void CheckOther::checkModuloAlwaysTrueFalse()
31583158
void CheckOther::moduloAlwaysTrueFalseError(const Token* tok, const std::string& maxVal)
31593159
{
31603160
reportError(tok, Severity::warning, "moduloAlwaysTrueFalse",
3161-
"Comparision of modulo result is predetermined, because it is always less than " + maxVal + ".");
3161+
"Comparison of modulo result is predetermined, because it is always less than " + maxVal + ".");
31623162
}
31633163

31643164
//-----------------------------------------------------------------------------

lib/checkother.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ class CheckOther : public Check {
437437
"* using bool in bitwise expression\n"
438438
"* Suspicious use of ; at the end of 'if/for/while' statement.\n"
439439
"* incorrect usage of functions from ctype library.\n"
440-
"* Comparisions of modulo results that are always true/false.\n"
440+
"* Comparisons of modulo results that are always true/false.\n"
441441

442442
// optimisations
443443
"* optimisation: detect post increment/decrement\n";

lib/token.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void Token::update_property_info()
9797
_str == "<=" ||
9898
_str == ">" ||
9999
_str == ">=")
100-
_type = eComparisionOp;
100+
_type = eComparisonOp;
101101
else if (_str == "++" ||
102102
_str == "--")
103103
_type = eIncDecOp;

lib/token.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class Token {
4747
enum Type {
4848
eVariable, eType, eFunction, eName, // Names: Variable (varId), Type (typeId, later), Function (FuncId, later), Name (unknown identifier)
4949
eNumber, eString, eChar, eBoolean, eLiteral, // Literals: Number, String, Character, User defined literal (C++11)
50-
eArithmeticalOp, eComparisionOp, eAssignmentOp, eLogicalOp, eBitOp, eIncDecOp, eExtendedOp, // Operators: Arithmetical, Comparision, Assignment, Logical, Bitwise, ++/--, Extended
51-
eBracket, // {, }, <, >: < and > only if link() is set. Otherwise they are comparision operators.
50+
eArithmeticalOp, eComparisonOp, eAssignmentOp, eLogicalOp, eBitOp, eIncDecOp, eExtendedOp, // Operators: Arithmetical, Comparison, Assignment, Logical, Bitwise, ++/--, Extended
51+
eBracket, // {, }, <, >: < and > only if link() is set. Otherwise they are comparison operators.
5252
eOther,
5353
eNone
5454
};
@@ -178,7 +178,7 @@ class Token {
178178
bool isOp() const {
179179
return (isArithmeticalOp() ||
180180
_type == eLogicalOp ||
181-
_type == eComparisionOp ||
181+
_type == eComparisonOp ||
182182
_type == eBitOp);
183183
}
184184
bool isExtendedOp() const {

test/testother.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,21 +2668,21 @@ class TestOther : public TestFixture {
26682668
" b5 = a % 5 >= 5;\n"
26692669
" return a % 5 > 5;\n"
26702670
"}");
2671-
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
2672-
"[test.cpp:3]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
2673-
"[test.cpp:4]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
2674-
"[test.cpp:5]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
2675-
"[test.cpp:6]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
2676-
"[test.cpp:7]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n", errout.str());
2671+
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
2672+
"[test.cpp:3]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
2673+
"[test.cpp:4]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
2674+
"[test.cpp:5]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
2675+
"[test.cpp:6]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
2676+
"[test.cpp:7]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n", errout.str());
26772677

26782678
check("void f(bool& b1, bool& b2) {\n"
26792679
" b1 = bar() % 5 < 889;\n"
26802680
" if(x[593] % 5 <= 5)\n"
26812681
" b2 = x.a % 5 == 5;\n"
26822682
"}");
2683-
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
2684-
"[test.cpp:3]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n"
2685-
"[test.cpp:4]: (warning) Comparision of modulo result is predetermined, because it is always less than 5.\n", errout.str());
2683+
ASSERT_EQUALS("[test.cpp:2]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
2684+
"[test.cpp:3]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n"
2685+
"[test.cpp:4]: (warning) Comparison of modulo result is predetermined, because it is always less than 5.\n", errout.str());
26862686
}
26872687

26882688
void incorrectLogicOperator1() {
@@ -4196,7 +4196,7 @@ class TestOther : public TestFixture {
41964196
" std::cout << \"Equal\n\""
41974197
" }"
41984198
"}");
4199-
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparision of static strings.\n", errout.str());
4199+
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparison of static strings.\n", errout.str());
42004200

42014201
check_preprocess_suppress(
42024202
"int main()\n"
@@ -4206,7 +4206,7 @@ class TestOther : public TestFixture {
42064206
" std::cout << \"Equal\n\""
42074207
" }"
42084208
"}");
4209-
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparision of static strings.\n", errout.str());
4209+
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparison of static strings.\n", errout.str());
42104210

42114211
check_preprocess_suppress(
42124212
"#define MACRO \"Hotdog\"\n"
@@ -4217,7 +4217,7 @@ class TestOther : public TestFixture {
42174217
" std::cout << \"Equal\n\""
42184218
" }"
42194219
"}");
4220-
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparision of static strings.\n", errout.str());
4220+
ASSERT_EQUALS("[test.cpp:4]: (warning) Unnecessary comparison of static strings.\n", errout.str());
42214221

42224222
check_preprocess_suppress(
42234223
"int main()\n"
@@ -4237,7 +4237,7 @@ class TestOther : public TestFixture {
42374237
" std::cout << \"Equal\n\""
42384238
" }"
42394239
"}");
4240-
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparision of static strings.\n", errout.str());
4240+
ASSERT_EQUALS("[test.cpp:3]: (warning) Unnecessary comparison of static strings.\n", errout.str());
42414241

42424242
check(
42434243
"int foo(const char *buf)\n"
@@ -4255,15 +4255,15 @@ class TestOther : public TestFixture {
42554255
" std::cout << \"Equal\n\"\n"
42564256
" }\n"
42574257
"}");
4258-
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparision of static strings.\n", errout.str());
4258+
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparison of static strings.\n", errout.str());
42594259

42604260
check_preprocess_suppress(
42614261
"int main() {\n"
42624262
" if (\"str\" != \"str\") {\n"
42634263
" std::cout << \"Equal\n\"\n"
42644264
" }\n"
42654265
"}");
4266-
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparision of static strings.\n", errout.str());
4266+
ASSERT_EQUALS("[test.cpp:2]: (warning) Unnecessary comparison of static strings.\n", errout.str());
42674267

42684268
check_preprocess_suppress(
42694269
"int main() {\n"

test/testtoken.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ class TestToken : public TestFixture {
563563
for (test_op = comparisionOps.begin(); test_op != comparisionOps.end(); ++test_op) {
564564
Token tok(NULL);
565565
tok.str(*test_op);
566-
ASSERT_EQUALS(Token::eComparisionOp, tok.type());
566+
ASSERT_EQUALS(Token::eComparisonOp, tok.type());
567567
}
568568
Token tok(NULL);
569569
tok.str("++");

0 commit comments

Comments
 (0)