This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Merge cpplib and front end hashtables, part 1
Daniel Berlin wrote:-
> At the point we go to do the macro expansion, we have already
> converted the expression into a bunch of opcodes that get evaluated by
> gdb in a stack machine. The parser has done it's work, and thus, we
> don't have a parser to hand it back to. The language dependent code
> is done, in other words.
But what if the macro contains unmatched parentheses or operators or
other nasties? Then you're screwed, no?
> Because we have no parser to hand it back to, with context and all, at
> this point.
> In other words, macro expansion ain't done in the parser, it's called
> by the evaluator. It would be a serious hunk of work to move it back
> into the parser, and then make the parser use cpplib internally.
>
> It would be less work to write a good macro expander then it would to do
> the above.
But I think making the expression parser use cpplib is the only
correct solution if you want to handle macros properly. Anything else
is half-baked IMO.
Neil.