[cfe-commits] [PATCH] Warn on duplicate const specifier
Chandler Carruth
chandlerc at google.com
Tue Aug 28 13:49:38 PDT 2012
Looks good, please commit.
On Tue, Aug 28, 2012 at 1:47 PM, Aaron Ballman <aaron at aaronballman.com>wrote:
> On Tue, Aug 28, 2012 at 4:19 PM, Chandler Carruth <chandlerc at google.com>
> wrote:
> > Index: lib/Sema/DeclSpec.cpp
> > ===================================================================
> > --- lib/Sema/DeclSpec.cpp (revision 162690)
> > +++ lib/Sema/DeclSpec.cpp (working copy)
> > @@ -325,10 +325,17 @@
> >
> > template <class T> static bool BadSpecifier(T TNew, T TPrev,
> > const char *&PrevSpec,
> > - unsigned &DiagID) {
> > + unsigned &DiagID,
> > + bool Pedantic = true) {
> >
> > How about "IsExtension"?
> >
> > PrevSpec = DeclSpec::getSpecifierName(TPrev);
> > - DiagID = (TNew == TPrev ? diag::ext_duplicate_declspec
> > - : diag::err_invalid_decl_spec_combination);
> > + if (TNew == TPrev) {
> > + if (Pedantic)
> > + DiagID = diag::ext_duplicate_declspec;
> > + else
> > + DiagID = diag::warn_duplicate_declspec;
> > + } else {
> > + DiagID = diag::err_invalid_decl_spec_combination;
> > + }
> >
> > Would early exit make this cleaner?
>
> Attached with latest suggestions.
>
> ~Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120828/784ac922/attachment.html>
More information about the cfe-commits
mailing list