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 FOR_EACH loops to
the unit tests.

Signed-off-by: Ilya Maximets <i.maxim...@samsung.com>
---
 tests/checkpatch.at     | 2 +-
 utilities/checkpatch.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/checkpatch.at b/tests/checkpatch.at
index 07f4b137c..f3b26dd34 100755
--- a/tests/checkpatch.at
+++ b/tests/checkpatch.at
@@ -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) {
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index ae86937c8..de5061406 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -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]*')
-- 
2.17.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to