mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Joe Korty <joe.korty@ccur.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: checkpatch: brackets around single statements fix
Date: Wed, 2 May 2012 16:32:12 +0100	[thread overview]
Message-ID: <20120502153212.GE3364@shadowen.org> (raw)
In-Reply-To: <20120502151046.GA25573@tsunami.ccur.com>

On Wed, May 02, 2012 at 11:10:46AM -0400, Joe Korty wrote:
> Checkpatch thinks '#else' is the same as 'else' in its check for
> this error:
> 
>    WARNING: braces {} are not necessary for single statement blocks
> 
> Signed-off-by: Joe Korty <joe.korty@ccur.com>
> 
> Index: linux/scripts/checkpatch.pl
> ===================================================================
> --- linux.orig/scripts/checkpatch.pl	2012-04-17 05:00:37.000000000 -0400
> +++ linux/scripts/checkpatch.pl	2012-05-02 10:29:03.000000000 -0400
> @@ -3038,7 +3038,7 @@
>  			}
>  		}
>  		if (!defined $suppress_ifbraces{$linenr - 1} &&
> -					$line =~ /\b(if|while|for|else)\b/) {
> +					$line =~ /[^#]\b(if|while|for|else)\b/) {
>  			my $allowed = 0;
>  
>  			# Check the pre-context.

Interesting.  Got an example I can use to add to the test suite.

-apw

  reply	other threads:[~2012-05-02 15:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 15:10 Joe Korty
2012-05-02 15:32 ` Andy Whitcroft [this message]
2012-05-02 15:56   ` Joe Korty

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=20120502153212.GE3364@shadowen.org \
    --to=apw@canonical.com \
    --cc=joe.korty@ccur.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®