findcasts: Unify output
This commit is contained in:
parent
2015f25a84
commit
05fcfc85fa
|
@ -6,9 +6,10 @@
|
||||||
import cppcheckdata
|
import cppcheckdata
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
messages = set()
|
|
||||||
|
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
|
if arg.startswith('-'):
|
||||||
|
continue
|
||||||
|
|
||||||
print('Checking ' + arg + '...')
|
print('Checking ' + arg + '...')
|
||||||
data = cppcheckdata.parsedump(arg)
|
data = cppcheckdata.parsedump(arg)
|
||||||
|
|
||||||
|
@ -19,6 +20,10 @@ for arg in sys.argv[1:]:
|
||||||
if token.str != '(' or not token.astOperand1 or token.astOperand2:
|
if token.str != '(' or not token.astOperand1 or token.astOperand2:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Is it a lambda?
|
||||||
|
if token.astOperand1.str == '{':
|
||||||
|
continue
|
||||||
|
|
||||||
# we probably have a cast.. if there is something inside the parentheses
|
# we probably have a cast.. if there is something inside the parentheses
|
||||||
# there is a cast. Otherwise this is a function call.
|
# there is a cast. Otherwise this is a function call.
|
||||||
typetok = token.next
|
typetok = token.next
|
||||||
|
@ -33,8 +38,4 @@ for arg in sys.argv[1:]:
|
||||||
if typetok.str == 'void':
|
if typetok.str == 'void':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
msg = '[' + token.file + ':' + str(
|
cppcheckdata.reportErrorCli(token, 'information', 'found a cast', 'findcasts', 'cast')
|
||||||
token.linenr) + '] (information) findcasts.py: found a cast\n'
|
|
||||||
if msg not in messages:
|
|
||||||
messages.add(msg)
|
|
||||||
sys.stderr.write(msg)
|
|
||||||
|
|
Loading…
Reference in New Issue