mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* checkpatch: brackets around single statements fix
@ 2012-05-02 15:10 Joe Korty
  2012-05-02 15:32 ` Andy Whitcroft
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Korty @ 2012-05-02 15:10 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: joe.korty, linux-kernel

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-02 15:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-02 15:10 checkpatch: brackets around single statements fix Joe Korty
2012-05-02 15:32 ` Andy Whitcroft
2012-05-02 15:56   ` Joe Korty

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®