Checker percentage calc was wrong, also cleanup

This commit is contained in:
Campbell Barton
2014-03-29 11:25:44 +11:00
parent 3eb2724c14
commit b64bdb2c1b
5 changed files with 40 additions and 40 deletions

View File

@@ -137,13 +137,13 @@ def function_parm_wash_tokens(parm):
if not tokens: if not tokens:
return tokens return tokens
#if tokens[-1].kind == To # if tokens[-1].kind == To
# remove trailing char # remove trailing char
if tokens[-1].kind == TokenKind.PUNCTUATION: if tokens[-1].kind == TokenKind.PUNCTUATION:
if tokens[-1].spelling in (",", ")", ";"): if tokens[-1].spelling in (",", ")", ";"):
tokens.pop() tokens.pop()
#else: # else:
# print(tokens[-1].spelling) # print(tokens[-1].spelling)
t_new = [] t_new = []
for t in tokens: for t in tokens:
@@ -201,7 +201,7 @@ def function_get_arg_sizes(node):
for i, node_child in enumerate(node_parms): for i, node_child in enumerate(node_parms):
# print(node_child.kind, node_child.spelling) # print(node_child.kind, node_child.spelling)
#print(node_child.type.kind, node_child.spelling) # print(node_child.type.kind, node_child.spelling)
if node_child.type.kind == TypeKind.CONSTANTARRAY: if node_child.type.kind == TypeKind.CONSTANTARRAY:
pointee = node_child.type.get_pointee() pointee = node_child.type.get_pointee()
size = parm_size(node_child) size = parm_size(node_child)
@@ -283,7 +283,7 @@ def file_check_arg_sizes(tu):
if size_def == -1: if size_def == -1:
continue continue
#print([c.kind for c in children]) # print([c.kind for c in children])
# print(" ".join([t.spelling for t in node_child.get_tokens()])) # print(" ".join([t.spelling for t in node_child.get_tokens()]))
if len(children) == 1: if len(children) == 1:
@@ -349,8 +349,8 @@ def recursive_arg_sizes(node, ):
args_sizes = node args_sizes = node
else: else:
args_sizes = function_get_arg_sizes(node) args_sizes = function_get_arg_sizes(node)
#if args_sizes: # if args_sizes:
# print(node.spelling, args_sizes) # print(node.spelling, args_sizes)
_defs[node.spelling] = args_sizes _defs[node.spelling] = args_sizes
# print("adding", node.spelling) # print("adding", node.spelling)
for c in node.get_children(): for c in node.get_children():

View File

@@ -70,7 +70,7 @@ def main():
def my_process(i, c, cmd): def my_process(i, c, cmd):
if not USE_QUIET: if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1)) percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush() sys.stdout.flush()

View File

@@ -61,7 +61,7 @@ def main():
def my_process(i, c, cmd): def my_process(i, c, cmd):
if not USE_QUIET: if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1)) percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush() sys.stdout.flush()

View File

@@ -59,7 +59,7 @@ def main():
def my_process(i, c, cmd): def my_process(i, c, cmd):
if not USE_QUIET: if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1)) percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush() sys.stdout.flush()

View File

@@ -89,7 +89,7 @@ def main():
def my_process(i, c, cmd): def my_process(i, c, cmd):
if not USE_QUIET: if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1)) percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.write("%s %s\n" % (percent_str, c)) sys.stdout.write("%s %s\n" % (percent_str, c))