On Sat Sep 9 12:55:32 2023 +0000, Fabian Maurer wrote:
When recursing into array pointer, we get a stackoverflow due to infinite recursion as well. Therefore, unless I missed something, we need first the infinite-recursion fix, then the array recursion change. The file that causes the stackoverflow with array recursion is actxprxy_shobjidl.idl. However, even with the current master branch it crashes when running widl manually like
./tools/widl/widl -o test.c -m32 --nostdinc -Ldlls/\* -Idlls/actxprxy \ -I../wine-git/dlls/actxprxy -Iinclude -I../wine-git/include -I../wine-git/include/msvcrt -D_UCRT \ -D__WINESRC__ ../wine-git/dlls/actxprxy/actxprxy_shobjidl.idl
It works when compiling wine though... Something is very weird here, but it means I can't really check which type(s) exactly cause the infinite array-recursion. I also updated to use dynamic allocation, but kept the static variable. IMHO, since it's single threaded and only short lived, it's easier to just leave the memory than constantly allocate and free the memory. Can be changed though, if you think that's preferable.
The static variable feels brittle to me; I guess there's no reason it doesn't work but if it were up to me I'd still prefer to avoid it. If it were me I'd just embed all the array parameters in a struct and pass that down.
I think in general what you're calling "pos" and "count", I'm used to calling "count" and "capacity".