This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: preprocessor macro support (should actually work now)
Jim Blandy wrote:-
> For spectators: libcpp represents the stream of source code it's
> expanding as an array of token structures, not a simple array of
> characters. When it sees some macro named X expand to a sequence that
> includes the identifier token X, it sets a flag on that token
> indicating that it should never be expanded as a macro invocation. As
> the example shows, this flag may need to remain set long after the
> original invocation of the macro named X has been processed. I don't
> see any easy way to get this effect with a string-based expander, like
> the one in my patch.
Yah, it's a mess. Have you looked at the venerable "cccp" that was the
expander for 2.95.x and earlier? It's a right kludge; but it works in
most cases (still a few bugs, and segfaults). It "surrounds" such
tokens with "\r" in its buffer, to indicate the token should not be
expanded.
It worked, but it was a little tasteless IMO 8^)
> I didn't really understand all the logistics that got brought up
> regarding moving libcpp into its own directory in the repository, to
> make it easier to share with gdb. But the sooner that happens, the
> sooner we can replace my macro expander with one that works better.
Best left to Zack. I don't think I'm qualified 8-)
Neil.