Add Hooks to Extend CFFI Parsing (to make it easier to handle large libraries)
EDIT: name changed from "Complex Pointer Calculation in Array Length (offsetOf)"
Seems to me, CFFI should be able to handle this case given ...
:
int a[((((long) &((HeapTupleHeaderData *)0)->t_infomask2) - sizeof(uint32)) % 8)]
This is more a question I think of adding leniency to the parser (perhaps via a new keyword argument to cdef
?) since CFFI can already handle this case using __dotdotdot__
. From what I recall, the code in question is in CFFI proper rather than pycparser (shouldn't be hard to fix); I can propose a patch
This would help in exposing larger libraries with CFFI I think.
There's related issue (enhancement) I'd like to discuss as well (can file a separate feature request if desired). __dotdotdot__
doesn't work in the following case and I'm curious 1) why and 2) if we can fix it in at least some cases (a similar construct does work for structs, so it seems like we might be able to fix this in all cases):
typedef int jmp_buf[...]
This would help with something jmp_buf
for example. Happy to take a crack at it if you think it's feasible and can point me in the right direction :)