diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c69beb680..bd68edc2e 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3843,10 +3843,10 @@ void Tokenizer::setVarId() tok->varId(0); } - setPodTypes(); - setVarIdPass1(); + setPodTypes(); + setVarIdPass2(); } @@ -4144,7 +4144,7 @@ void Tokenizer::setVarIdPass1() } } - if (tok->isName() && !tok->isKeyword()) { + if (tok->isName() && !tok->isKeyword() && !tok->isStandardType()) { // don't set variable id after a struct|enum|union if (Token::Match(tok->previous(), "struct|enum|union") || (isCPP() && tok->strAt(-1) == "class")) continue; @@ -9588,7 +9588,7 @@ void Tokenizer::setPodTypes() if (!mSettings) return; for (Token *tok = list.front(); tok; tok = tok->next()) { - if (!tok->isName()) + if (!tok->isName() || tok->varId()) continue; // pod type diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 829d28564..1be6c2870 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -3015,6 +3015,9 @@ private: "2: char * text@1 ;\n" "3: void ( * f@2 ) ( int ( * arg ) ( char * ) ) ;\n" "4: }\n", tokenize(code2)); + + const char code3[] = "void f (void (*g) (int i, IN int n)) {}\n"; + ASSERT_EQUALS("1: void f ( void ( * g@1 ) ( int , IN int ) ) { }\n", tokenize(code3)); } void varidclass1() {