Skip to content

Commit

Permalink
checkpatch: Check FOR_EACH loops with numbers.
Browse files Browse the repository at this point in the history
OVS has defines for loops like 'BITMAP_FOR_EACH_1' or
'ULLONG_FOR_EACH_1', but the regexp in checkpatch doesn't match with
numbers and skips these loops while checking.

This patch adds numbers into regexp and adds some FER_EACH loops to
the unit tests.

Signed-off-by: Ilya Maximets <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
Acked-by: Aaron Conole <[email protected]>
  • Loading branch information
igsilya committed Jul 12, 2019
1 parent fbe67a7 commit df8c04b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/checkpatch.at
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ m4_define([COMMON_PATCH_HEADER], [dnl


AT_SETUP([checkpatch - parenthesized constructs])
for ctr in 'if' 'while' 'switch'; do
for ctr in 'if' 'while' 'switch' 'HMAP_FOR_EACH' 'BITMAP_FOR_EACH_1'; do
try_checkpatch \
"COMMON_PATCH_HEADER
+ $ctr (first_run) {
Expand Down
2 changes: 1 addition & 1 deletion utilities/checkpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def reset_counters():
# something in parentheses (usually an expression) then a left curly brace.
#
# 'do' almost qualifies but it's also used as "do { ... } while (...);".
__parenthesized_constructs = 'if|for|while|switch|[_A-Z]+FOR_*EACH[_A-Z]*'
__parenthesized_constructs = 'if|for|while|switch|[_A-Z]+FOR_*EACH[_A-Z0-9]*'

__regex_added_line = re.compile(r'^\+{1,2}[^\+][\w\W]*')
__regex_subtracted_line = re.compile(r'^\-{1,2}[^\-][\w\W]*')
Expand Down

0 comments on commit df8c04b

Please sign in to comment.