[cfe-dev] Parser TODO/FIXME
Chris Lattner
clattner at apple.com
Sat Aug 25 11:23:13 PDT 2007
On Aug 25, 2007, at 8:35 AM, Patrick Flannery wrote:
> I have included a patch file for a few of the TODO/FIXME items
> in Parser.cpp . Two of the elements are pretty straightforward.
Looks great! A couple of nit-picky details :)
case tok::kw___extension__: {
ConsumeToken();
- // FIXME: Disable extension warnings.
+ bool warnings = Diags.getWarnOnExtensions();
+ Diags.setWarnOnExtensions(false);
DeclTy *RV = ParseExternalDeclaration();
- // FIXME: Restore extension warnings.
+ Diags.setWarnOnExtensions(warnings);
return RV;
This looks good. There are several other places that handle
__extension__ which could use similar treatment.
+ virtual void ParseTopLevelSemi(SourceLocation SemiLoca){
+ }
Please put spaces before the opening brace, like:
+ virtual void ParseTopLevelSemi(SourceLocation SemiLoca) {
+ }
Also:
+ if(DS.getParsedSpecifiers() == 0){
should be:
+ if (DS.getParsedSpecifiers() == 0) {
Another thing, please remove the todo in: :)
/// [!C99] init-declarator-list ';' [TODO: warn in
c99 mode]
> The last which enforces a warning for a top level declaration of
> the form x; is labeled as a warning for C99 only. I however have
> checked that this warning is generated in c89 mode under gcc as
> well. So I added the diagnostic at the WARNING rather than
> EXTENSION level and omitted getLang().C99 in the test for emitting
> the diagnostic.
This is actually tricky. It's important to mark it as an extension
in C99 mode but a warning in C90 mode. We want this so that -
pedantic -pedantic-errors will actually *reject* the code in C99
mode, but will still just emit a warning in C90 mode.
Unfortunately, this means that you have to add two diagnostics for
the same message, one that is a warning and one that is an extension
warning.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20070825/b74eb4d0/attachment.html>
More information about the cfe-dev
mailing list