[PATCH] Lex and ignore Microsoft's #pragma warning(...)
Reid Kleckner
rnk at google.com
Fri Sep 13 11:25:37 PDT 2013
On Wed, Sep 11, 2013 at 4:12 PM, Aaron Ballman <aaron at aaronballman.com>wrote:
> > +void PrintPPOutputPPCallbacks::PragmaWarning(SourceLocation Loc,
> > + StringRef WarningSpec,
> > + ArrayRef<int> Ids) {
> > + startNewLineIfNeeded();
> > + MoveToLine(Loc);
> > + OS << "#pragma warning(" << WarningSpec << ':';
> > + for (int I = 0, E = Ids.size(); I != E; ++I)
> > + OS << ' ' << Ids[I];
>
> Use an iterator instead of indexes?
>
Meh.
> > + OS << ')';
> > + setEmittedDirectiveOnThisLine();
>
> This doesn't seem to support the syntax where there are multiple
> specifiers. Eg)
>
> #pragma warning(disable:1; once:2)
>
That's OK, it should produce semantically equivalent output, down to the
#line markers.
> Index: lib/Lex/Pragma.cpp
> > ===================================================================
> > + SmallString<64> IntegerBuffer;
>
> Seems a bit huge for the numbers we'd be lexing.
>
Yeah, copy pasto.
> In the error case, do we want to diagnose what's wrong?
>
No, there are different diagnostics.
> In all of the early returns, I think you'll want to skip until you get
> to the end of the pragma or else you'll get a cascade of errors.
>
With testing this doesn't appear necessary. Some higher level code must be
handling this. The other pragmas also don't do this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130913/42be5067/attachment.html>
More information about the cfe-commits
mailing list