Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Neil Booth <neil@daikokuya.demon.co.uk>
Cc: gdb-patches@sources.redhat.com, gcc@gcc.gnu.org
Subject: Re: RFC: C/C++ preprocessor macro support for GDB
Date: Mon, 18 Mar 2002 16:03:00 -0000	[thread overview]
Message-ID: <npd6y1whiy.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <20020318183339.GB19897@daikokuya.demon.co.uk>


Yes, yes.  And I'm sure there are even basic preprocessor tokenization
bugs, memory allocation bugs, wrote-=-when-he-meant-== bugs, etc.

If I say, "I believe it would be better if it used libcpp" a third or
fourth time, would that help?  Should I put it in my .sig?  Or should
I just give up?  :)

Maybe people just can't believe that, having written my own macro
expander, I could bear to see it replaced by someone else's code.  But
I *like* libcpp's code.  What I've seen I found quite legible.  Please
believe me, macroexp.c is utterly disposable.  It was written to be
disposed of --- that's why macroexp.h is so short: to make it easy to
see macroexp.c's relationship to the rest of the code, to make it easy
to replace.

What I do not want to do is block GDB's having even the most basic
macro support on integrating a 11kloc library from a different
repository, perhaps negotiating interface changes, etc.  Simply
because one is worried that desireable, important cleanups won't
happen after a change doesn't mean that GDB is better off without the
change at all.


Neil Booth <neil@daikokuya.demon.co.uk> writes:

> 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.
> > 
> 
> Jim,
> 
> 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.
> 
> Neil.


  parent reply	other threads:[~2002-03-19  0:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-16 22:23 Jim Blandy
2002-03-17  0:11 ` Zack Weinberg
2002-03-17 19:33   ` Jim Blandy
2002-03-17  4:46 ` Neil Booth
2002-03-17 20:35   ` Jim Blandy
2002-03-17 23:29     ` Neil Booth
2002-03-18  0:06       ` Daniel Berlin
2002-03-18  0:36         ` Zack Weinberg
2002-03-18  5:00           ` Daniel Berlin
2002-03-18  5:32             ` Daniel Berlin
2002-03-18 11:18           ` Jim Blandy
2002-03-18 12:09             ` Neil Booth
2002-03-18 10:45         ` Neil Booth
2002-03-18 11:45           ` Stan Shebs
2002-03-18 12:05             ` Neil Booth
2002-03-18 12:19               ` Stan Shebs
2002-03-18 15:45             ` Jim Blandy
2002-03-18  7:16     ` Andrew Cagney
2002-03-17  9:07 ` Daniel Berlin
2002-03-17 16:53   ` Daniel Berlin
2002-03-18  7:35 ` Batons? Was: " Andrew Cagney
2002-03-18 12:08   ` Jim Blandy
2002-03-18 12:55     ` Andrew Cagney
2002-03-18 15:49       ` Jim Blandy
2002-03-18  7:39 ` Andrew Cagney
2002-03-19 13:16   ` Jim Blandy
2002-03-18 10:34 ` Neil Booth
2002-03-18 11:11   ` Neil Booth
2002-03-18 16:03   ` Jim Blandy [this message]
2002-03-18 17:42     ` Stan Shebs
2002-03-18 19:51   ` Jim Blandy
2002-03-18 23:23     ` Neil Booth
2002-03-18 20:33   ` Jim Blandy
2002-03-23 12:14 ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=npd6y1whiy.fsf@zwingli.cygnus.com \
    --to=jimb@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=neil@daikokuya.demon.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox