This is the mail archive of the 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: RFC: C/C++ preprocessor macro support for GDB

Jim Blandy wrote:-

> The following patch adds support for C/C++ preprocessor macros to GDB.
> It's tentative:
> - There are no ChangeLog entries.
> - It's not broken up into relatively independent changes.
> - There's no documentation.
> - There are no tests.
> - There are some unimplemented features.


I've looked over your patch a little more, and I don't think your macro
expander works, because it doesn't mark individual tokens.  A "disabled
macro" stack is *not* enough by itself to implement ISO C macro expansion
semantics.  You need to attach information to individual tokens as well.
I've not tried it, but I'd bet that

#define A(x) x A(A)(1)

expands to "1" with your code, whereas the correct expansion is "A(1)".
Implementing this properly is a PITA, more so with a text-based expander
like yours.  It would be very hard to get the same (correct) semantics as
cpplib in corner cases with a text-based expander (2.95 has outstanding
bugs in this area).

In addition, as you note #, ## and the various variadic macro semantics
and GCC extensions have not been implemented, I think a lot of work lies
ahead in this implementation.  IMO using cpplib will be a lot less effort,
even after what you've already accomplished.


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