Detect syntax error 'x ==> y'

This commit is contained in:
Daniel Marjamäki 2020-04-11 11:05:27 +02:00
parent 32bf53eeda
commit e8e3c2660d
2 changed files with 5 additions and 0 deletions

View File

@ -9629,6 +9629,8 @@ void Tokenizer::findGarbageCode() const
} }
if (Token::Match(tok, "[!|+-/%^~] )|]")) if (Token::Match(tok, "[!|+-/%^~] )|]"))
syntaxError(tok); syntaxError(tok);
if (Token::Match(tok, "==|!=|<=|>= %comp%"))
syntaxError(tok, tok->str() + " " + tok->strAt(1));
} }
// ternary operator without : // ternary operator without :

View File

@ -8027,6 +8027,9 @@ private:
" struct { int d; } port[1]; " " struct { int d; } port[1]; "
"}; " "}; "
"struct poc p = { .port[0] = {.d = 3} };")); "struct poc p = { .port[0] = {.d = 3} };"));
// op op
ASSERT_THROW_EQUALS(tokenizeAndStringify("void f() { dostuff (x==>y); }"), InternalError, "syntax error: == >");
} }