[cfe-commits] r62192 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Tue Jan 13 15:10:51 PST 2009


Author: dgregor
Date: Tue Jan 13 17:10:51 2009
New Revision: 62192

URL: http://llvm.org/viewvc/llvm-project?rev=62192&view=rev
Log:
Permitting typedefs without a name is a Microsoft/GNU extension

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticKinds.def
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=62192&r1=62191&r2=62192&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Tue Jan 13 17:10:51 2009
@@ -593,6 +593,8 @@
      "expected unqualified-id")
 DIAG(err_no_declarators, ERROR,
      "declaration does not declare anything")
+DIAG(ext_no_declarators, EXTENSION,
+     "typedef without a name is a Microsoft extension")
 DIAG(err_func_def_no_params, ERROR,
      "function definition does not declare parameters")
 DIAG(err_expected_lparen_after_type, ERROR,

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=62192&r1=62191&r2=62192&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jan 13 17:10:51 2009
@@ -875,7 +875,15 @@
       return Tag;
   }
 
+  // Permit typedefs without declarators as a Microsoft extension.
   if (!DS.isMissingDeclaratorOk()) {
+    if (getLangOptions().Microsoft &&
+        DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
+      Diag(DS.getSourceRange().getBegin(), diag::ext_no_declarators)
+        << DS.getSourceRange();
+      return Tag;
+    }
+
     // FIXME: This diagnostic is emitted even when various previous
     // errors occurred (see e.g. test/Sema/decl-invalid.c). However,
     // DeclSpec has no means of communicating this information, and the





More information about the cfe-commits mailing list