This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] c++/12266 (again)

>>>>> "Keith" == Keith Seitz <> 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> +	    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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]