2015-06-20 22:06:22 +02:00
|
|
|
#/usr/bin/python
|
|
|
|
#
|
|
|
|
# This script analyses Cppcheck dump files to locate threadsafety issues
|
|
|
|
# - warn about static local objects
|
|
|
|
#
|
|
|
|
|
|
|
|
import cppcheckdata
|
|
|
|
import sys
|
|
|
|
|
|
|
|
def reportError(token, severity, msg):
|
|
|
|
sys.stderr.write('[' + token.file + ':' + str(token.linenr) + '] (' + severity + ') ' + msg + '\n')
|
|
|
|
|
|
|
|
def checkstatic(data):
|
|
|
|
for var in data.variables:
|
2015-06-21 09:54:07 +02:00
|
|
|
if var.isStatic==True and var.isLocal==True and var.isClass==True:
|
2015-06-20 22:06:22 +02:00
|
|
|
reportError(var.typeStartToken, 'warning', 'Local static object')
|
|
|
|
|
|
|
|
for arg in sys.argv[1:]:
|
|
|
|
print('Checking ' + arg + '...')
|
|
|
|
data = cppcheckdata.parsedump(arg)
|
|
|
|
checkstatic(data)
|