summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-05-06 16:29:05 -0600
committerSimon Glass <sjg@chromium.org>2020-06-11 20:52:10 -0600
commit7d5b5e8965b3f0bdf91665cf654b9eaeb9b30e52 (patch)
treeea8307bebdc559efc314f88209623b911d5ee76b
parent870bd567994b4455c9f68c3bc30fea6499fe5f54 (diff)
downloadu-boot-7d5b5e8965b3f0bdf91665cf654b9eaeb9b30e52.tar.gz
u-boot-7d5b5e8965b3f0bdf91665cf654b9eaeb9b30e52.tar.bz2
u-boot-7d5b5e8965b3f0bdf91665cf654b9eaeb9b30e52.zip
patman: Support emacs mode with checkpatch
If checkpatch is run in 'emacs' mode it shows the filename at the start of each line. Add support for this so that the warnings and errors are correctly detected. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--tools/patman/checkpatch.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index a2611a8a82..16d534b6ae 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -72,13 +72,17 @@ def CheckPatch(fname, verbose=False):
# total: 0 errors, 0 warnings, 159 lines checked
# or:
# total: 0 errors, 2 warnings, 7 checks, 473 lines checked
- re_stats = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)')
- re_stats_full = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)'
+ emacs_prefix = '(?:[0-9]{4}.*\.patch:[0-9]+: )?'
+ emacs_stats = '(?:[0-9]{4}.*\.patch )?'
+ re_stats = re.compile(emacs_stats +
+ 'total: (\\d+) errors, (\d+) warnings, (\d+)')
+ re_stats_full = re.compile(emacs_stats +
+ 'total: (\\d+) errors, (\d+) warnings, (\d+)'
' checks, (\d+)')
re_ok = re.compile('.*has no obvious style problems')
re_bad = re.compile('.*has style problems, please review')
re_error = re.compile('ERROR: (.*)')
- re_warning = re.compile('WARNING: (.*)')
+ re_warning = re.compile(emacs_prefix + 'WARNING:(?:[A-Z_]+:)? (.*)')
re_check = re.compile('CHECK: (.*)')
re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):')