2022-11-03 22:14:30 +01:00
|
|
|
#!/usr/bin/env python3
|
2016-11-04 22:16:46 +01:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
|
2017-06-04 22:51:48 +02:00
|
|
|
|
2016-11-04 22:16:46 +01:00
|
|
|
def hasresult(filename, result):
|
2017-06-04 22:51:48 +02:00
|
|
|
if not os.path.isfile(filename):
|
|
|
|
return False
|
|
|
|
for line in open(filename, 'rt'):
|
|
|
|
if result in line:
|
|
|
|
return True
|
2016-11-04 22:16:46 +01:00
|
|
|
return False
|
2017-06-04 22:51:48 +02:00
|
|
|
|
2016-11-04 22:16:46 +01:00
|
|
|
|
|
|
|
def parsefile(filename):
|
2017-06-04 22:51:48 +02:00
|
|
|
ret = []
|
|
|
|
linenr = 0
|
|
|
|
functionName = None
|
|
|
|
for line in open(filename, 'rt'):
|
|
|
|
linenr = linenr + 1
|
|
|
|
res = re.match('^[a-z]+[ *]+([a-z0-9_]+)[(]', line)
|
|
|
|
if res:
|
|
|
|
functionName = res.group(1)
|
|
|
|
if line.startswith('}'):
|
|
|
|
functionName = ''
|
2017-06-05 13:23:00 +02:00
|
|
|
elif 'BUG' in line or 'WARN' in line or filename == 'ub.c':
|
|
|
|
spaces = ' ' * 100
|
2017-06-04 22:51:48 +02:00
|
|
|
s = filename + spaces
|
|
|
|
s = s[:15] + str(linenr) + spaces
|
|
|
|
s = s[:20] + functionName + spaces
|
|
|
|
s = s[:50]
|
|
|
|
if hasresult('cppcheck.txt', '[' + filename + ':' + str(linenr) + ']'):
|
|
|
|
s = s + ' X'
|
|
|
|
else:
|
|
|
|
s = s + ' '
|
|
|
|
if hasresult('clang.txt', filename + ':' + str(linenr)):
|
|
|
|
s = s + ' X'
|
|
|
|
else:
|
|
|
|
s = s + ' '
|
|
|
|
if hasresult('lint.txt', filename + ' ' + str(linenr)):
|
|
|
|
s = s + ' X'
|
|
|
|
else:
|
|
|
|
s = s + ' '
|
|
|
|
if hasresult('cov.txt', filename + ':' + str(linenr)):
|
|
|
|
s = s + ' X'
|
|
|
|
else:
|
|
|
|
s = s + ' '
|
|
|
|
ret.append(s)
|
|
|
|
return ret
|
2016-11-04 22:16:46 +01:00
|
|
|
|
|
|
|
bugs = []
|
|
|
|
bugs.extend(parsefile('controlflow.c'))
|
|
|
|
bugs.extend(parsefile('data.c'))
|
|
|
|
bugs.extend(parsefile('functions.c'))
|
|
|
|
bugs.extend(parsefile('ub.c'))
|
|
|
|
for bug in bugs:
|
2017-06-04 22:51:48 +02:00
|
|
|
print(bug)
|