Tokenizer::removeMacrosInGlobalScope: Don't remove C/C++ keywords namespace/struct/etc. Ticket: #3193
This commit is contained in:
parent
cf39ece8da
commit
371871b0b7
|
@ -4854,7 +4854,8 @@ void Tokenizer::removeMacrosInGlobalScope()
|
|||
if (tok->str() == "(")
|
||||
{
|
||||
tok = tok->link();
|
||||
if (Token::Match(tok, ") %type% {") && tok->strAt(1) != "const")
|
||||
if (Token::Match(tok, ") %type% {") &&
|
||||
!Token::Match(tok->next(), "const|namespace|class|struct|union"))
|
||||
tok->deleteNext();
|
||||
}
|
||||
|
||||
|
|
|
@ -5946,6 +5946,7 @@ private:
|
|||
// remove some unhandled macros in the global scope.
|
||||
ASSERT_EQUALS("void f ( ) { }", tokenizeAndStringify("void f() NOTHROW { }"));
|
||||
ASSERT_EQUALS("struct Foo { } ;", tokenizeAndStringify("struct __declspec(dllexport) Foo {};"));
|
||||
ASSERT_EQUALS("ABA ( ) namespace { }", tokenizeAndStringify("ABA() namespace { }"));
|
||||
}
|
||||
|
||||
void multipleAssignment()
|
||||
|
|
Loading…
Reference in New Issue