Fixed #4300 (segmentation fault of cppcheck (invalid code))
This commit is contained in:
parent
34c3697750
commit
71b66209b7
|
@ -3752,7 +3752,7 @@ void Tokenizer::simplifyEmptyNamespaces()
|
|||
return;
|
||||
|
||||
bool goback = false;
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
for (Token *tok = list.front(); tok; tok = tok ? tok->next() : NULL) {
|
||||
if (goback) {
|
||||
tok = tok->previous();
|
||||
goback = false;
|
||||
|
|
|
@ -68,7 +68,8 @@ private:
|
|||
TEST_CASE(wrong_syntax4); // #3618
|
||||
TEST_CASE(wrong_syntax_if_macro); // #2518 - if MACRO()
|
||||
TEST_CASE(syntax_case_default);
|
||||
TEST_CASE(garbageCode);
|
||||
TEST_CASE(garbageCode1);
|
||||
TEST_CASE(garbageCode2); // #4300
|
||||
|
||||
TEST_CASE(foreach); // #3690
|
||||
|
||||
|
@ -835,10 +836,14 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void garbageCode() {
|
||||
void garbageCode1() {
|
||||
tokenizeAndStringify("struct x foo_t; foo_t typedef y;");
|
||||
}
|
||||
|
||||
void garbageCode2() { //#4300 (segmentation fault)
|
||||
tokenizeAndStringify("enum { D = 1 struct { } ; } s.b = D;");
|
||||
}
|
||||
|
||||
void foreach() {
|
||||
// #3690
|
||||
const std::string code("void f() { for each ( char c in MyString ) { Console::Write(c); } }");
|
||||
|
|
Loading…
Reference in New Issue