[PATCH] options: Make --help= to emit values post-overrided
Segher Boessenkool
segher@kernel.crashing.org
Fri Aug 14 22:01:47 GMT 2020
Hi!
On Fri, Aug 14, 2020 at 01:42:24PM +0800, Kewen.Lin wrote:
> > I think personally I'd prefer an option (3): call
> > target_option_override_hook directly in decode_options,
> > if help_option_arguments is nonempty. Like you say,
> > decode_options appears to be the only caller of print_help.
>
> Good idea! The related patch is attached, different from opts_alt{1,2}
> it could still call target_option_override_hook even if we won't call
> print_specific_help eventually for some special cases like lang_mask is
> CL_DRIVER or include_flags is empty. But I think it's fine.
> --- a/gcc/opts-global.c
> +++ b/gcc/opts-global.c
> @@ -327,8 +327,14 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
> unsigned i;
> const char *arg;
>
> - FOR_EACH_VEC_ELT (help_option_arguments, i, arg)
> - print_help (opts, lang_mask, arg);
> + if (!help_option_arguments.is_empty ())
> + {
> + /* Consider post-overrided values for --help=*. */
I'd say
/* Make sure --help=* see the overridden values. */
> + target_option_override_hook ();
> +
> + FOR_EACH_VEC_ELT (help_option_arguments, i, arg)
> + print_help (opts, lang_mask, arg);
> + }
> }
The patch looks just fine to me. But, not my call :-)
Segher
More information about the Gcc-patches
mailing list