Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug?] function pointer typedefs don't seem to be usable #32

Open
thacuber2a03 opened this issue Aug 2, 2023 · 1 comment
Open

[bug?] function pointer typedefs don't seem to be usable #32

thacuber2a03 opened this issue Aug 2, 2023 · 1 comment

Comments

@thacuber2a03
Copy link

I'm trying to see if I can compile rxi's fe with chibicc-uxn, and the former has a bunch of function pointer typedefs it uses all around the code:

typedef fe_Object* (*fe_CFunc)(fe_Context *ctx, fe_Object *args);
typedef void (*fe_ErrorFn)(fe_Context *ctx,  char *err, fe_Object *cl);
typedef void (*fe_WriteFn)(fe_Context *ctx, void *udata, char chr);
typedef char (*fe_ReadFn)(fe_Context *ctx, void *udata);

the typedefs seem to be parsed, but when it comes to actually using them, the compiler fails:

read_file(): allocated 22919 bytes
tokenize(): allocated 453561 bytes (sizeof(Token) = 64)
tmp.c:8: typedef struct { fe_CFunc error; fe_CFunc mark, gc; } fe_Handlers;
                          ^ typename expected

I could definitely change them to void*s, but that would make some parts of the code hard to read (if you're not used to fe's source, which I am)
this is my first issue, so I'm sorry if I'm missing on something, and I'll understand if they're not intended to be supported

@thacuber2a03
Copy link
Author

thacuber2a03 commented Aug 2, 2023

for now I'll change them to void*s and see if it does work
edit: I completely forgot void*s can't be called

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant