Fixed ticket #3703 (false positive: syntax error on valid C-code ( K&R - style )).

This commit is contained in:
Edoardo Prezioso 2012-04-03 20:12:34 +02:00
parent 5d91ef76fe
commit ecc5dea113
2 changed files with 15 additions and 2 deletions

View File

@ -5375,8 +5375,7 @@ void Tokenizer::simplifyVarDecl(bool only_k_r_fpar)
tok2 = tok2->next(); tok2 = tok2->next();
} }
} }
if (only_k_r_fpar && !finishedwithkr && tok2->strAt(1) == "{") finishedwithkr = (only_k_r_fpar && tok2->strAt(1) == "{");
finishedwithkr = true;
} }
} }

View File

@ -4764,6 +4764,20 @@ private:
"{\n" "{\n"
"}", tokenizeAndStringify(code)); "}", 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() { void volatile_variables() {