Debian Codegraph @

pycparser223/examples/using_gcc_E_libc.py

raw symbols SCIP
1 #-------------------------------------------------------------------------------
2 # pycparser: using_gcc_E_libc.py
3 #
4 # Similar to the using_cpp_libc.py example, but uses 'gcc -E' instead
5 # of 'cpp'. The same can be achieved with Clang instead of gcc. If you have
6 # Clang installed, simply replace 'gcc' with 'clang' here.
7 #
8 # Eli Bendersky [https://eli.thegreenplace.net/]
9 # License: BSD
10 #-------------------------------------------------------------------------------
11 import sys
12
13 # This is not required if you've installed pycparser into
14 # your site-packages/ with setup.py
15 sys.path.extend(['.', '..'])
16
17 from pycparser import parse_file
18
19
20 if __name__ == "__main__":
21 if len(sys.argv) > 1:
22 filename = sys.argv[1]
23 else:
24 filename = 'examples/c_files/year.c'
25
26 ast = parse_file(filename, use_cpp=True,
27 cpp_path='gcc',
28 cpp_args=['-E', r'-Iutils/fake_libc_include'])
29 ast.show()