This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH resend 1/2] PR c/65403 - Ignore -Wno-error=<some-future-warning>
On 8/23/19 6:52 PM, Alex Henrie wrote:
> On Fri, Aug 23, 2019 at 3:13 AM Martin Liška <mliska@suse.cz> wrote:
>> On 8/23/19 6:17 AM, Alex Henrie wrote:
>>> +vec<const char *> ignored_wnoerror_options;
>>
>> Here you'll need to add a comment.
>
> The declaration of ignored_options in opts-global.c doesn't have a
> comment either. What would you like the comment to say?
I would just write a comment for
ignored_wnoerror_options
>
>>> + const char * opt = ignored_wnoerror_options.pop ();
>>
>> No space between '*' and 'opt' please.
>
> Okay.
>
>> You don't want to append and option that is already in the ignored_wnoerror_options:
>>
>> $
>> ./xgcc -B. -Wunused-variable -Werror -Wno-error=some-future-warning -Wno-error=some-future-warning /tmp/main2.c
>> /tmp/main2.c: In function ‘main’:
>> /tmp/main2.c:3:7: error: unused variable ‘foo’ [-Werror=unused-variable]
>> 3 | int foo; /* { dg-error "unused variable 'foo'" } */
>> | ^~~
>> /tmp/main2.c: At top level:
>> cc1: error: ‘-Wno-error=some-future-warning’: no option ‘-Wsome-future-warning’ [-Werror]
>> cc1: error: ‘-Wno-error=some-future-warning’: no option ‘-Wsome-future-warning’ [-Werror]
>> cc1: all warnings being treated as errors
>>
>> As seen the error is there twice.
>
> Joseph explicitly asked me to make -Wno-error=some-future-warning
> behave the same as -Wno-some-future-warning (see
> <https://gcc.gnu.org/ml/gcc-patches/2019-03/msg00065.html>), and
> -Wno-some-future-warning prints multiple warnings if the option is
> given multiple times.
>
>> One question about the behavior:
>>
>> Why do I need to have another warning to get the warning: ‘-Wno-error=some-future-warning’ printed?
>
> If we always give a warning about -Wno-error=some-future-warning then
> combining that option with -Werror would cause compilation to fail,
> which we don't want.
Ah, I see. It's not easy to implement that in a reasonable way. Now I understand that.
Thanks,
Martin
>
> -Alex
>