A lot of checkpatch warnings are only enabled for particular kinds of
files, e.g. C warnings only apply to C source and header files.  The -f
option didn't pass the file name to the code that determines what kinds
of warnings to report, so only generic warnings were actually reported.
This fixes that problem.

Signed-off-by: Ben Pfaff <[email protected]>
---
 utilities/checkpatch.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 443b8c0481c2..295ecd4537bb 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -276,13 +276,13 @@ def run_checks(current_file, line, lineno):
         print("%s\n" % line)
 
 
-def ovs_checkpatch_parse(text):
-    global print_file_name, total_line
+def ovs_checkpatch_parse(text, filename):
+    global print_file_name, total_line, checking_file
     lineno = 0
     signatures = []
     co_authors = []
     parse = 0
-    current_file = ''
+    current_file = filename if checking_file else ''
     previous_file = ''
     scissors = re.compile(r'^[\w]*---[\w]*')
     hunks = re.compile('^(---|\+\+\+) (\S+)')
@@ -387,7 +387,7 @@ def ovs_checkpatch_file(filename):
     for part in mail.walk():
         if part.get_content_maintype() == 'multipart':
             continue
-    result = ovs_checkpatch_parse(part.get_payload(decode=True))
+    result = ovs_checkpatch_parse(part.get_payload(decode=True), filename)
     if result < 0:
         print("Lines checked: %d, Warnings: %d, Errors: %d" %
               (total_line, __warnings, __errors))
@@ -436,5 +436,5 @@ if __name__ == '__main__':
         if sys.stdin.isatty():
             usage()
             sys.exit(-1)
-        sys.exit(ovs_checkpatch_parse(sys.stdin.read()))
+        sys.exit(ovs_checkpatch_parse(sys.stdin.read()), '-')
     sys.exit(ovs_checkpatch_file(filename))
-- 
2.10.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to