Merge pull request #847 from stweil/master
Fix some typos in comments (found by codespell)
This commit is contained in:
commit
f4deb99fb5
|
@ -1658,7 +1658,7 @@ UML_LOOK = NO
|
||||||
# the class node. If there are many fields or methods and many nodes the
|
# the class node. If there are many fields or methods and many nodes the
|
||||||
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
|
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
|
||||||
# threshold limits the number of items for each type to make the size more
|
# threshold limits the number of items for each type to make the size more
|
||||||
# managable. Set this to 0 for no limit. Note that the threshold may be
|
# manageable. Set this to 0 for no limit. Note that the threshold may be
|
||||||
# exceeded by 50% before the limit is enforced.
|
# exceeded by 50% before the limit is enforced.
|
||||||
|
|
||||||
UML_LIMIT_NUM_FIELDS = 10
|
UML_LIMIT_NUM_FIELDS = 10
|
||||||
|
|
|
@ -58,7 +58,7 @@ _TIME_BITS is defined equal to 64 by user code when it wants 64-bit time
|
||||||
support from the GNU glibc. Code which does not define _TIME_BITS equal to 64
|
support from the GNU glibc. Code which does not define _TIME_BITS equal to 64
|
||||||
(or defines it to something else than 64) runs a risk of not being Y2038-proof.
|
(or defines it to something else than 64) runs a risk of not being Y2038-proof.
|
||||||
|
|
||||||
__USE_TIME_BITS64 is defined by the GNU glibc when it actualy provides 64-bit
|
__USE_TIME_BITS64 is defined by the GNU glibc when it actually provides 64-bit
|
||||||
time support. When this is defined, then all glibc symbols, barring bugs, are
|
time support. When this is defined, then all glibc symbols, barring bugs, are
|
||||||
Y2038-proof (but your code might have its own Y2038 bugs, if it handles signed
|
Y2038-proof (but your code might have its own Y2038 bugs, if it handles signed
|
||||||
32-bit Unix epoch values).
|
32-bit Unix epoch values).
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to load a library and prints warning/error messages
|
* Tries to load a library and prints warning/error messages
|
||||||
* @return false, if an error occured (except unknown XML elements)
|
* @return false, if an error occurred (except unknown XML elements)
|
||||||
*/
|
*/
|
||||||
static bool tryLoadLibrary(Library& destination, const char* basepath, const char* filename);
|
static bool tryLoadLibrary(Library& destination, const char* basepath, const char* filename);
|
||||||
|
|
||||||
|
|
|
@ -796,7 +796,7 @@ void CheckOther::invalidScanf()
|
||||||
|
|
||||||
bool format = false;
|
bool format = false;
|
||||||
|
|
||||||
// scan the string backwards, so we dont need to keep states
|
// scan the string backwards, so we don't need to keep states
|
||||||
const std::string &formatstr(formatToken->str());
|
const std::string &formatstr(formatToken->str());
|
||||||
for (unsigned int i = 1; i < formatstr.length(); i++) {
|
for (unsigned int i = 1; i < formatstr.length(); i++) {
|
||||||
if (formatstr[i] == '%')
|
if (formatstr[i] == '%')
|
||||||
|
|
|
@ -114,7 +114,7 @@ void CheckAssert::checkVariableAssignment(const Token* assignTok, const Scope *a
|
||||||
if (!prevVar)
|
if (!prevVar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Variable declared in inner scope in assert => dont warn
|
// Variable declared in inner scope in assert => don't warn
|
||||||
if (assertionScope != prevVar->scope()) {
|
if (assertionScope != prevVar->scope()) {
|
||||||
const Scope *s = prevVar->scope();
|
const Scope *s = prevVar->scope();
|
||||||
while (s && s != assertionScope)
|
while (s && s != assertionScope)
|
||||||
|
|
|
@ -193,7 +193,7 @@ void CheckBufferOverrun::outOfBoundsError(const Token *tok, const std::string &w
|
||||||
|
|
||||||
void CheckBufferOverrun::pointerOutOfBoundsError(const Token *tok, const Token *index, const MathLib::bigint indexvalue)
|
void CheckBufferOverrun::pointerOutOfBoundsError(const Token *tok, const Token *index, const MathLib::bigint indexvalue)
|
||||||
{
|
{
|
||||||
// The severity is portability instead of error since this ub doesnt
|
// The severity is portability instead of error since this ub doesn't
|
||||||
// cause bad behaviour on most implementations. people create out
|
// cause bad behaviour on most implementations. people create out
|
||||||
// of bounds pointers by intention.
|
// of bounds pointers by intention.
|
||||||
const std::string expr(tok ? tok->expressionString() : std::string(""));
|
const std::string expr(tok ? tok->expressionString() : std::string(""));
|
||||||
|
|
|
@ -2678,7 +2678,7 @@ void Tokenizer::setVarIdPass1()
|
||||||
const Token *tok3 = tok2->next();
|
const Token *tok3 = tok2->next();
|
||||||
if (!tok3->isStandardType() && tok3->str() != "void" && !Token::Match(tok3, "struct|union|class %type%") && tok3->str() != "." && !Token::Match(tok2->link()->previous(), "[&*]")) {
|
if (!tok3->isStandardType() && tok3->str() != "void" && !Token::Match(tok3, "struct|union|class %type%") && tok3->str() != "." && !Token::Match(tok2->link()->previous(), "[&*]")) {
|
||||||
if (!scopeStack.top().isExecutable) {
|
if (!scopeStack.top().isExecutable) {
|
||||||
// Detecting initializations with () in non-executable scope is hard and often impossible to be done safely. Thus, only treat code as a variable that definitly is one.
|
// Detecting initializations with () in non-executable scope is hard and often impossible to be done safely. Thus, only treat code as a variable that definitely is one.
|
||||||
decl = false;
|
decl = false;
|
||||||
bool rhs = false;
|
bool rhs = false;
|
||||||
for (; tok3; tok3 = tok3->nextArgumentBeforeCreateLinks2()) {
|
for (; tok3; tok3 = tok3->nextArgumentBeforeCreateLinks2()) {
|
||||||
|
@ -7299,7 +7299,7 @@ bool Tokenizer::IsScopeNoReturn(const Token *endScopeToken, bool *unknown) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't warn for nonglobal functions (class methods, functions hidden in namespaces) since they cant be configured yet
|
// don't warn for nonglobal functions (class methods, functions hidden in namespaces) since they can't be configured yet
|
||||||
// FIXME: when methods and namespaces can be configured properly, remove the "globalFunction" check
|
// FIXME: when methods and namespaces can be configured properly, remove the "globalFunction" check
|
||||||
if (globalFunction) {
|
if (globalFunction) {
|
||||||
reportError(endScopeToken->previous(),
|
reportError(endScopeToken->previous(),
|
||||||
|
|
|
@ -750,7 +750,7 @@ public:
|
||||||
* Token list: stores all tokens.
|
* Token list: stores all tokens.
|
||||||
*/
|
*/
|
||||||
TokenList list;
|
TokenList list;
|
||||||
// Implement tokens() as a wrapper for convinience when using the TokenList
|
// Implement tokens() as a wrapper for convenience when using the TokenList
|
||||||
const Token* tokens() const {
|
const Token* tokens() const {
|
||||||
return list.front();
|
return list.front();
|
||||||
}
|
}
|
||||||
|
|
|
@ -678,7 +678,7 @@ static void compilePrecedence2(Token *&tok, AST_state& state)
|
||||||
// - Nest the round bracket under the square bracket.
|
// - Nest the round bracket under the square bracket.
|
||||||
// - Nest what follows the lambda (if anything) with the lambda opening [
|
// - Nest what follows the lambda (if anything) with the lambda opening [
|
||||||
// - Compile the content of the lambda function as separate tree (this is done later)
|
// - Compile the content of the lambda function as separate tree (this is done later)
|
||||||
// this must be consistant with isLambdaCaptureList
|
// this must be consistent with isLambdaCaptureList
|
||||||
Token* squareBracket = tok;
|
Token* squareBracket = tok;
|
||||||
Token* roundBracket = squareBracket->link()->next();
|
Token* roundBracket = squareBracket->link()->next();
|
||||||
Token* curlyBracket = roundBracket->link()->next();
|
Token* curlyBracket = roundBracket->link()->next();
|
||||||
|
|
|
@ -2098,7 +2098,7 @@ static void execute(const Token *expr,
|
||||||
else if (expr->str() == "%")
|
else if (expr->str() == "%")
|
||||||
*result = result1 % result2;
|
*result = result1 % result2;
|
||||||
else if (expr->str() == "<<") {
|
else if (expr->str() == "<<") {
|
||||||
if (result2 < 0 || result1 < 0) { // dont perform UB
|
if (result2 < 0 || result1 < 0) { // don't perform UB
|
||||||
*error= true;
|
*error= true;
|
||||||
} else {
|
} else {
|
||||||
*result = result1 << result2;
|
*result = result1 << result2;
|
||||||
|
|
|
@ -209,7 +209,7 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// #7247: dont check return statements in nested functions..
|
// #7247: don't check return statements in nested functions..
|
||||||
check("int foo() {\n"
|
check("int foo() {\n"
|
||||||
" struct {\n"
|
" struct {\n"
|
||||||
" const char * name() { return \"abc\"; }\n"
|
" const char * name() { return \"abc\"; }\n"
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// #6313 - false postive: opposite conditions in nested if blocks when condition changed
|
// #6313 - false positive: opposite conditions in nested if blocks when condition changed
|
||||||
check("void Foo::Bar() {\n"
|
check("void Foo::Bar() {\n"
|
||||||
" if(var){\n"
|
" if(var){\n"
|
||||||
" --var;\n"
|
" --var;\n"
|
||||||
|
@ -1829,7 +1829,7 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (warning) Invalid test for overflow 'x+100<x'. Condition is always false unless there is overflow, and overflow is UB.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:2]: (warning) Invalid test for overflow 'x+100<x'. Condition is always false unless there is overflow, and overflow is UB.\n", errout.str());
|
||||||
|
|
||||||
check("void f(signed int x) {\n" // unsigned overflow => dont warn
|
check("void f(signed int x) {\n" // unsigned overflow => don't warn
|
||||||
" assert(x + 100U < x);\n"
|
" assert(x + 100U < x);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ private:
|
||||||
"}");
|
"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void garbageCode152() { // happened in travis, originaly from llvm clang code
|
void garbageCode152() { // happened in travis, originally from llvm clang code
|
||||||
const char* code = "template <bool foo = std::value &&>\n"
|
const char* code = "template <bool foo = std::value &&>\n"
|
||||||
"static std::string foo(char *Bla) {\n"
|
"static std::string foo(char *Bla) {\n"
|
||||||
" while (Bla[1] && Bla[1] != ',') }\n";
|
" while (Bla[1] && Bla[1] != ',') }\n";
|
||||||
|
|
|
@ -119,7 +119,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void test6() {
|
void test6() {
|
||||||
// dont crash
|
// don't crash
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" 1 == (two + three);\n"
|
" 1 == (two + three);\n"
|
||||||
" 2 != (two + three);\n"
|
" 2 != (two + three);\n"
|
||||||
|
|
|
@ -2134,7 +2134,7 @@ private:
|
||||||
"}", true);
|
"}", true);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// #5811 false postive: (error) Null pointer dereference
|
// #5811 false positive: (error) Null pointer dereference
|
||||||
check("using namespace std;\n"
|
check("using namespace std;\n"
|
||||||
"std::string itoip(int ip) {\n"
|
"std::string itoip(int ip) {\n"
|
||||||
" stringstream out;\n"
|
" stringstream out;\n"
|
||||||
|
|
|
@ -6046,7 +6046,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void testEvaluationOrderMacro() {
|
void testEvaluationOrderMacro() {
|
||||||
// macro, dont bailout (#7233)
|
// macro, don't bailout (#7233)
|
||||||
check((std::string("void f(int x) {\n"
|
check((std::string("void f(int x) {\n"
|
||||||
" return x + ") + Preprocessor::macroChar + "x++;\n"
|
" return x + ") + Preprocessor::macroChar + "x++;\n"
|
||||||
"}").c_str(), "test.c");
|
"}").c_str(), "test.c");
|
||||||
|
|
|
@ -444,7 +444,7 @@ private:
|
||||||
// #3130
|
// #3130
|
||||||
const char code2[] = "template <int n> struct vec {\n"
|
const char code2[] = "template <int n> struct vec {\n"
|
||||||
" vec() {}\n"
|
" vec() {}\n"
|
||||||
" vec(const vec<n-1>& v) {}\n" // <- never used dont instantiate
|
" vec(const vec<n-1>& v) {}\n" // <- never used don't instantiate
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"vec<4> v;";
|
"vec<4> v;";
|
||||||
|
|
|
@ -385,7 +385,7 @@ private:
|
||||||
|
|
||||||
ASSERT_EQUALS("if ( true )", tok("if ((unsigned char)1)")); // #4164
|
ASSERT_EQUALS("if ( true )", tok("if ((unsigned char)1)")); // #4164
|
||||||
ASSERT_EQUALS("f ( 200 )", tok("f((unsigned char)200)"));
|
ASSERT_EQUALS("f ( 200 )", tok("f((unsigned char)200)"));
|
||||||
ASSERT_EQUALS("f ( ( char ) 1234 )", tok("f((char)1234)")); // dont simplify downcast
|
ASSERT_EQUALS("f ( ( char ) 1234 )", tok("f((char)1234)")); // don't simplify downcast
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7965,7 +7965,7 @@ private:
|
||||||
testAst("QT_WA({},{x=0;});" // don't hang
|
testAst("QT_WA({},{x=0;});" // don't hang
|
||||||
"QT_WA({x=1;},{x=2;});"));
|
"QT_WA({x=1;},{x=2;});"));
|
||||||
ASSERT_EQUALS("xMACROtypeT=value1=,{({=",
|
ASSERT_EQUALS("xMACROtypeT=value1=,{({=",
|
||||||
testAst("x = { MACRO( { .type=T, .value=1 } ) }")); // dont hang: MACRO({..})
|
testAst("x = { MACRO( { .type=T, .value=1 } ) }")); // don't hang: MACRO({..})
|
||||||
|
|
||||||
|
|
||||||
// function pointer
|
// function pointer
|
||||||
|
|
|
@ -158,7 +158,7 @@ private:
|
||||||
"void f2() { f1(-4); }");
|
"void f2() { f1(-4); }");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// Dont warn for + and -
|
// Don't warn for + and -
|
||||||
check("void f1(int x) {"
|
check("void f1(int x) {"
|
||||||
" a = x + 5U;\n"
|
" a = x + 5U;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|
|
@ -656,7 +656,7 @@ private:
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(true, testValueOfX(code, 2U, 37));
|
ASSERT_EQUALS(true, testValueOfX(code, 2U, 37));
|
||||||
|
|
||||||
code = "void f(int x) {\n" // loop condition, x is assigned inside loop => dont use condition
|
code = "void f(int x) {\n" // loop condition, x is assigned inside loop => don't use condition
|
||||||
" a = x;\n" // don't assume that x can be 37
|
" a = x;\n" // don't assume that x can be 37
|
||||||
" while (x != 37) { x++; }\n"
|
" while (x != 37) { x++; }\n"
|
||||||
"}";
|
"}";
|
||||||
|
@ -682,7 +682,7 @@ private:
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(true, testValueOfX(code, 2U, 76));
|
ASSERT_EQUALS(true, testValueOfX(code, 2U, 76));
|
||||||
|
|
||||||
code = "void f(int x) {\n" // conditions inside loop, x is assigned inside do-while => dont use condition
|
code = "void f(int x) {\n" // conditions inside loop, x is assigned inside do-while => don't use condition
|
||||||
" a = x;\n"
|
" a = x;\n"
|
||||||
" do {\n"
|
" do {\n"
|
||||||
" if (x!=76) { x=do_something(); }\n"
|
" if (x!=76) { x=do_something(); }\n"
|
||||||
|
@ -690,7 +690,7 @@ private:
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(false, testValueOfX(code, 2U, 76));
|
ASSERT_EQUALS(false, testValueOfX(code, 2U, 76));
|
||||||
|
|
||||||
code = "void f(X x) {\n" // conditions inside loop, x is assigned inside do-while => dont use condition
|
code = "void f(X x) {\n" // conditions inside loop, x is assigned inside do-while => don't use condition
|
||||||
" a = x;\n"
|
" a = x;\n"
|
||||||
" for (i=1;i<=count;i++) {\n"
|
" for (i=1;i<=count;i++) {\n"
|
||||||
" BUGON(x==0)\n"
|
" BUGON(x==0)\n"
|
||||||
|
@ -1319,9 +1319,9 @@ private:
|
||||||
" ;\n" // <- no break
|
" ;\n" // <- no break
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" a = x;\n" // <- x cant be 0
|
" a = x;\n" // <- x can't be 0
|
||||||
"}\n";
|
"}\n";
|
||||||
ASSERT_EQUALS(false, testValueOfX(code, 9U, 0)); // x cant be 0 at line 9
|
ASSERT_EQUALS(false, testValueOfX(code, 9U, 0)); // x can't be 0 at line 9
|
||||||
|
|
||||||
code = "void f(const int *buf) {\n"
|
code = "void f(const int *buf) {\n"
|
||||||
" int x = 0;\n"
|
" int x = 0;\n"
|
||||||
|
@ -1777,7 +1777,7 @@ private:
|
||||||
" for(int i = 0; i < 20; i++)\n"
|
" for(int i = 0; i < 20; i++)\n"
|
||||||
" n = (int)(i < 10 || abs(negWander) < abs(negTravel));\n"
|
" n = (int)(i < 10 || abs(negWander) < abs(negTravel));\n"
|
||||||
"}";
|
"}";
|
||||||
testValueOfX(code,0,0); // <- dont hang
|
testValueOfX(code,0,0); // <- don't hang
|
||||||
|
|
||||||
// conditional code in loop
|
// conditional code in loop
|
||||||
code = "void f(int mask) {\n" // #6000
|
code = "void f(int mask) {\n" // #6000
|
||||||
|
|
Loading…
Reference in New Issue