Fix extern c typedef syntax error (#2438)
* Fix extern c typedef syntax error * Fix extraWhiteSpaceError * Move test from testgarbage to testtokenize
This commit is contained in:
parent
965784dd19
commit
370196a14c
|
@ -9346,7 +9346,8 @@ void Tokenizer::findGarbageCode() const
|
|||
while (prev && prev->isName())
|
||||
prev = prev->previous();
|
||||
if (Token::Match(prev, "%op%|%num%|%str%|%char%")) {
|
||||
if (!Token::simpleMatch(tok->tokAt(-2), "operator \"\" if"))
|
||||
if (!Token::simpleMatch(tok->tokAt(-2), "operator \"\" if") &&
|
||||
!Token::simpleMatch(tok->tokAt(-2), "extern \"C\"") )
|
||||
syntaxError(tok, prev == tok->previous() ? (prev->str() + " " + tok->str()) : (prev->str() + " .. " + tok->str()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7959,6 +7959,8 @@ private:
|
|||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("S s = { .x=2, .y[0]=3 };"));
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("S s = { .ab.a=2, .ab.b=3 };"));
|
||||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("extern \"C\" typedef void FUNC();"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue