On Tue, 2016-05-10 at 22:09 +0200, Bernhard Reutner-Fischer wrote:
> 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.

It would save a conditional, but it seems a bit too much like "magic"
to me; I prefer the explicitness of the existing approach.

> 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?

I'm not sure either, but it's generally a bad idea from an i18n
perpective to be building strings at run-time, and the %qhs idea above
feels a bit like that to me.

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

There isn't one.


Dave

Reply via email to