Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org,  tromey@redhat.com
Subject: Re: RFA: fix PR macros/2564
Date: Thu, 11 Dec 2008 17:53:00 -0000	[thread overview]
Message-ID: <200812111753.22624.pedro@codesourcery.com> (raw)
In-Reply-To: <m3tz9aej4d.fsf@fleche.redhat.com>

On Thursday 11 December 2008 17:06:58, Tom Tromey wrote:
> This patch fixes PR macros/2564.
> 
> The bug here is that the lexer calls finished_macro_expansion, freeing
> the macro expansion text, while a token referring to this memory is
> still "live".  This happens because the parser has not yet reduced the
> rule using this token.
> 
> This patch fixes this problem in a simple way: we create an obstack
> for use during parsing, and simply keep all macro expansions on this
> obstack for the duration of the parse.
> 

> Built and regtested on x86-64 (compile farm).
> 
> Please review.

It looks quite reasonable to me.  OK.

Thanks a lot.

> 
> Tom
> 
> 2008-12-11  Tom Tromey  <tromey@redhat.com>
> 
> 	PR macros/2564:
> 	* c-exp.y (macro_original_text, expansion_obstack,
> 	expression_macro_scope): New globals.
> 	(scan_macro_expansion): New function.
> 	(scanning_macro_expansion): Likewise.
> 	(finished_macro_expansion): Likewise.
> 	(scan_macro_cleanup): Likewise.
> 	(c_parse): Find macro scope.  Initialize obstack.
> 	* c-lang.h (scan_macro_expansion, scanning_macro_expansion,
> 	finished_macro_expansion, expression_macro_lookup_func,
> 	expression_macro_lookup_baton): Remove.
> 	* c-lang.c (scan_macro_expansion, scanning_macro_expansion,
> 	finished_macro_expansion, expression_macro_lookup_func,
> 	expression_macro_lookup_baton): Remove.
> 	(macro_original_text, macro_expanded_text,
> 	c_preprocess_and_parse): Remove.
> 	(c_language_defn, cplus_language_defn, asm_language_defn,
> 	minimal_language_defn): Use c_parse.
> 
> 2008-12-11  Tom Tromey  <tromey@redhat.com>
> 
> 	* gdb.base/macscp.exp: Print "address.addr".
> 	* gdb.base/macscp1.c (struct outer): New struct.
> 	(address): New global.
> 

-- 
Pedro Alves


  reply	other threads:[~2008-12-11 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 17:07 Tom Tromey
2008-12-11 17:53 ` Pedro Alves [this message]
2008-12-11 18:34   ` Tom Tromey

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=200812111753.22624.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /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