On Fri, Apr 22, 2011 at 11:24 AM, Eli Friedman <[email protected]> wrote: > On Fri, Apr 22, 2011 at 1:14 AM, Francois Pichet <[email protected]> wrote: >> Author: fpichet >> Date: Fri Apr 22 03:14:00 2011 >> New Revision: 129985 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=129985&view=rev >> Log: >> Downgrade error "static declaration of 'foo' follows non-static declaration" >> to a warning in Microsoft mode. >> >> Modified: >> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >> cfe/trunk/lib/Sema/SemaDecl.cpp >> cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp >> >> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=129985&r1=129984&r2=129985&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) >> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Apr 22 03:14:00 >> 2011 >> @@ -2124,6 +2124,8 @@ >> "inline declaration of %0 not allowed in block scope">; >> def err_static_non_static : Error< >> "static declaration of %0 follows non-static declaration">; >> +def warn_static_non_static : ExtWarn< >> + "static declaration of %0 follows non-static declaration">; >> def err_non_static_static : Error< >> "non-static declaration of %0 follows static declaration">; >> def err_extern_non_extern : Error< >> >> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=129985&r1=129984&r2=129985&view=diff >> ============================================================================== >> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Apr 22 03:14:00 2011 >> @@ -1258,8 +1258,10 @@ >> New->getStorageClass() == SC_Static && >> Old->getStorageClass() != SC_Static && >> !canRedefineFunction(Old, getLangOptions())) { >> - Diag(New->getLocation(), diag::err_static_non_static) >> - << New; >> + unsigned DiagID = diag::err_static_non_static; >> + if (getLangOptions().Microsoft) >> + DiagID = diag::warn_static_non_static; >> + Diag(New->getLocation(), DiagID) << New; >> Diag(Old->getLocation(), PrevDiag); >> return true; >> } > > You can't just "return true" in the non-error case; some sort of > recovery is required. >
right, see r130010. i think just avoiding return true is ok. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
