On 4/1/19 6:11 AM, Martin Liška wrote:
> Hi.
> 
> Last week I was curious which warnings are disabled by default on top
> of -Wall and -Wextra. Thus I used --help=warning and noticed some discrepancy
> in between documentation and output of the --help option.
> 
> I created PR89885 where I explained that OPT__help_ option handling happens
> early. That's why LangEnabledBy are not reflected and similarly target 
> overrides
> don't take place.
> 
> I'm attaching diff for --help=warning for C++ and -Ofast.
> 
> Thoughts?
> 
> gcc/ChangeLog:
> 
> 2019-04-01  Martin Liska  <mli...@suse.cz>
> 
>       * gcc.c (process_command): Add dummy file only
>       if n_infiles == 0.
>       * opts-global.c (decode_options): Pass lang_mask.
>       * opts.c (print_help): New function.
>       (finish_options): Print --help if help_option_argument
>       is set.
>       (common_handle_option): Factor out content of OPT__help_
>       into print_help.
>       * opts.h (finish_options): Add new argument.
> ---
>  gcc/gcc.c         |   3 +-
>  gcc/opts-global.c |   2 +-
>  gcc/opts.c        | 267 ++++++++++++++++++++++++----------------------
>  gcc/opts.h        |   3 +-
>  4 files changed, 146 insertions(+), 129 deletions(-)
> 
> 
> 
> 0001-Postpone-print-of-help-option.patch
> 
> diff --git a/gcc/gcc.c b/gcc/gcc.c
> index 4f57765b012..7ce1cae28a7 100644
> --- a/gcc/gcc.c
> +++ b/gcc/gcc.c
> @@ -4751,7 +4751,8 @@ process_command (unsigned int decoded_options_count,
>      }
>  
>    /* Ensure we only invoke each subprocess once.  */
> -  if (print_subprocess_help || print_help_list || print_version)
> +  if (n_infiles == 0
> +      && (print_subprocess_help || print_help_list || print_version))
>      {
>        n_infiles = 0;
The assignment to n_infiles is redundant after your change.  I suspect
the optimizers will catch this, so if you want to keep it for clarity
that's fine with me.

OK for the trunk.  Your call whether or not to remove the redundant
assignment.

jeff

Reply via email to