On Fri, Dec 04, 2015 at 06:19:19PM +0000, Manuel López-Ibáñez wrote: > On 4 December 2015 at 17:53, Jakub Jelinek <ja...@redhat.com> wrote: > > + > > + if (e->unknown_error) > > + error_at (loc, e->unknown_error, option->opt_text); > > + else > > + error_at (loc, "unrecognized argument in option %qs", > > + option->opt_text); > > The same code that handles command-line options has: > > if (e->unknown_error) > error_at (loc, e->unknown_error, decoded->arg); > else > error_at (loc, "unrecognized argument in option %qs", opt); > > My guess is that the first error_at should use arg instead of > option->opt_text to be equivalent. Of course, ideally, this code would > not be duplicated, but rather merged "somehow".
Consider that fixed. As for duplication, as one operates on cl_decoded_option and the other not etc., this is harder, plus the missing and non-int cases are IMHO short enough that it is not worth trying hard to avoid the duplication. For the enum case which is larger, it is maybe worth adding a helper routine for it, which would need probably only location_t loc, const struct cl_enum *e, const char *opt, unsigned int lang_mask arguments. Can try that on Monday. Jakub