From: Steve Naroff Date: Mon, 11 Feb 2008 22:40:08 +0000 (+0000) Subject: Move policy on unnamed fields (a Microsoft extension) from Parser::ParseStructDeclara... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7a37307d2ee589143d8fd83504cd4a0005d453f;p=clang Move policy on unnamed fields (a Microsoft extension) from Parser::ParseStructDeclaration() to the driver. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46974 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 8b3c2f9cf0..2f47e5199c 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -440,6 +440,9 @@ static void InitializeDiagnostics(Diagnostic &Diags) { diag::MAP_IGNORE); if (!WarnUndefMacros) Diags.setDiagnosticMapping(diag::warn_pp_undef_identifier,diag::MAP_IGNORE); + + if (MSExtensions) // MS allows unnamed struct/union fields. + Diags.setDiagnosticMapping(diag::w_no_declarators, diag::MAP_IGNORE); } //===----------------------------------------------------------------------===// diff --git a/Parse/ParseDecl.cpp b/Parse/ParseDecl.cpp index 454a05dc44..ea12a7c120 100644 --- a/Parse/ParseDecl.cpp +++ b/Parse/ParseDecl.cpp @@ -671,8 +671,7 @@ void Parser::ParseStructDeclaration(DeclTy *TagDecl, // If there are no declarators, issue a warning. if (Tok.is(tok::semi)) { - if (!getLang().Microsoft) // MS allows unnamed struct/union fields. - Diag(SpecQualLoc, diag::w_no_declarators); + Diag(SpecQualLoc, diag::w_no_declarators); return; }