Syntax error: if (retval==)
This commit is contained in:
parent
fb1d60bfb1
commit
ebd32cfd73
|
@ -9419,6 +9419,12 @@ void Tokenizer::findGarbageCode() const
|
||||||
if (match1 && match2)
|
if (match1 && match2)
|
||||||
syntaxError(tok);
|
syntaxError(tok);
|
||||||
}
|
}
|
||||||
|
if (Token::Match(tok, "%comp%|+|-|/|% )|]|}")) {
|
||||||
|
if (isC())
|
||||||
|
syntaxError(tok, tok->str() + tok->next()->str());
|
||||||
|
if (tok->str() != ">" && !Token::simpleMatch(tok->previous(), "operator"))
|
||||||
|
syntaxError(tok, tok->str() + " " + tok->next()->str());
|
||||||
|
}
|
||||||
if (Token::Match(tok, "( %any% )") && tok->next()->isKeyword() && !Token::simpleMatch(tok->next(), "void"))
|
if (Token::Match(tok, "( %any% )") && tok->next()->isKeyword() && !Token::simpleMatch(tok->next(), "void"))
|
||||||
syntaxError(tok);
|
syntaxError(tok);
|
||||||
if (Token::Match(tok, "%num%|%bool%|%char%|%str% %num%|%bool%|%char%|%str%") && !Token::Match(tok, "%str% %str%"))
|
if (Token::Match(tok, "%num%|%bool%|%char%|%str% %num%|%bool%|%char%|%str%") && !Token::Match(tok, "%str% %str%"))
|
||||||
|
|
|
@ -7905,6 +7905,8 @@ private:
|
||||||
ASSERT_THROW(tokenizeAndStringify("void foo() { for_chain( if (!done) done = 1); }"), InternalError);
|
ASSERT_THROW(tokenizeAndStringify("void foo() { for_chain( if (!done) done = 1); }"), InternalError);
|
||||||
ASSERT_THROW(tokenizeAndStringify("void foo() { for_chain( a, b, if (!done) done = 1); }"), InternalError);
|
ASSERT_THROW(tokenizeAndStringify("void foo() { for_chain( a, b, if (!done) done = 1); }"), InternalError);
|
||||||
|
|
||||||
|
ASSERT_THROW_EQUALS(tokenizeAndStringify("void f() { if (retval==){} }"), InternalError, "syntax error: == )");
|
||||||
|
|
||||||
// after (expr)
|
// after (expr)
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("void f() { switch (a) int b; }"));
|
ASSERT_NO_THROW(tokenizeAndStringify("void f() { switch (a) int b; }"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue