On 3/18/19 8:46 PM, Alex Henrie wrote:
> From: Manuel López-Ibáñez <m...@gcc.gnu.org>
> 
> * opts.c: Ignore -Wno-error=<some-future-warning> except if there are
> other diagnostics.
That's not a complete ChangeLog entry.  Each file/function changed
should be mentioned.  Something like this:

        * opts-common.c (ignored_wnoerror_options): New global variable.
        * opts-global.c (print_ignored_options): Ignore
        -Wno-error=<some-future-warning> except if there are other
        diagnostics.
        * opts.c (enable_warning_as_error): Record ignored -Wno-error
        options.
        opts.h (ignored_wnoerror_options): Declare.

> diff --git a/gcc/opts.c b/gcc/opts.c
> index 3161e0b6753..4fa79306e30 100644
> --- a/gcc/opts.c
> +++ b/gcc/opts.c
> @@ -3079,7 +3079,10 @@ enable_warning_as_error (const char *arg, int value, 
> unsigned int lang_mask,
>    strcpy (new_option + 1, arg);
>    option_index = find_opt (new_option, lang_mask);
>    if (option_index == OPT_SPECIAL_unknown)
> -    error_at (loc, "%<-Werror=%s%>: no option -%s", arg, new_option);
> +    if (value)
> +      error_at (loc, "%<-Werror=%s%>: no option -%s", arg, new_option);
> +    else
> +      ignored_wnoerror_options.safe_push (arg);
>    else if (!(cl_options[option_index].flags & CL_WARNING))
>      error_at (loc, "%<-Werror=%s%>: -%s is not an option that controls "
>             "warnings", arg, new_option);
This hunk is my only concern with the patch.  In particular how is this
going to interact with the hints/suggestions we emit when we see an
unknown option?

The code on the trunk looks like this now:

>   if (option_index == OPT_SPECIAL_unknown)
>     {
>       option_proposer op;
>       const char *hint = op.suggest_option (new_option);
>       if (hint)
>         error_at (loc, "%<-W%serror=%s%>: no option %<-%s%>;"
>                   " did you mean %<-%s%>?", value ? "" : "no-",
>                   arg, new_option, hint);
>       else
>         error_at (loc, "%<-W%serror=%s%>: no option %<-%s%>",
>                   value ? "" : "no-", arg, new_option);
>     }
If HINT is set, do we still want to potentially push the argument onto
the ignored_wnoerror_options list?  My inclination is yes since the hint
is just that, a fuzzily matched hint.  That hint may be appropriate
(user typo'd or somesuch) or it may be totally offbase (user was trying
to turn off some future warning.

I'm open to other opinions here.

jeff

Reply via email to