diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/filter-clang-warnings.py | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/contrib/filter-clang-warnings.py b/contrib/filter-clang-warnings.py index 15cca5f..2b7b42f 100755 --- a/contrib/filter-clang-warnings.py +++ b/contrib/filter-clang-warnings.py @@ -21,17 +21,24 @@ # # -import sys import argparse + def skip_warning(filename, message): ignores = { - '': ['-Warray-bounds', '-Wmismatched-tags', 'gcc_gfc: -Wignored-attributes', '-Wchar-subscripts', - 'string literal (potentially insecure): -Wformat-security', '-Wdeprecated-register', - '-Wvarargs', 'keyword is hidden by macro definition', "but the argument has type 'char *': -Wformat-pedantic", - '-Wnested-anon-types', 'qualifier in explicit instantiation of', 'attribute argument not supported: asm_fprintf', - 'when in C++ mode, this behavior is deprecated', '-Wignored-attributes', '-Wgnu-zero-variadic-macro-arguments', - '-Wformat-security'], + '': ['-Warray-bounds', '-Wmismatched-tags', + 'gcc_gfc: -Wignored-attributes', '-Wchar-subscripts', + 'string literal (potentially insecure): -Wformat-security', + '-Wdeprecated-register', + '-Wvarargs', 'keyword is hidden by macro definition', + "but the argument has type 'char *': -Wformat-pedantic", + '-Wnested-anon-types', + 'qualifier in explicit instantiation of', + 'attribute argument not supported: asm_fprintf', + 'when in C++ mode, this behavior is deprecated', + '-Wignored-attributes', '-Wgnu-zero-variadic-macro-arguments', + '-Wformat-security', '-Wundefined-internal', + '-Wunknown-warning-option'], 'insn-modes.c': ['-Wshift-count-overflow'], 'insn-emit.c': ['-Wtautological-compare'], 'insn-attrtab.c': ['-Wparentheses-equality'], @@ -47,26 +54,26 @@ def skip_warning(filename, message): for i in ignores: if name in filename and i in message: return True - return False + parser = argparse.ArgumentParser() -parser.add_argument('log', help = 'Log file with clang warnings') +parser.add_argument('log', help='Log file with clang warnings') args = parser.parse_args() -lines = [l.strip() for l in open(args.log)] +lines = [line.strip() for line in open(args.log)] total = 0 messages = [] -for l in lines: +for line in lines: token = ': warning: ' - i = l.find(token) + i = line.find(token) if i != -1: - location = l[:i] - message = l[i + len(token):] + location = line[:i] + message = line[i + len(token):] if not skip_warning(location, message): total += 1 - messages.append(l) + messages.append(line) -for l in sorted(messages): - print(l) +for line in sorted(messages): + print(line) print('\nTotal warnings: %d' % total) |