Skip to content

Conversation

@retif
Copy link
Collaborator

@retif retif commented Oct 12, 2025

This commit resolves a bug where attributes on complex declarators, such as pointers to functions, were not parsed correctly, resulting in a NotImplementedError.

The p_xxx_declarator_2 method in pycparserext/ext_c_parser.py has been updated to correctly handle these cases. The new implementation traverses the declarator chain to locate the innermost TypeDecl and attaches the attributes to it by converting it to a TypeDeclExt.

A new test case has been added to test/test_pycparserext.py to verify that attributes on pointer-to-function declarations are now parsed correctly. This test fails before the fix and passes after, confirming that the bug is resolved.

Fixes #66 and #85

@inducer inducer merged commit 51ce930 into inducer:main Oct 13, 2025
4 checks passed
@inducer
Copy link
Owner

inducer commented Oct 13, 2025

Thx!

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

Successfully merging this pull request may close these issues.

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

2 participants