public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: gcc-patches@gcc.gnu.org,  joseph@codesourcery.com,
		jason@redhat.com, 	dmalcolm@redhat.com
Subject: Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage
Date: Mon, 08 Jun 2015 18:59:00 -0000	[thread overview]
Message-ID: <87wpzeca3f.fsf@googlemail.com> (raw)
In-Reply-To: <1433707596-6988-1-git-send-email-patrick@parcs.ath.cx> (Patrick	Palka's message of "Sun, 7 Jun 2015 16:06:36 -0400")

Patrick Palka <patrick@parcs.ath.cx> writes:
> At the same time this patch extends the coverage of the
> -Wmisleading-indentation implementation to catch misleading indentation
> involving the semicolon.  (These changes are all contained in
> c-indentation.c.)  For example, now we warn on the following code
> samples:
>
>   if (flag);
>     foo ();
>
>   while (flag);
>   {
>     ...
>   }
>
>   if (flag); {
>     ...
>   }
>
>   if (flag)
>     ; /* blah */ {
>       ...
>     }
>
>   if (flag); foo ();
>
> while avoiding to warn on code that is poorly indented but not
> misleadingly so;
>
>   while (flag);
>   foo ();
>
>   while (flag)
>     ;
>     foo ();

Maybe I've just been doing too much Python recently, but unlike the
other two examples, this one does seem a little misleading.  What would
happen for:

  while (flag)
    /* blah */;
    foo ();

where the semicolon is hidden after a comment?

Thanks to David and you for the patches btw -- looks like a really
useful feature.

Richard

>   if (flag1)
>     ;
>   if (flag)
>     ;
>   else
>    ...

  parent reply	other threads:[~2015-06-08 18:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-07 21:01 Patrick Palka
2015-06-08  0:20 ` Patrick Palka
2015-06-08 18:46 ` David Malcolm
2015-06-08 19:36   ` Patrick Palka
2015-06-08 19:49     ` Richard Sandiford
2015-06-08 18:59 ` Richard Sandiford [this message]
2015-06-08 19:44   ` Patrick Palka

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=87wpzeca3f.fsf@googlemail.com \
    --to=rdsandiford@googlemail.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --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).