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

Rewriting error for array of function pointer with typedef type #736

Open
kyleheadley opened this issue Oct 21, 2021 · 1 comment
Open
Labels
benchmark failure A bug causing a failure in our nightly benchmark tests incomplete description macro rewriter

Comments

@kyleheadley
Copy link
Member

Another miscellaneous error from Lua:

loadlib.c:704:26: error (func_array): 'searchers' declared as array of functions of type 'int (lua_State *)' (aka 'int (struct lua_State *)')
  static int ( searchers _Checked[])(lua_State *) =
                         ^

The code in question doesn't appear (in this form at least) in the source mentioned, so something is up with the rewriter. Or heavy macro use.

@kyleheadley kyleheadley added macro rewriter benchmark failure A bug causing a failure in our nightly benchmark tests incomplete description labels Oct 21, 2021
@john-h-kastner
Copy link
Collaborator

I haven't looked for this in the Lua source code, but this seems to be the same error:

typedef int (*fn) (void);
fn fn_arr[];

converts to

typedef _Ptr<int (void)> fn;
int (fn_arr _Checked[])(void) = {((void *)0)};

which fails to compile with error: 'fn_arr' declared as array of functions of type 'int (void)'.

The correct rewriting is either _Ptr<int (void)> fn_arr _Checked[] = {((void *)0)}; or, using the typedef, fn fn_arr _Checked[] = {((void *)0)};.

@john-h-kastner john-h-kastner changed the title Rewrite error doesn't seem to appear in source Rewriting error for array of function pointer with typedef type Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark failure A bug causing a failure in our nightly benchmark tests incomplete description macro rewriter
Projects
None yet
Development

No branches or pull requests

2 participants