diff options
author | Bala Sankaran <bsankara@redhat.com> | 2018-08-16 11:56:46 -0400 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-08-16 10:11:25 -0700 |
commit | 16770c6d91793c4f4eca8a739d4cf541fc705cc3 (patch) | |
tree | b095be53fd2390a0bcb58791ad929d39d1a5398d /utilities | |
parent | eb27d96b41ca6425b96a0107520c4ff39ef14b8c (diff) | |
download | openvswitch-16770c6d91793c4f4eca8a739d4cf541fc705cc3.tar.gz |
checkpatch: support macro continuation
Added a test to identify a macro and skip
printing errors if the condition or loop
is part of a macro.
Additional tests are added to checkpatch
testsuite that cover conditionals and
loop constructs.
Signed-off-by: Bala Sankaran <bsankara@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/checkpatch.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 48bd5eb97..5f5dd8318 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -163,6 +163,8 @@ __regex_has_xxx_mark = re.compile(r'.*xxx.*', re.IGNORECASE) __regex_added_doc_rst = re.compile( r'\ndiff .*Documentation/.*rst\nnew file mode') __regex_empty_return = re.compile(r'\s*return;') +__regex_if_macros = re.compile(r'^ +(%s) \([\S][\s\S]+[\S]\) { \\' % + __parenthesized_constructs) skip_leading_whitespace_check = False skip_trailing_whitespace_check = False @@ -252,7 +254,9 @@ def if_and_for_end_with_bracket_check(line): if __regex_is_for_if_single_line_bracket.search(line) is not None: if not balanced_parens(line): return True - if __regex_ends_with_bracket.search(line) is None: + + if __regex_ends_with_bracket.search(line) is None and \ + __regex_if_macros.match(line) is None: return False if __regex_conditional_else_bracing.match(line) is not None: return False |