Skip to content

Record externs in the functions map so that --callee can find them. #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions cally.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ def full_call_graph(functions, **kwargs):

print_buf(std_buf, '"{}" -> "{}";'.format(func, caller))

if caller not in functions:
if caller not in functions or \
len(functions[caller]["files"]) == 0:
print_buf(std_buf, '"{}" [style=dashed]'.
format(caller))

Expand Down Expand Up @@ -648,9 +649,10 @@ def main():
match = re.match(function, line)
if match is not None:
function_name = match.group("function")
if function_name in functions:
if function_name in functions and \
functions[function_name]["files"]:
if not config.no_warnings:
print_err("WARNING: Function {} defined in multiple"
print_err("WARNING: Function {} defined in multiple "
"files \"{}\"!".
format(function_name,
', '.join(map(
Expand All @@ -673,6 +675,13 @@ def main():
match = re.match(call, line)
if match is not None:
target = match.group("target")
if not config.no_externs and target not in functions:
functions[target] = dict()
functions[target]["files"] = list()
functions[target]["calls"] = dict()
functions[target]["refs"] = dict()
functions[target]["callee_calls"] = dict()
functions[target]["callee_refs"] = dict()
if target not in functions[function_name]["calls"]:
functions[function_name]["calls"][target] = True
else:
Expand Down