Always don't count ASM_FUNC functions

This commit is contained in:
octorock 2021-05-16 00:24:20 +02:00
parent f2c69d0b7c
commit 7069bd4aab
1 changed files with 17 additions and 9 deletions

View File

@ -1,17 +1,18 @@
import argparse import argparse
import git import git
import os import os
import re
def collect_non_matching_funcs(): def collect_non_matching_funcs():
result = [] result = []
for r, d, f in os.walk('asm/non_matching'): for root, dirs, files in os.walk('src'):
for file in f: for file in files:
if file.endswith('.inc'): if file.endswith('.c'):
# Assume that the filename is the function name with open(os.path.join(root, file), 'r') as f:
result.append(file[0:-4]) data = f.read()
else: # Find all NONMATCH and ASM_FUNC macros
print(r,file) for match in re.findall(r'(NONMATCH|ASM_FUNC)\(".*",\W*\w*\W*(\w*).*\)', data):
result.append(match)
return result return result
@ -85,8 +86,15 @@ def main():
matching = args.matching matching = args.matching
non_matching_funcs = [] non_matching_funcs = []
funcs = collect_non_matching_funcs()
if matching: if matching:
non_matching_funcs = collect_non_matching_funcs() # Remove all non matching funcs from count
non_matching_funcs = [x[1] for x in funcs]
else:
# Only remove ASM_FUNC functions from count
for func in funcs:
if func[0] == 'ASM_FUNC':
non_matching_funcs.append(func[1])
(src, asm, src_data, data) = parse_map(non_matching_funcs) (src, asm, src_data, data) = parse_map(non_matching_funcs)