diff options
author | Aaron Conole <aconole@redhat.com> | 2021-06-25 13:18:07 -0400 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-07-01 16:31:55 +0200 |
commit | b6c5f30cfa9994a1069bc6bef28a270bbb61df6c (patch) | |
tree | eb796ab5f76771aa81a821ccb3d914d54520479e /utilities/checkpatch.py | |
parent | 772a842fb5489c810a321457e53e384a6d607bfd (diff) | |
download | openvswitch-b6c5f30cfa9994a1069bc6bef28a270bbb61df6c.tar.gz |
checkpatch: Ignore macro definitions of FOR_EACH.
When defining a FOR_EACH macro, checkpatch freaks out and generates a
control block whitespace error. Create an exception so that it doesn't
generate errors for this case.
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2020-August/373509.html
Reported-by: Toshiaki Makita <toshiaki.makita1@gmail.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'utilities/checkpatch.py')
-rwxr-xr-x | utilities/checkpatch.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index ac14da29b..699fb4b02 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -157,6 +157,8 @@ __regex_trailing_whitespace = re.compile(r'[^\S]+$') __regex_single_line_feed = re.compile(r'^\f$') __regex_for_if_missing_whitespace = re.compile(r' +(%s)[\(]' % __parenthesized_constructs) +__regex_hash_define_for_each = re.compile( + r'#define [_A-Z]+FOR_*EACH[_A-Z0-9]*\(') __regex_for_if_too_much_whitespace = re.compile(r' +(%s) +[\(]' % __parenthesized_constructs) __regex_for_if_parens_whitespace = \ @@ -245,9 +247,11 @@ def if_and_for_whitespace_checks(line): """ if skip_block_whitespace_check: return True - if (__regex_for_if_missing_whitespace.search(line) is not None or - __regex_for_if_too_much_whitespace.search(line) is not None or - __regex_for_if_parens_whitespace.search(line)): + if (__regex_for_if_missing_whitespace.search(line) is not None and + __regex_hash_define_for_each.search(line) is None): + return False + if (__regex_for_if_too_much_whitespace.search(line) is not None or + __regex_for_if_parens_whitespace.search(line)): return False return True |