Skip to content

Commit

Permalink
Try to make func_calls example pass on all platforms with no arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
eliben committed Oct 29, 2021
1 parent 7beef72 commit 43997f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions examples/c_files/basic.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
int foo() {}

int main() {
foo();
return 0;
}
9 changes: 7 additions & 2 deletions examples/func_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,6 +31,10 @@ def visit_FuncCall(self, node):
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)
Expand All @@ -41,7 +46,7 @@ def show_func_calls(filename, funcname):
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)

0 comments on commit 43997f1

Please sign in to comment.