From 99a73fe1d39a9a4e314d7a773f3547c50b9f4161 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Tue, 5 Mar 2013 08:32:52 -0800 Subject: [PATCH] Don't assign a varid to a variadic function --- lib/tokenize.cpp | 2 +- test/testtokenize.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 9d2c74426..642825d28 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2816,7 +2816,7 @@ void Tokenizer::setVarId() continue; const Token *tok3 = tok2->next(); - if (!tok3->isStandardType() && !Token::Match(tok3,"struct|union|class %type%") && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) { + if (!tok3->isStandardType() && !Token::Match(tok3,"struct|union|class %type%") && tok3->str() != "." && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) { variableId[tok2->previous()->str()] = ++_varId; tok = tok2->previous(); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 066e0e0da..2301e3d81 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -268,6 +268,7 @@ private: TEST_CASE(varid_functionPrototypeTemplate); TEST_CASE(varid_templatePtr); // #4319 TEST_CASE(varid_templateNamespaceFuncPtr); // #4172 + TEST_CASE(varid_variadicFunc); TEST_CASE(varidclass1); TEST_CASE(varidclass2); @@ -4264,6 +4265,11 @@ private: "1: KeyListT < float , & NIFFile :: getFloat > mKeyList@1 [ 4 ] ;\n", tokenizeDebugListing("KeyListT mKeyList[4];")); } + void varid_variadicFunc() { + ASSERT_EQUALS("\n\n##file 0\n" + "1: int foo ( . . . ) ;\n", tokenizeDebugListing("int foo(...);")); + } + void varidclass1() { const std::string actual = tokenizeDebugListing( "class Fred\n"