public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Patrick Palka <patrick@parcs.ath.cx>, gcc-patches@gcc.gnu.org
Cc: dmalcolm@redhat.com
Subject: Re: [PATCH 3/3] Improve -Wmissing-indentation heuristics
Date: Mon, 22 Jun 2015 17:38:00 -0000	[thread overview]
Message-ID: <558847E5.5030203@redhat.com> (raw)
In-Reply-To: <1433871067-30661-3-git-send-email-patrick@parcs.ath.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

  parent reply	other threads:[~2015-06-22 17:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 17:31 [PATCH 1/3] Refactor entry point to -Wmisleading-indentation Patrick Palka
2015-06-09 17:31 ` [PATCH 2/3] Remove is_first_nonwhitespace_on_line(), instead improve get_visual_column() Patrick Palka
2015-06-22 17:37   ` Jeff Law
2015-06-09 18:01 ` [PATCH 3/3] Improve -Wmissing-indentation heuristics Patrick Palka
2015-06-18 16:46   ` David Malcolm
2015-06-18 16:58     ` Patrick Palka
2015-06-18 17:15       ` Patrick Palka
2015-06-22 16:51       ` Jeff Law
2015-06-22 17:38   ` Jeff Law [this message]
2015-06-18 15:45 ` [PATCH 1/3] Refactor entry point to -Wmisleading-indentation Patrick Palka
2015-06-18 16:48   ` David Malcolm
2015-06-18 17:09     ` Patrick Palka
2015-06-22 16:37     ` Jeff Law
2015-06-22 17:32 ` Jeff Law
2015-06-22 19:03   ` Patrick Palka
2015-06-23 19:14     ` Patrick Palka
2015-07-28  2:36       ` Patrick Palka
2015-07-31 16:56         ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558847E5.5030203@redhat.com \
    --to=law@redhat.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=patrick@parcs.ath.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).