This is the mail archive of the gdb-patches@sourceware.org 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: [patch 0/3] Re: [RFA] c++/11734 revisited (and c++/12273)


Hi Keith,

On Tue, 15 Mar 2011 19:48:09 +0100, Keith Seitz wrote:
> Hi, Jan, thank you for taking the time to look at this.  Believe me
> when I say, I feel for ya!

fortunately it seems this part of linespec is done.


> Thanks again for looking at this.  FWIW, I've attached only the
> linespec patch which includes the requested changes.

I guess there should have been a ChangeLog for FSF patch reviews compliance
but I am fine with it as is.


> +static char *
> +keep_name_info (char *ptr)
> +{
> +  char *p = ptr;
> +  char *start = ptr;
> +
> +  /* Keep any template parameters.  */
> +  if (name_end (ptr))
> +    goto done;
> +
> +  while (isspace (*p))
> +    ++p;
> +  if (*p == '<')
> +    ptr = p = find_template_name_end (ptr);
> +
> +  if (name_end (ptr))
> +    goto done;
> +
> +  /* Keep method overload information.  */
> +  if (*p == '(')
> +    ptr = p = find_method_overload_end (p);
> +
> +  if (name_end (ptr))
> +    goto done;
> +
> +  /* Keep important keywords.  */  
> +  while (isspace (*p))
> +    ++p;
> +  if (strncmp (p, "const", 5) == 0
> +      && (isspace (p[5]) || p[5] == '\0'
> +	  || strchr (get_gdb_completer_quote_characters (), p[5]) != NULL))
> +    ptr = p = p + 5;
> +
> + done:
> +  while (ptr > start && isspace (*(ptr - 1)))
                                    ptr[-1]
> +    --ptr;
> +  return ptr;
> +}

I see now the goto is in fact not any win here.

static const char *
remove_tail_spaces (const char *start, const char *s)
{
  while (s > start && isspace (s[-1]))
    s--;

  return s;
}
...
  if (name_end (ptr))
    return remove_tail_spaces (start, ptr);

So asking for this change if I haven't missed anything and a check-in.


Thanks,
Jan


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