This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] PR driver/69265: add hint for options with misspelled arguments


On Mon, May 09, 2016 at 08:14:47PM -0400, David Malcolm wrote:

> -      inform (loc, "valid arguments to %qs are: %s", option->opt_text, s);
> +      const char *hint = find_closest_string (arg, &candidates);
> +      if (hint)
> +	inform (loc, "valid arguments to %qs are: %s; did you mean %qs?",
> +		option->opt_text, s, hint);
> +      else
> +	inform (loc, "valid arguments to %qs are: %s", option->opt_text, s);
> +

btw.. did you consider a format specifier for this ";did you mean %qs"
common stanza?

inform (loc, "valid arguments to %qs are: %s%qhs", x, y, hint);
(let's say) where the specifier would end up empty if hint was NULL.

I don't really like all these odd conditionals on the hints and it also
adds some bloat to have all these duplicate error strings.

Not sure but maybe this would even help translators?

Is there a -Wno-spelling-suggestions to turn the suggestions off
globally, btw?

thanks,


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