aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-08-06 19:11:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:29 -0400
commit0fe3dc2bc554b849c27c0ebc36daedf032514200 (patch)
treee30769f92c8d679ddea2d007a72f83b743736d7f /scripts
parent8b8856f4b102ce148611322465f2ff8932664411 (diff)
checkpatch: add for_each tests to indentation and brace tests
All the various for_each loop macros were not tested for trailing brace on the following lines and for bad indentation. Add them. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Greg KH <gregkh@linuxfoundation.org> Cc: Andy Whitcroft <apw@canonical.com Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 404e3d6906aa..dc72a9b3172d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2698,7 +2698,7 @@ sub process {
2698 2698
2699# if/while/etc brace do not go on next line, unless defining a do while loop, 2699# if/while/etc brace do not go on next line, unless defining a do while loop,
2700# or if that brace on the next line is for something else 2700# or if that brace on the next line is for something else
2701 if ($line =~ /(.*)\b((?:if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) { 2701 if ($line =~ /(.*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) {
2702 my $pre_ctx = "$1$2"; 2702 my $pre_ctx = "$1$2";
2703 2703
2704 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); 2704 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
@@ -2744,7 +2744,7 @@ sub process {
2744 } 2744 }
2745 2745
2746# Check relative indent for conditionals and blocks. 2746# Check relative indent for conditionals and blocks.
2747 if ($line =~ /\b(?:(?:if|while|for)\s*\(|do\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) { 2747 if ($line =~ /\b(?:(?:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) {
2748 ($stat, $cond, $line_nr_next, $remain_next, $off_next) = 2748 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
2749 ctx_statement_block($linenr, $realcnt, 0) 2749 ctx_statement_block($linenr, $realcnt, 0)
2750 if (!defined $stat); 2750 if (!defined $stat);