Fixed testrunner

This commit is contained in:
Daniel Marjamäki 2018-10-22 00:28:09 +02:00
parent f9b132e831
commit c483bcb12b
2 changed files with 14 additions and 2 deletions

View File

@ -8401,6 +8401,18 @@ static const Token *findUnmatchedTernaryOp(const Token * const begin, const Toke
void Tokenizer::findGarbageCode() const
{
// Inside [] there can't be ; or various keywords
for (const Token *tok = tokens(); tok; tok = tok->next()) {
if (tok->str() != "[")
continue;
for (const Token *inner = tok->next(); inner != tok->link(); inner = inner->next()) {
if (Token::Match(inner, "(|["))
inner = inner->link();
else if (Token::Match(inner, ";|goto|return|typedef"))
syntaxError(inner);
}
}
for (const Token *tok = tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, "if|while|for|switch")) { // if|while|for|switch (EXPR) { ... }
if (tok->previous() && !Token::Match(tok->previous(), "%name%|:|;|{|}|(|)|,"))

View File

@ -782,7 +782,7 @@ private:
}
void garbageCode91() { // #6791
checkCode("typedef __attribute__((vector_size (16))) { return[ (v2df){ } ;] }"); // do not crash
ASSERT_THROW(checkCode("typedef __attribute__((vector_size (16))) { return[ (v2df){ } ;] }"), InternalError); // throw syntax error
}
void garbageCode92() { // #6792
@ -799,7 +799,7 @@ private:
}
void garbageCode96() { // #6807
ASSERT_THROW(checkCode("typedef J J[ ; typedef ( ) ( ) { ; } typedef J J ;] ( ) ( J cx ) { n } ;"), InternalError);
ASSERT_THROW(checkCode("typedef J J[ ; typedef ( ) ( ) { ; } typedef J J ;] ( ) ( J cx ) { n } ;"), InternalError); // throw syntax error
}
void garbageCode97() { // #6808