This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFA] Add -CC option to cpplib to save comments in macros


Ugh, sorry to follow up again.

Neil Booth wrote:-

> If possible, I'd turn on comment skipping from finding "define" through
> to lexing the expansion.  I think that's harder than it sounds, though,
> since after "#define f" the next token may or may not be part of the
> expansion.

Actually, this sounds the best way.  Just turn off comment skipping
if necessary in _cpp_create_definition before

  for (;;)

rather than in _cpp_handle_directive.  This will lose leading comment
tokens, but that's not a problem, right?  In other words, only comments
that have at least one preceding real token are retained.

If you agree and this works, please mention this in the docs.

The whitespace warning I wanted to avoid it another issue that doesn't
affect your patch, I think, so ignore that.

I'm going to do a lexer re-write which might make -CC harder to implement,
but as a benefit would avoid handling comments as extra tokens.
That might be a nicer solution in the long run, or it might not.

Neil.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]