98 output_file =
"function_declarations.txt"
99 directory = os.path.join(os.getcwd(),
"src")
100 all_declarations = []
103 with open(output_file,
'w')
as out:
104 for decl
in all_declarations:
105 out.write(decl +
'\n')
106 print(f
"Extracted {len(all_declarations)} function declarations to {output_file}")
108 for decl
in all_declarations:
109 qualifiers, func_name = decl.rsplit(
' ', 1)
113 if func_name.startswith(
"default_"):
120 f
"grep -rnw --include='*.c' --include='*.h' --include='*.mm' --include='*.cpp' --include='*.cc' --include='*.hpp' "
121 f
". -e '{func_name}'"
124 grep_output = os.popen(grep_cmd).read().strip()
126 matches = set(grep_output.split(
'\n'))
133 if "static" in qualifiers:
135 print(f
"{qualifiers} {func_name}: STATIC NOT USED")
139 print(f
"{qualifiers} {func_name}: NOT DEFINED")
142 print(f
"{qualifiers} {func_name}: NOT USED")
146 [print(f
" {match}")
for match
in matches]