From a0ebd60bfda56c161a87adb01f1b9a1d0e7ae32f Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 16 Jul 2010 15:40:40 +0000 Subject: [PATCH] Revert Microsoft-specific override of the "typedef requires a name" diagnostic. Instead, put it and the "declaration does not declare anything" warning into -Wmissing-declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108527 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticCommonKinds.td | 3 ++- include/clang/Basic/DiagnosticGroups.td | 4 ++-- include/clang/Basic/DiagnosticSemaKinds.td | 3 ++- lib/Sema/SemaDecl.cpp | 7 +++---- test/Parser/MicrosoftExtensions.c | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 4b0bf57bef..98ea9d4bd6 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -41,7 +41,8 @@ def err_expected_colon_after_setter_name : Error< "must end with ':'">; // Parse && Sema -def ext_no_declarators : ExtWarn<"declaration does not declare anything">; +def ext_no_declarators : ExtWarn<"declaration does not declare anything">, + InGroup; def err_param_redefinition : Error<"redefinition of parameter %0">; def err_invalid_storage_class_in_func_decl : Error< "invalid storage class specifier in function declarator">; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 8e4a389f4a..566072978c 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -35,7 +35,7 @@ def : DiagGroup<"declaration-after-statement">; def GNUDesignator : DiagGroup<"gnu-designator">; def Deprecated : DiagGroup<"deprecated">; def : DiagGroup<"disabled-optimization">; -def : DiagGroup<"discard-qual">; +def : DiagGroup<"discard-qualgnu">; def : DiagGroup<"div-by-zero">; def EmptyBody : DiagGroup<"empty-body">; def ExtraTokens : DiagGroup<"extra-tokens">; @@ -57,7 +57,7 @@ def : DiagGroup<"invalid-pch">; def LiteralRange : DiagGroup<"literal-range">; def : DiagGroup<"main">; def MissingBraces : DiagGroup<"missing-braces">; -def : DiagGroup<"missing-declarations">; +def MissingDeclarations: DiagGroup<"missing-declarations">; def : DiagGroup<"missing-format-attribute">; def : DiagGroup<"missing-include-dirs">; def : DiagGroup<"missing-noreturn">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 018a3a1e62..38c8b67472 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -227,7 +227,8 @@ def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 " "platform-specific data}0) must be of type %1">; /// parser diagnostics -def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">; +def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">, + InGroup; def err_typedef_not_identifier : Error<"typedef name must be an identifier">; def err_statically_allocated_object : Error< "interface type cannot be statically allocated">; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 12c60d2e90..f2f9a34215 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1550,12 +1550,11 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, if (!DS.isMissingDeclaratorOk() && DS.getTypeSpecType() != DeclSpec::TST_error) { // Warn about typedefs of enums without names, since this is an - // extension in both Microsoft an GNU. + // extension in both Microsoft and GNU. if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef && Tag && isa(Tag)) { - if (!getLangOptions().Microsoft) - Diag(DS.getSourceRange().getBegin(), diag::ext_typedef_without_a_name) - << DS.getSourceRange(); + Diag(DS.getSourceRange().getBegin(), diag::ext_typedef_without_a_name) + << DS.getSourceRange(); return DeclPtrTy::make(Tag); } diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c index 4a52e8b636..7b6e60faa4 100644 --- a/test/Parser/MicrosoftExtensions.c +++ b/test/Parser/MicrosoftExtensions.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -x objective-c++ %s +// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s __stdcall int func0(); int __stdcall func(); typedef int (__cdecl *tptr)();