Fix #11239 checkLibraryCheckType with asm goto() (invalid varid), add test for #8666 (#4340)

* Add test for #6541, avoid duplicate warning

* Add test for #5475

* Fix test

* Merge

* Add test for #8666

* Fix #11239 checkLibraryCheckType with asm goto() (invalid varid)

* Format
This commit is contained in:
chrchr-github 2022-08-04 21:35:18 +02:00 committed by GitHub
parent 460f63558d
commit d5a0dfda00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -4106,7 +4106,7 @@ void Tokenizer::setVarIdPass1()
} }
} }
if (tok->isName()) { if (tok->isName() && !tok->isKeyword()) {
// don't set variable id after a struct|enum|union // don't set variable id after a struct|enum|union
if (Token::Match(tok->previous(), "struct|enum|union") || (isCPP() && tok->strAt(-1) == "class")) if (Token::Match(tok->previous(), "struct|enum|union") || (isCPP() && tok->strAt(-1) == "class"))
continue; continue;

View File

@ -2420,6 +2420,17 @@ private:
" AutoTimer();\n" " AutoTimer();\n"
"}\n", /*cpp*/ true); "}\n", /*cpp*/ true);
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("void f() {\n" // #8666
" asm(\"assembler code\");\n"
" asm volatile(\"assembler code\");\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("void f() {\n" // #11239
" asm goto(\"assembler code\");\n"
"}\n");
ASSERT_EQUALS("", errout.str());
} }
void ptrptr() { void ptrptr() {