Fixed #2201 (false positive: Uninitialized variable: __v0)

This commit is contained in:
Daniel Marjamäki 2010-11-14 17:35:22 +01:00
parent 41f06cef69
commit 378e83e73d
2 changed files with 7 additions and 18 deletions

View File

@ -8633,25 +8633,13 @@ void Tokenizer::simplifyAsm()
Token::eraseTokens(tok, tok->tokAt(2)->link()->next()); Token::eraseTokens(tok, tok->tokAt(2)->link()->next());
} }
else if (Token::Match(tok->next(), "__asm__ (") && else if (Token::Match(tok->next(), "asm|__asm|__asm__ volatile|__volatile__| ("))
tok->tokAt(2)->link() &&
tok->tokAt(2)->link()->next())
{ {
Token::eraseTokens(tok, tok->tokAt(2)->link()->next()); // Goto "("
} Token *partok = tok->tokAt(2);
if (partok->str() != "(")
else if (Token::Match(tok->next(), "__asm|__asm__ __volatile__ (") && partok = partok->next();
tok->tokAt(3)->link() && Token::eraseTokens(tok, partok->link() ? partok->link()->next() : NULL);
tok->tokAt(3)->link()->next())
{
Token::eraseTokens(tok, tok->tokAt(3)->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 if (Token::simpleMatch(tok->next(), "__asm")) else if (Token::simpleMatch(tok->next(), "__asm"))

View File

@ -582,6 +582,7 @@ private:
ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";asm volatile (\"fnstcw %0\" : \"= m\" (old_cw));")); ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";asm volatile (\"fnstcw %0\" : \"= m\" (old_cw));"));
ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify("; __asm__ (\"fnstcw %0\" : \"= m\" (old_cw));")); ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify("; __asm__ (\"fnstcw %0\" : \"= m\" (old_cw));"));
ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify("; __asm __volatile__ (\"ddd\") ;")); ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify("; __asm __volatile__ (\"ddd\") ;"));
ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";__asm__ volatile ( \"mov ax,bx\" );"));
} }