diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-01-22 16:23:54 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-01-22 16:23:54 +0000 |
commit | 21282df53bd86f737f84c4ae6d2dea7ef32f0895 (patch) | |
tree | e9fe5c0572136ce946c1c36fcddeb2df2f723aec | |
parent | 3733831cde6030f09b462d548dcc9d4fb70b971e (diff) |
EXTWARNify the warning about unnamed typedefs of enums
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62766 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticKinds.def | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 664d3af365..259265c2bf 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -606,7 +606,7 @@ DIAG(err_expected_unqualified_id, ERROR, "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") diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index dbf1e7b416..276f2e24e8 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -736,11 +736,12 @@ Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) { 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; } |