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.guent...@gmail.com> wrote: > On Tue, Apr 19, 2011 at 9:13 AM, Xinliang David Li <davi...@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 <nvach...@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; >> } >> >