This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/RFA] Add -CC option to cpplib to save comments in macros
- From: Jason R Thorpe <thorpej at wasabisystems dot com>
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 5 Apr 2002 12:35:11 -0800
- Subject: Re: [PATCH/RFA] Add -CC option to cpplib to save comments in macros
- Organization: Wasabi Systems, Inc.
- References: <20020405103322.D13917@dr-evil.shagadelic.org> <20020405193409.GA29247@daikokuya.demon.co.uk>
- Reply-to: thorpej at wasabisystems dot com
On Fri, Apr 05, 2002 at 08:34:09PM +0100, Neil Booth wrote:
> I'd like this to do something sensible for C++ options; I don't think
> your patch currently does?
Yah, the C++ thing is kind of hard. It's not clear to me that you *can*
make it work in any reasonable way with C++ comments. (Hm, maybe by using
a different token type for C++ comments?)
However, this is one of the reasons I think it should be a separate
option from -C.
> Do
>
> #/**/define foo
This works fine.
> and
>
> #define/**/x
This produces:
neil.c:3:8: macro names must be identifiers
Should I turn the comment into whitespace in this case? Looks like a
simple change to cpplib.c:lex_macro_node().
> and
>
> #define f(x /**/, y)
...and this produces:
neil.c:5:13: "/**/" may not appear in macro parameter list
Should I skip comments when processing the parameter list? This also
looks like a simple change, to cppmacro.c:parse_params().
...or would it be better to put that logic into _cpp_lex_token()? (Though,
to do that, you'd need to have a "define-directive-processing-state" variable
or something, to tell _cpp_lex_token() what to do...ick...seems easier to
deal with it in each place where it matters.)
> etc. work, particularly with -pedantic?
...results are the same with or without -pedantic.
> b.t.w. I'm away for a week starting tomorrow.
Eek, well, let me try to address your concerns quickly :-)
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>