Skip to content

Commit

Permalink
checkpatch: Fix matching on C filenames.
Browse files Browse the repository at this point in the history
Most of the prerequisite checks so far matched on filenames that ended
in some character followed by 'c' or 'h', rather than a filename that
ends in '.c' or '.h'. Fix this.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
joestringer committed Aug 9, 2017
1 parent 0d7b16d commit bcd9335
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utilities/checkpatch.py
Expand Up @@ -223,17 +223,17 @@ def is_comment_line(line):
'check': lambda x: trailing_whitespace_or_crlf(x),
'print': lambda: print_warning("Line has trailing whitespace")},

{'regex': '(.c|.h)(.in)?$', 'match_name': None,
{'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': lambda x: not if_and_for_whitespace_checks(x),
'print': lambda: print_error("Improper whitespace around control block")},

{'regex': '(.c|.h)(.in)?$', 'match_name': None,
{'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': lambda x: not if_and_for_end_with_bracket_check(x),
'print': lambda: print_error("Inappropriate bracing around statement")},

{'regex': '(.c|.h)(.in)?$', 'match_name': None,
{'regex': '(\.c|\.h)(\.in)?$', 'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': lambda x: pointer_whitespace_check(x),
'print':
Expand Down Expand Up @@ -267,7 +267,7 @@ def regex_error_factory(description):
('error', 'Use ovs_error() in place of error()'),
]
checks += [
{'regex': '(.c|.h)(.in)?$',
{'regex': '(\.c|\.h)(\.in)?$',
'match_name': None,
'prereq': lambda x: not is_comment_line(x),
'check': regex_function_factory(function_name),
Expand Down

0 comments on commit bcd9335

Please sign in to comment.