Skip to content
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

NotImplementedError: cannot attach asm or attributes to nodes of type '<class 'pycparser.c_ast.PtrDecl'>' #66

Open
MaggieCwj opened this issue May 9, 2022 · 0 comments

Comments

@MaggieCwj
Copy link

When i want to generate AST of a function, it displays the following error mesages:

Traceback (most recent call last): File "slice_uniq.py", line 227, in <module> split_if(path) File "slice_uniq.py", line 131, in split_if ast = parser.parse(cont, filename='<none>')#, debuglevel=1) File "/usr/local/lib/python3.6/dist-packages/pycparserext-2021.1-py3.6.egg/pycparserext/ext_c_parser.py", line 33, in parse File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 331, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 1118, in parseopt_notrack p.callable(pslice) File "/usr/local/lib/python3.6/dist-packages/pycparser/plyparser.py", line 126, in param_rule func(self, p) File "/usr/local/lib/python3.6/dist-packages/pycparserext-2021.1-py3.6.egg/pycparserext/ext_c_parser.py", line 427, in p_xxx_declarator_2 NotImplementedError: cannot attach asm or attributes to nodes of type '<class 'pycparser.c_ast.PtrDecl'>'

I guess it's because the return value of the function is a pointer. I want to define it in the command line like "-D'char*=char'"

However, another error occurred:

Traceback (most recent call last): File "slice_uniq.py", line 227, in <module> split_if(path) File "slice_uniq.py", line 131, in split_if ast = parser.parse(cont, filename='<none>')#, debuglevel=1) File "/usr/local/lib/python3.6/dist-packages/pycparserext-2021.1-py3.6.egg/pycparserext/ext_c_parser.py", line 33, in parse File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 331, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 1199, in parseopt_notrack tok = call_errorfunc(self.errorfunc, errtoken, self) File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 193, in call_errorfunc r = errorfunc(token) File "/usr/local/lib/python3.6/dist-packages/pycparser/c_parser.py", line 1934, in p_error column=self.clex.find_tok_column(p))) File "/usr/local/lib/python3.6/dist-packages/pycparser/plyparser.py", line 67, in _parse_error raise ParseError("%s: %s" % (coord, msg)) pycparser.plyparser.ParseError: /home/nkamg/ifcut/pycparser/utils/fake_libc_include/_fake_typedefs.h:176:17: before: *

How can I solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant