You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DEBUG:cursorhandler:literal has 7 tokens.[ NGTCP2_SECONDS ( ( ngtcp2_duration ) 1000000000ULL ) ]
DEBUG:cursorhandler:cursor.type:INVALID
DEBUG:cursorhandler:token:NGTCP2_SECONDS tk.kd: IDENTIFIER tk.cursor.kd:MACRO_DEFINITION cursor.kd:MACRO_DEFINITION
DEBUG:cursorhandler:token:( tk.kd:PUNCTUATION tk.cursor.kd:MACRO_DEFINITION cursor.kd:MACRO_DEFINITION
DEBUG:cursorhandler:token:( tk.kd:PUNCTUATION tk.cursor.kd:MACRO_DEFINITION cursor.kd:MACRO_DEFINITION
DEBUG:cursorhandler:token:ngtcp2_duration tk.kd: IDENTIFIER tk.cursor.kd:MACRO_DEFINITION cursor.kd:MACRO_DEFINITION
Typedef(name=ngtcp2_duration,typ=FundamentalType(...),location=('mindef3.h', 3),comment=None)
Traceback (most recent call last):
File "/tmp/ctg/bin/clang2py", line 8, in <module>
sys.exit(main())
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/clang2py.py", line 346, in main
translate_files(inputs.files, outputs.stream, cfg)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/codegenerator.py", line 1165, in translate_files
translator.parse_input_files(source_files)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/codegenerator.py", line 1065, in parse_input_files
self.parser.parse(srcfile)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/clangparser.py", line 130, in parse
self.start_element(node)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/clangparser.py", line 186, in start_element
stop_recurse = self.parse_cursor(node)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/clangparser.py", line 324, in parse_cursor
return self.cursorkind_handler.parse_cursor(cursor)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/cursorhandler.py", line 38, in parse_cursor
return mth(cursor)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/util.py", line 122, in fn
return func(*args, **kwargs)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/cursorhandler.py", line 1114, in MACRO_DEFINITION
tokens = self._literal_handling(cursor)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/util.py", line 122, in fn
return func(*args, **kwargs)
File "/private/tmp/ctg/lib/python3.10/site-packages/ctypeslib/codegen/cursorhandler.py", line 551, in _literal_handling
value = self.get_registered(value).body
AttributeError: 'Typedef' object has no attribute 'body'
This is because it finds the cast, and tries to replace the cast w/ a macro instead.
This requires special construction, because if you don't specify the mindef3.h it doesn't crash, because the macro parsing code processes the macros before parsing the C code, so doesn't find the typedef, and instead treats the cast an an undefined and therefor invalid macro and skips it:
This is related to #84 as if you do fix this, it is possible that this won't work till that bug is fixed as well.
File
mindef2.h
:File
mindef3.h
:Command:
results in a crash:
This is because it finds the cast, and tries to replace the cast w/ a macro instead.
This requires special construction, because if you don't specify the
mindef3.h
it doesn't crash, because the macro parsing code processes the macros before parsing the C code, so doesn't find the typedef, and instead treats the cast an an undefined and therefor invalid macro and skips it:The text was updated successfully, but these errors were encountered: