Fixed ticket #3712 (false positive: syntax error on valid C code ( K&R function style ))
This commit is contained in:
parent
7be01da8e9
commit
51789d8e20
|
@ -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
|
// Convert K&R function declarations to modern C
|
||||||
simplifyVarDecl(true);
|
simplifyVarDecl(true);
|
||||||
if (!simplifyFunctionParameters())
|
if (!simplifyFunctionParameters())
|
||||||
|
@ -2097,9 +2100,6 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
// remove Borland stuff..
|
// remove Borland stuff..
|
||||||
simplifyBorland();
|
simplifyBorland();
|
||||||
|
|
||||||
// Remove "volatile", "inline", "register", and "restrict"
|
|
||||||
simplifyKeyword();
|
|
||||||
|
|
||||||
// Remove __builtin_expect, likely and unlikely
|
// Remove __builtin_expect, likely and unlikely
|
||||||
simplifyBuiltinExpect();
|
simplifyBuiltinExpect();
|
||||||
|
|
||||||
|
|
|
@ -4787,6 +4787,15 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
"}", tokenizeAndStringify(code));
|
"}", 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() {
|
void vardecl20() {
|
||||||
|
|
Loading…
Reference in New Issue