diff options
author | Aaron Conole <aconole@bytheb.org> | 2016-10-21 14:49:08 -0400 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-11-28 17:04:54 -0800 |
commit | a1193b4def4e3b7b9699d4756459cb375e7f9fc6 (patch) | |
tree | 194ee4e3b1daf9b3195425f7381d0af9fd1c3a06 /utilities | |
parent | 83f76d4ef193f0e44ebfd012f16bf0959ab562af (diff) | |
download | openvswitch-a1193b4def4e3b7b9699d4756459cb375e7f9fc6.tar.gz |
checkpatch: fix the if and whitespace checks
The regex for the if/for/while bracket tests fails to distinguish
non-space text. This means text such as do_something_if() would match
incorrectly.
Additionally, the ends-with-bracket test doesn't allow for the common
coding paradigm:
if (condition) { /* Text about conditional. */
}
So fix that as well.
Signed-off-by: Aaron Conole <aconole@bytheb.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/checkpatch.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index d21574cc8..ab389ba44 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -59,13 +59,14 @@ __regex_leading_with_whitespace_at_all = re.compile(r'^\s+') __regex_leading_with_spaces = re.compile(r'^ +[\S]+') __regex_trailing_whitespace = re.compile(r'[^\S]+$') __regex_single_line_feed = re.compile(r'^\f$') -__regex_for_if_missing_whitespace = re.compile(r'(if|for|while)[\(]') -__regex_for_if_too_much_whitespace = re.compile(r'(if|for|while) +[\(]') -__regex_for_if_parens_whitespace = re.compile(r'(if|for|while) \( +[\s\S]+\)') +__regex_for_if_missing_whitespace = re.compile(r' +(if|for|while)[\(]') +__regex_for_if_too_much_whitespace = re.compile(r' +(if|for|while) +[\(]') +__regex_for_if_parens_whitespace = \ + re.compile(r' +(if|for|while) \( +[\s\S]+\)') __regex_is_for_if_single_line_bracket = \ re.compile(r'^ +(if|for|while) \(.*\)') - -__regex_ends_with_bracket = re.compile(r'[^\s]\) {$') +__regex_ends_with_bracket = \ + re.compile(r'[^\s]\) {(\s+/\*[\s\Sa-zA-Z0-9\.,\?\*/+-]*)?$') skip_leading_whitespace_check = False skip_trailing_whitespace_check = False |