Fixed ticket #3712 (false positive: syntax error on valid C code ( K&R function style ))

This commit is contained in:
Edoardo Prezioso 2012-04-13 00:39:40 +02:00
parent 7be01da8e9
commit 51789d8e20
2 changed files with 12 additions and 3 deletions

View File

@ -2041,6 +2041,9 @@ bool Tokenizer::tokenize(std::istream &code,
}
}
// Remove "volatile", "inline", "register", and "restrict"
simplifyKeyword();
// Convert K&R function declarations to modern C
simplifyVarDecl(true);
if (!simplifyFunctionParameters())
@ -2097,9 +2100,6 @@ bool Tokenizer::tokenize(std::istream &code,
// remove Borland stuff..
simplifyBorland();
// Remove "volatile", "inline", "register", and "restrict"
simplifyKeyword();
// Remove __builtin_expect, likely and unlikely
simplifyBuiltinExpect();

View File

@ -4787,6 +4787,15 @@ private:
"{\n"
"}", tokenizeAndStringify(code));
}
{
const char code[] = "void f(a, b) register char *a, *b;\n"
"{\n"
"}\n";
ASSERT_EQUALS("void f ( char * a , char * b )\n"
"{\n"
"}", tokenizeAndStringify(code));
}
}
void vardecl20() {