chore(script/gen_constants_cpp): generates a warning if automatically generated C++ function is not used in the source code

This commit is contained in:
Leonardo de Moura
2017-02-21 12:05:41 -08:00
parent 7e6a10bd1b
commit 19cf5e916b
6 changed files with 13 additions and 458 deletions

View File

@@ -91,6 +91,10 @@ def main(argv=None):
f.write("do env ← get_env, (env^.get n >> return ()) <|> (guard $ env^.is_namespace n) <|> (attribute.get_instances n >> return ()) <|> fail (\"identifier '\" ++ to_string n ++ \"' is not a constant, namespace nor attribute\")\n");
for c in constants:
f.write("run_command script_check_id `%s\n" % c[1])
for c in constants:
cmd = ("cd .. && grep --silent --include=\"*.h\" --include=\"*.cpp\" --exclude=\".#*\" --exclude=\"constants.*\" -R \"get_%s_name\" *" % c[0])
if os.system(cmd) != 0:
print("Warning: generated function 'get_%s_name' is not used in the source code" % c[0])
print("done")
return 0