Fixed handling of __asm...__endasm (#6970)
This commit is contained in:
parent
7ba69cfd0a
commit
590f1f1d66
|
@ -9216,7 +9216,7 @@ void Tokenizer::simplifyAsm()
|
|||
|
||||
else if (Token::Match(tok, "_asm|__asm")) {
|
||||
const Token *tok2 = tok;
|
||||
while (tok2 && tok2->linenr() == tok->linenr() && (tok2->isNumber() || tok2->isName() || tok2->str() == ","))
|
||||
while (tok2 && (tok2->isNumber() || tok2->isName() || tok2->str() == "," || tok2->str() == ":"))
|
||||
tok2 = tok2->next();
|
||||
if (!tok2 || tok2->str() == ";" || tok2->linenr() != tok->linenr()) {
|
||||
instruction = tok->next()->stringifyList(tok2);
|
||||
|
|
|
@ -1036,6 +1036,7 @@ private:
|
|||
ASSERT_EQUALS("asm ( \"\"ddd\"\" ) ;", tokenizeAndStringify(" __asm __volatile (\"ddd\") ;"));
|
||||
ASSERT_EQUALS("asm ( \"\"mov ax,bx\"\" ) ;", tokenizeAndStringify("__asm__ volatile ( \"mov ax,bx\" );"));
|
||||
ASSERT_EQUALS("asm ( \"mov ax , bx\" ) ; int a ;", tokenizeAndStringify("asm { mov ax,bx } int a;"));
|
||||
ASSERT_EQUALS("asm\n\n( \"mov ax , bx __endasm\" ) ;", tokenizeAndStringify("__asm\nmov ax,bx\n__endasm;"));
|
||||
|
||||
// 'asm ( ) ;' should be in the same line
|
||||
ASSERT_EQUALS(";\n\nasm ( \"\"mov ax,bx\"\" ) ;", tokenizeAndStringify(";\n\n__asm__ volatile ( \"mov ax,bx\" );", true));
|
||||
|
|
Loading…
Reference in New Issue