From 64cdee62efe6148b704e590e2951efd780173f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 16 Aug 2010 19:38:47 +0200 Subject: [PATCH] Fixed #1942 (false positive: uninitialized variable in __asm__ statement) --- lib/tokenize.cpp | 7 +++++++ test/testtokenize.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 9bd557f08..538a48910 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -7820,6 +7820,13 @@ void Tokenizer::simplifyAsm() Token::eraseTokens(tok, tok->tokAt(2)->link()->next()); } + else if (Token::Match(tok->next(), "__asm__ (") && + tok->tokAt(2)->link() && + 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()) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 42f68b5e7..b5496ffa9 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -463,6 +463,7 @@ private: ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";__asm _emit 12h ;")); ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";__asm mov a, b ;")); ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify(";asm volatile (\"fnstcw %0\" : \"= m\" (old_cw));")); + ASSERT_EQUALS("; asm ( ) ;", tokenizeAndStringify("; __asm__ (\"fnstcw %0\" : \"= m\" (old_cw));")); }