rpav / c2ffi

Clang-based FFI wrapper generator
GNU Lesser General Public License v2.1
234 stars 39 forks source link

unknown-builtin-type: Elaborated #116

Closed some-mthfka closed 12 months ago

some-mthfka commented 1 year ago

Hi!

c2ffi sdl.h --fail-on-error -o sdl-linux.json

The output is riddled with ""

{ "tag": "function", "name": "SDL_WasInit", "ns": 0, "location": "SDL.h:190:32", "variadic": false, "inline": false, "storage-class": "extern", "parameters": [{ "tag": "parameter", "name": "flags", "type": { "tag": "<unknown-builtin-type:Elaborated>" } }], "return-type": { "tag": "<unknown-builtin-type:Elaborated>" } },

and return type is just Uint32 https://github.com/libsdl-org/SDL/blob/0907f345cb36c77bfdcc9e9f9f2942ecb42824a2/src/SDL.c#L476C6-L476C6

sdl-linux.json

$ cat sdl.h
#include <SDL2/SDL.h>
llvm-config --version
16.0.6

OS: Arch Linux with c2ffi-git from AUR with source=('git+https://github.com/rpav/c2ffi#branch=llvm-16.0.0')

SDL version: 2.0.28, but c2ffi used to work well on SDL2, and I am pretty sure it's not SDL2 that's the problem -- I tried this on an old branch for which c2ffi used to work, and it's the same problem:

$ git clone https://github.com/libsdl-org/SDL.git
$ git checkout release-2.0.14
$ cd include
$ c2ffi SDL.h

What can this be?

rpav commented 12 months ago

Checking, it's probably an unobvious change with clang-16.

rpav commented 12 months ago

This appears to fix the issue (I no longer see errors about this; there are some errors about vector types, but this is probably a longstanding issue.

Let me know if this fails to fix it for you, or you run into other issues of course!

some-mthfka commented 12 months ago

@rpav thank you, that worked!