This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: FDO usage: -Wcoverage-mismatch should not ignore -Wno-error
- From: Xinliang David Li <davidxl at google dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, Neil Vachharajani <nvachhar at gmail dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Wed, 20 Apr 2011 09:34:56 -0700
- Subject: Re: FDO usage: -Wcoverage-mismatch should not ignore -Wno-error
- References: <BANLkTi=-QuDzrCzA7JjZj8uPs+CGa0GRBA@mail.gmail.com> <BANLkTimsQFdmWZXy2sqsS=XY7CQ=6nYqmw@mail.gmail.com>
This would work if there is a way to set Werror=coverage-mismatch
without having to explicitly set the option classification as
DK_ERROR. Does this mechanism exist?
Thanks,
David
On Tue, Apr 19, 2011 at 12:52 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Tue, Apr 19, 2011 at 9:13 AM, Xinliang David Li <davidxl@google.com> wrote:
>> -Wcoverage-mismatch is enabled by default, and the warning is promoted
>> to error by default. However in the current implementation -Wno-error
>> can not demote the error back to warning. The patch was ported from
>> one contributed by Neil.
>>
>> OK for trunk after regression testing?
>
> I am sure there is a better way to achieve this, like making
> Werror=coverage-mismatch
> the default. ?Joseph?
>
> Richard.
>
>>
>> 2011-04-18 ?Neil Vachharajani ?<nvachhar@gmail.com>
>>
>> ? ?* flags.c: ?New flag variable.
>> ? ?* opts.c (common_handle_options): Set flag_werror_set.
>> ? ?* opts-global.c (decode_options): Delay Werror decision
>> ? ?for Wcoverage-mismatch util after options are parsed.
>>
>> The following test case can be added, but the test harness does not
>> like the extra warnings -- how can they be pruned?
>>
>> Thanks,
>>
>> David
>>
>> /* { dg-options "-O2 -Wcoverage-mismatch -Wno-error" } */
>>
>> int __attribute__((noinline)) bar (void)
>> {
>> }
>>
>> #ifdef _PROFILE_USE
>> int foo (int i)
>> {
>> ?if (i)
>> ? ?bar ();
>> ?else
>> ? bar ();
>> ?return 0;
>> }
>> #else
>> int foo (int i)
>> {
>> ?if (i)
>> ? ?bar ();
>> ?return 0;
>> }
>> #endif
>>
>> int main(int argc, char **argv)
>> {
>> ?foo (argc);
>> ?return 0;
>> }
>>
>