This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/3] Improve -Wmissing-indentation heuristics
- From: Jeff Law <law at redhat dot com>
- To: Patrick Palka <patrick at parcs dot ath dot cx>, gcc-patches at gcc dot gnu dot org
- Cc: dmalcolm at redhat dot com
- Date: Mon, 22 Jun 2015 11:37:41 -0600
- Subject: Re: [PATCH 3/3] Improve -Wmissing-indentation heuristics
- Authentication-results: sourceware.org; auth=none
- References: <1433871067-30661-1-git-send-email-patrick at parcs dot ath dot cx> <1433871067-30661-3-git-send-email-patrick at parcs dot ath dot cx>
On 06/09/2015 11:31 AM, Patrick Palka wrote:
This patch improves the heuristics of the warning in a number of ways.
The improvements are hopefully adequately documented in the code
comments.
The additions to the test case also highlight the improvements.
I tested an earlier version of this patch on more than a dozen C code
bases. I only found one class of bogus warnings yet emitted, in the
libpng and bdwgc projects. These projects have a coding style which
indents code inside #ifdefs as if this code was guarded by an if(), e.g.
if (foo != 0)
x = 10;
else // GUARD
y = 100; // BODY
#ifdef BAR
blah (); // NEXT
#endif
These bogus warnings are pre-existing, however (i.e. not caused by this
patch).
gcc/c-family/ChangeLog:
* c-indentation.c (should_warn_for_misleading_indentation):
Improve heuristics.
gcc/testsuite/ChangeLog:
* c-c++-common/Wmisleading-indentation.c: Add more tests.
OK after confirming a successful bootstrap & regression test.
jeff