Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Add parsing support for C++ operators
Date: Wed, 11 Nov 2009 15:12:00 -0000	[thread overview]
Message-ID: <m3fx8l6qps.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4AFA0A93.7040709@redhat.com> (Keith Seitz's message of "Tue, 10 	Nov 2009 16:51:31 -0800")

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> 2009-11-10  Keith Seitz  <keiths@redhat.com>
Keith> 	* c-expy. (operator_stoken): New function.
Keith> 	(OPERATOR): New token.
Keith> 	(NEW): New token.
Keith> 	(DELETE): New token.
Keith> 	(operator): New rule.
Keith> 	(name): Add operator.
Keith> 	(ident_tokens): Add "new", "delete", and "operator".
Keith> 	* gdbtypes.c (rank_one_type): Don't complain about
Keith> 	void pointer conversion badness if both types are
Keith> 	void pointers.

Keith> +	|	OPERATOR ptype
Keith> +			{ char *name;
Keith> +			  long length;
Keith> +			  struct ui_file *buf = mem_fileopen ();
Keith> +
Keith> +			  c_print_type ($2, NULL, buf, -1, 0);
Keith> +			  name = ui_file_xstrdup (buf, &length);
Keith> +			  ui_file_delete (buf);
Keith> +			  $$ = operator_stoken (name);

This leaks 'name', you need a free after the call to operator_stoken.

Keith> +  /* The toplevel (c_parse) will free the memory allocated here.  */
Keith> +  make_cleanup (free, st.ptr);
Keith> +  return st;

On irc you expressed some doubt about this approach.  It is fine.

This is ok with the above change.  Thanks.

Tom


  reply	other threads:[~2009-11-11 15:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  0:51 Keith Seitz
2009-11-11 15:12 ` Tom Tromey [this message]
2009-11-11 16:47   ` Keith Seitz
2009-11-21  5:17 ` Pedro Alves
2009-11-21 19:05   ` Keith Seitz

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=m3fx8l6qps.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@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