On 1/29/18 2:33 PM, Peter Bergner wrote: > The current version of that code looks like the following, which I should > copy instead. Unless you have a different suggestion? > > char *s; > > if (e->unknown_error) > error_at (loc, e->unknown_error, arg); > else > error_at (loc, "unrecognized argument in option %qs", opt); > > auto_vec <const char *> candidates; > for (i = 0; e->values[i].arg != NULL; i++) > { > if (!enum_arg_ok_for_language (&e->values[i], lang_mask)) > continue; > candidates.safe_push (e->values[i].arg); > } > const char *hint = candidates_list_and_hint (arg, s, 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); > XDELETEVEC (s);
Actually, all the "macic" of this code happens in candidates_list_and_hint() and that looks much like the GCC 5 code I showed, plus a call to find_closest_string() which we don't want, so I think just sticking with the original code in the last patch is probably best. Peter