[cfe-commits] r38813 - in /cfe/cfe/trunk: Parse/DeclSpec.cpp include/clang/Basic/DiagnosticKinds.def
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:24:52 PDT 2007
Author: sabre
Date: Wed Jul 11 11:24:52 2007
New Revision: 38813
URL: http://llvm.org/viewvc/llvm-project?rev=38813&view=rev
Log:
C99 requires at least one type specifier.
Modified:
cfe/cfe/trunk/Parse/DeclSpec.cpp
cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
Modified: cfe/cfe/trunk/Parse/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/DeclSpec.cpp?rev=38813&r1=38812&r2=38813&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/DeclSpec.cpp (original)
+++ cfe/cfe/trunk/Parse/DeclSpec.cpp Wed Jul 11 11:24:52 2007
@@ -204,4 +204,14 @@
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'?
}
Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=38813&r1=38812&r2=38813&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:24:52 2007
@@ -234,6 +234,9 @@
// 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,
More information about the cfe-commits
mailing list