Add a warning

llvm-svn: 38848
This commit is contained in:
Chris Lattner 2006-08-10 05:22:36 +00:00
parent 53361ac130
commit ab180365ac
2 changed files with 4 additions and 0 deletions

View File

@ -267,6 +267,8 @@ void Parser::ParseForStatement() {
ConsumeToken();
} else if (isDeclarationSpecifier()) { // for (int X = 4;
// 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);
} else {
ParseExpression();

View File

@ -254,6 +254,8 @@ DIAG(ext_ident_list_in_param, EXTENSION,
"type-less parameter names in function declaration")
DIAG(ext_c99_array_usage, EXTENSION,
"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.
DIAG(err_parse_error, ERROR,