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
26982698
26992699 # if/while/etc brace do not go on next line, unless defining a do while loop,
27002700 # 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*\#/) {
27022702 my $pre_ctx = "$1$2";
27032703
27042704 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
@@ -2744,7 +2744,7 @@ sub process { · 39 unmodified lines
27442744 }
27452745
27462746 # 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*/) {
27482748 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
27492749 ctx_statement_block($linenr, $realcnt, 0)
27502750 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