C99 requires at least one type specifier.

llvm-svn: 38813
This commit is contained in:
Chris Lattner 2006-08-04 06:42:31 +00:00
parent fef9d2bba7
commit 1ae23294fb
2 changed files with 13 additions and 0 deletions

View File

@ -204,4 +204,14 @@ void DeclSpec::Finish(SourceLocation Loc, Diagnostic &D,
TypeSpecComplex = TSC_unspecified;
}
}
// If this is C99, require that at least one specifier is present!
if (Lang.C99 && (getParsedSpecifiers() & PQ_TypeSpecifier) == 0) {
D.Report(Loc, diag::w_type_defaults_to_int);
TypeSpecType = TST_int;
}
// Okay, now we can infer the real type.
// 'data definition has no type or storage class'?
}

View File

@ -234,6 +234,9 @@ DIAG(err_pp_I_dash_not_supported, ERROR,
// Parser Diagnostics
//===----------------------------------------------------------------------===//
DIAG(w_type_defaults_to_int, WARNING,
"type defaults to 'int'")
DIAG(ext_empty_source_file, EXTENSION,
"ISO C forbids an empty source file")
DIAG(ext_top_level_semi, EXTENSION,