Open jmgurney opened 6 days ago
so, looks like adding the following just before the name = '%s_%s'
line in get_unique_name
in codegen/handler.py
:
if 'unnamed at' in name:
name = re.sub('[^a-zA-Z0-9]', '_', name)
is a solution by replacing bad chars w/ underscores. This should be safe as both line and character position is included.
Tested with: 2.3.5.dev2+g0df7325
Gives the following input (from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet6/in6.h:153
)When run through clang2py, produces a python script that fails to import:
This is because the unnamed union is given an incompatible name by clang:
union_union (unnamed at minunion.h:6:9)
.If I'm pointed to a location where munging the name should be done, I'll generate a PR w/ a test and the name munging so things don't break.