From 43997f164eaf871f1d8b996b94a0b6bf1ae17997 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Fri, 29 Oct 2021 09:56:23 -0700 Subject: Try to make func_calls example pass on all platforms with no arguments --- examples/c_files/basic.c | 3 +++ examples/func_calls.py | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/c_files/basic.c b/examples/c_files/basic.c index 4cce7f6..fafb54e 100644 --- a/examples/c_files/basic.c +++ b/examples/c_files/basic.c @@ -1,3 +1,6 @@ +int foo() {} + int main() { + foo(); return 0; } diff --git a/examples/func_calls.py b/examples/func_calls.py index ce9cc87..ce70232 100644 --- a/examples/func_calls.py +++ b/examples/func_calls.py @@ -8,6 +8,7 @@ # License: BSD #----------------------------------------------------------------- from __future__ import print_function +import platform import sys # This is not required if you've installed pycparser into @@ -30,6 +31,10 @@ class FuncCallVisitor(c_ast.NodeVisitor): self.visit(node.args) +def cpp_supported(): + return platform.system() == 'Linux' + + def show_func_calls(filename, funcname): ast = parse_file(filename, use_cpp=True) v = FuncCallVisitor(funcname) @@ -41,7 +46,7 @@ if __name__ == "__main__": filename = sys.argv[1] func = sys.argv[2] else: - filename = 'examples/c_files/hash.c' - func = 'malloc' + filename = 'examples/c_files/basic.c' + func = 'foo' show_func_calls(filename, func) -- cgit v1.2.1