Tokenizer: handle when __asm__ directive is provided for function

This commit is contained in:
Daniel Marjamäki 2022-05-07 19:40:03 +02:00
parent 47c7287b8d
commit f25b8cf662
2 changed files with 7 additions and 0 deletions

View File

@ -11425,6 +11425,11 @@ void Tokenizer::simplifyAsm()
else
continue;
if (Token::simpleMatch(tok->previous(), ")")) {
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__(\"...\");"));
}
// #4725 - ^{}