diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 61658dbe7..68639b092 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5375,8 +5375,7 @@ void Tokenizer::simplifyVarDecl(bool only_k_r_fpar) tok2 = tok2->next(); } } - if (only_k_r_fpar && !finishedwithkr && tok2->strAt(1) == "{") - finishedwithkr = true; + finishedwithkr = (only_k_r_fpar && tok2->strAt(1) == "{"); } } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 053679a13..770b8d6df 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -4764,6 +4764,20 @@ private: "{\n" "}", tokenizeAndStringify(code)); } + { + const char code[] = "void f(r,s,t)\n" + "char *r,*s,*t;\n" + "{\n" + "}\n"; + + ASSERT_EQUALS("void f (\n" + "char * r,\n" + "char * s,\n" + "char * t)\n" + "\n" + "{\n" + "}", tokenizeAndStringify(code)); + } } void volatile_variables() {