Fixed #9445 (Syntax error on typeof word in C)
This commit is contained in:
parent
6e4085f3d8
commit
e802d85315
|
@ -9656,7 +9656,9 @@ void Tokenizer::findGarbageCode() const
|
|||
syntaxError(tok);
|
||||
if (Token::simpleMatch(tok, ",") &&
|
||||
!Token::Match(tok->tokAt(-2), "[ = , &|%name%")) {
|
||||
if (Token::Match(tok->previous(), "(|[|{|<|%assign%|%or%|%oror%|==|!=|+|-|/|!|>=|<=|~|^|::|sizeof|throw|decltype|typeof"))
|
||||
if (Token::Match(tok->previous(), "(|[|{|<|%assign%|%or%|%oror%|==|!=|+|-|/|!|>=|<=|~|^|::|sizeof"))
|
||||
syntaxError(tok);
|
||||
if (isCPP() && Token::Match(tok->previous(), "throw|decltype|typeof"))
|
||||
syntaxError(tok);
|
||||
if (Token::Match(tok->next(), ")|]|>|%assign%|%or%|%oror%|==|!=|/|>=|<=|&&"))
|
||||
syntaxError(tok);
|
||||
|
|
|
@ -8175,6 +8175,9 @@ private:
|
|||
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("void f() { assert(a==()); }"), InternalError, "syntax error: ==()");
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("void f() { assert(a+()); }"), InternalError, "syntax error: +()");
|
||||
|
||||
// #9445 - typeof is not a keyword in C
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("void foo() { char *typeof, *value; }", false, false, Settings::Native, "test.c"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue