Fixed #1168 (false positive: Uninitialized variable)

This commit is contained in:
Daniel Marjamäki 2009-12-30 08:24:27 +01:00
parent 2a28ca72cc
commit 2de2ecafe4
2 changed files with 22 additions and 14 deletions

View File

@ -715,7 +715,25 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[])
tok->tokAt(2)->link()->next()) tok->tokAt(2)->link()->next())
{ {
Token::eraseTokens(tok, tok->tokAt(2)->link()->next()); Token::eraseTokens(tok, tok->tokAt(2)->link()->next());
} }
else if (Token::Match(tok->next(), "__asm__ __volatile__ (") &&
tok->tokAt(3)->link() &&
tok->tokAt(3)->link()->next())
{
Token::eraseTokens(tok, tok->tokAt(3)->link()->next());
}
else
continue;
// insert "asm ( )"
tok->insertToken(")");
tok->insertToken("(");
tok->insertToken("asm");
Token::createMutualLinks(tok->tokAt(2), tok->tokAt(3));
} }
// Remove "volatile" and "mutable" // Remove "volatile" and "mutable"

View File

@ -329,20 +329,10 @@ private:
void inlineasm() void inlineasm()
{ {
{ ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";asm { mov ax,bx };"));
const char code[] = "abc asm { mov ax,bx } def"; ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";_asm { mov ax,bx };"));
ASSERT_EQUALS("abc def", tokenizeAndStringify(code)); ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";__asm { mov ax,bx };"));
} ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";__asm__ __volatile__ ( \"mov ax,bx\" );"));
{
const char code[] = "abc _asm { mov ax,bx } def";
ASSERT_EQUALS("abc def", tokenizeAndStringify(code));
}
{
const char code[] = "abc __asm { mov ax,bx } def";
ASSERT_EQUALS("abc def", tokenizeAndStringify(code));
}
} }