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] c++/12266 (again)
Date: Tue, 02 Aug 2011 16:08:00 -0000	[thread overview]
Message-ID: <m3y5zb3if9.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4E31EE1A.5040204@redhat.com> (Keith Seitz's message of "Thu, 28	Jul 2011 16:17:46 -0700")

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

Keith> +static const char *ignore_typedefs[] =

Maybe 'static const char * const'?

Keith> +typedef char *namep;

defs.h already has 'char_ptr' for this purpose.

Keith> +static void
Keith> +replace_typedefs (struct demangle_parse_info *info,

Indent this line somehow.

Keith> +	  while (TYPE_CODE (TYPE_TARGET_TYPE (last)) == TYPE_CODE_TYPEDEF)
Keith> +	    last = TYPE_TARGET_TYPE (last);

It seems like you could construct a test case where the type is a stub
type, so TYPE_TARGET_TYPE == NULL, causing a crash.

Keith> +	      /* If there is only one typedef for this anonymous type,
Keith> +		 do not substitute it.  */

I don't understand this comment.
How does this code check if this anonymous type only had one typedef?

Keith> +      (void) inspect_type (info, ret_comp, free_list);

Don't cast to void.

Keith> +      /* Free any memory allocated during typedef replacement.  */
Keith> +      if (!VEC_empty (namep, free_list))
Keith> +	{
Keith> +	  int i;
Keith> +	  char *iter;
Keith> +
Keith> +	  for (i = 0; VEC_iterate (namep, free_list, i, iter); ++i)
Keith> +	    xfree (iter);

You don't need the VEC_empty check here; vec.h will do the right thing
if you try to iterate an empty (or NULL) VEC.

Keith> +  cleanup = make_cleanup (null_cleanup, NULL);
Keith> +  if (current_language->la_language == language_cplus)
Keith> +    {
Keith> +      char *canon = cp_canonicalize_string_no_typedefs (copy);
Keith> +
Keith> +      if (canon != NULL)
Keith> +	{
Keith> +	  name = canon;
Keith> +	  make_cleanup (xfree, name);
Keith> +	}

This change in linespec checks current_language, but the other does not.
Why is that?

Tom


  parent reply	other threads:[~2011-08-02 16:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29 13:16 Keith Seitz
2011-08-01 20:38 ` Tom Tromey
2011-08-02 16:08 ` Tom Tromey [this message]
2011-08-02 17:58   ` Keith Seitz
2011-08-02 20:28 ` [RFA] c++/12266 (again) [cp_demangled_name_parse_free-4.patch] Jan Kratochvil
2011-08-09 20:23   ` Keith Seitz
2011-08-13 16:51     ` Jan Kratochvil
2011-08-18 16:22       ` Keith Seitz
2011-08-02 20:37 ` [RFA] c++/12266 (again) [cp_canonicalize_no_typedefs-4.patch] Jan Kratochvil
2011-08-09 20:48   ` Keith Seitz
2011-08-13 16:50     ` Jan Kratochvil
2011-08-18 16:25       ` Keith Seitz
2011-08-18 16:35         ` 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=m3y5zb3if9.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