History

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.

Joe Perches committed 12 years ago

Commit 0fe3dc21 parent 8b8856f1 file · +2 −2Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+2−2
@@ -2698,7 +2698,7 @@ sub process { · 2697 unmodified lines
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 else2700# 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 { · 39 unmodified lines
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);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t