forked from OSchip/llvm-project
parent
53361ac130
commit
ab180365ac
|
@ -267,6 +267,8 @@ void Parser::ParseForStatement() {
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
} else if (isDeclarationSpecifier()) { // for (int X = 4;
|
} else if (isDeclarationSpecifier()) { // for (int X = 4;
|
||||||
// Parse declaration, which eats the ';'.
|
// Parse declaration, which eats the ';'.
|
||||||
|
if (!getLang().C99) // Use of C99-style for loops in C90 mode?
|
||||||
|
Diag(Tok, diag::ext_c99_variable_decl_in_for_loop);
|
||||||
ParseDeclaration(Declarator::ForContext);
|
ParseDeclaration(Declarator::ForContext);
|
||||||
} else {
|
} else {
|
||||||
ParseExpression();
|
ParseExpression();
|
||||||
|
|
|
@ -254,6 +254,8 @@ DIAG(ext_ident_list_in_param, EXTENSION,
|
||||||
"type-less parameter names in function declaration")
|
"type-less parameter names in function declaration")
|
||||||
DIAG(ext_c99_array_usage, EXTENSION,
|
DIAG(ext_c99_array_usage, EXTENSION,
|
||||||
"use of c99-specific array features")
|
"use of c99-specific array features")
|
||||||
|
DIAG(ext_c99_variable_decl_in_for_loop, EXTENSION,
|
||||||
|
"variable declaration in for loop is a c99-specific feature")
|
||||||
|
|
||||||
// Generic errors.
|
// Generic errors.
|
||||||
DIAG(err_parse_error, ERROR,
|
DIAG(err_parse_error, ERROR,
|
||||||
|
|
Loading…
Reference in New Issue