public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mike Stump <mikestump@comcast.net>
To: David Malcolm <dmalcolm@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC stage 1] Proposed new warning: -Wmisleading-indentation
Date: Thu, 16 Apr 2015 17:27:00 -0000	[thread overview]
Message-ID: <6A97A5CB-3000-4030-9E5C-BE55AE79F164@comcast.net> (raw)
In-Reply-To: <1429196485.32584.46.camel@surprise>

On Apr 16, 2015, at 8:01 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> Attached is a work-in-progress patch for a new
>  -Wmisleading-indentation
> warning I've been experimenting with, for GCC 6.

Seems like a nice idea in general.

Does it also handle:

if (cone);
  stmt;

?  Would be good to add that to the test suite, as that is another hard to spot common error that should be caught.

I do think that it is reasonable to warn for things like:

  stmt;
    stmt;

one of those two lines is likely misindented, though, maybe you want to start with the high payback things first.

> An issue here is how to determine (i), or if it's OK to default to 8

Yes, 8 is the proper value to default it to.

> and have a command-line option (param?) to override it? (though what about,
> say, each header file?)

I’ll abstain from this.  The purist in me says no option for other than 8, life goes on.  20 years ago, someone was confused over hard v soft tabbing and what exactly the editor key TAB does.  That confusion is over, the 8 people have won.  Catering to other than 8 gives the impression that the people that lost still have a chance at winning.  :-)

> Thoughts on this, and on the patch?

Would be nice to have a stricter version that warns about all wildly inconsistently or wrongly indented lines.

{
  stmt;
    stmt;  // must be same as above
}

{
stmt; // must be indented at least 1
}

if (cond)
stmt;  // must be indented at least 1

  reply	other threads:[~2015-04-16 17:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 15:08 David Malcolm
2015-04-16 17:27 ` Mike Stump [this message]
2015-04-21 16:13   ` David Malcolm
2015-04-21 16:40     ` Trevor Saunders
2015-04-21 16:43     ` Manuel López-Ibáñez
2015-04-21 17:05     ` Mike Stump
2015-04-21 18:14     ` Manuel López-Ibáñez
2015-04-21 23:35       ` David Malcolm
2015-04-28 23:50       ` [PATCH 1/3] Implement -Wmisleading-indentation (v4) David Malcolm
2015-04-28 23:52         ` [PATCH 2/3] Fix spurious semicolons David Malcolm
2015-04-29  0:10           ` Jeff Law
2015-04-28 23:53         ` [PATCH 3/3] Fix indentation issues seen by -Wmisleading-indentation David Malcolm
2015-04-29  0:25           ` Jeff Law
2015-04-29 12:35           ` Mikael Morin
2015-05-05 19:44             ` David Malcolm
2015-05-06 11:38               ` Fix logic error in Fortran OpenACC parsing (was: [PATCH 3/3] Fix indentation issues seen by -Wmisleading-indentation) Thomas Schwinge
2015-05-08 11:24                 ` Fix logic error in Fortran OpenACC parsing Ilmir Usmanov
2015-07-27 14:37                   ` Thomas Schwinge
2015-05-11 21:23         ` [PATCH 1/3] Implement -Wmisleading-indentation (v4) Jeff Law
2015-05-12 21:28           ` David Malcolm
2015-05-12 21:47             ` David Malcolm
2015-08-18 14:13               ` PR67192 (Was: Re: [PATCH 1/3] Implement -Wmisleading-indentation (v4)) Andreas Arnez
2015-04-16 18:29 ` [RFC stage 1] Proposed new warning: -Wmisleading-indentation Manuel López-Ibáñez
2015-04-17 14:42 ` Tom Tromey
2015-04-17 16:12   ` Manuel López-Ibáñez
2015-04-28 23:13     ` Joseph Myers

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=6A97A5CB-3000-4030-9E5C-BE55AE79F164@comcast.net \
    --to=mikestump@comcast.net \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).