Tokenizer: improved handling of __asm__ in function declaration

This commit is contained in:
Daniel Marjamäki 2022-05-08 16:03:09 +02:00
parent 16c6740520
commit fab55287f7
2 changed files with 7 additions and 0 deletions

View File

@ -11425,6 +11425,11 @@ void Tokenizer::simplifyAsm()
else
continue;
if (Token::Match(tok->previous(), ") %name% %name% (")) {
tok->deleteThis();
continue;
}
// insert "asm ( "instruction" )"
tok->str("asm");
if (tok->strAt(1) != ";" && tok->strAt(1) != "{")

View File

@ -994,6 +994,8 @@ private:
// 'asm ( ) ;' should be in the same line
ASSERT_EQUALS(";\n\nasm ( \"\"mov ax,bx\"\" ) ;", tokenizeAndStringify(";\n\n__asm__ volatile ( \"mov ax,bx\" );"));
ASSERT_EQUALS("void func1 ( ) ;", tokenizeAndStringify("void func1() __asm__(\"...\") __attribute__();"));
}
// #4725 - ^{}