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

Douglas Gregor dgregor at apple.com
Thu Jan 22 08:24:00 PST 2009


Author: dgregor
Date: Thu Jan 22 10:23:54 2009
New Revision: 62766

URL: http://llvm.org/viewvc/llvm-project?rev=62766&view=rev
Log:
EXTWARNify the warning about unnamed typedefs of enums

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=62766&r1=62765&r2=62766&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Thu Jan 22 10:23:54 2009
@@ -606,7 +606,7 @@
      "expected unqualified-id")
 DIAG(err_no_declarators, ERROR,
      "declaration does not declare anything")
-DIAG(warn_no_declarators, WARNING,
+DIAG(ext_typedef_without_a_name, EXTWARN,
      "typedef requires a name")
 DIAG(err_func_def_no_params, ERROR,
      "function definition does not declare parameters")

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jan 22 10:23:54 2009
@@ -736,11 +736,12 @@
       return Tag;
   }
 
-  // Permit typedefs without declarators as a Microsoft extension.
   if (!DS.isMissingDeclaratorOk()) {
+    // Warn about typedefs of enums without names, since this is an
+    // extension in both Microsoft an GNU.
     if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef &&
         Tag && isa<EnumDecl>(Tag)) {
-      Diag(DS.getSourceRange().getBegin(), diag::warn_no_declarators)
+      Diag(DS.getSourceRange().getBegin(), diag::ext_typedef_without_a_name)
         << DS.getSourceRange();
       return Tag;
     }





More information about the cfe-commits mailing list