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


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>


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