This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] c++/12266 (again)
- From: Tom Tromey <tromey at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 02 Aug 2011 10:08:26 -0600
- Subject: Re: [RFA] c++/12266 (again)
- References: <4E31EE1A.5040204@redhat.com>
>>>>> "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