Skip to content

Conversation

@bjornbm
Copy link
Contributor

@bjornbm bjornbm commented Mar 10, 2025

This is needed to prevent complilation failure on macos (Apple clang). Exemple of the failure message is shown below.

I guess another option is to avoid the CallInfo redefinitiion on luacore.h line 2386 to make in C99 compliant?

◼
0 successes / 1 failure / 0 errors / 0 pending : 0.202854 seconds

Failure → spec/traceback_spec.lua @ 31
Rectangle
spec/traceback_spec.lua:11: command failed: pallenec spec/traceback/rect/rect.pln --use-traceback

stack traceback:
        spec/traceback_spec.lua:11: in upvalue 'assert_test'
        spec/traceback_spec.lua:32: in function <spec/traceback_spec.lua:31>

In file included from /tmp/lua_fLecVi:12:
/Users/bjorn/repos/lua/pallene/.localua/include/luacore.h:2386:25: error: redefinition of typedef 'CallInfo' is a C11 feature [-Werror,-Wtypedef-redefinition]
 2386 | typedef struct CallInfo CallInfo;
      |                         ^
/Users/bjorn/repos/lua/pallene/.localua/include/luacore.h:3:25: note: previous definition is here
    3 | typedef struct CallInfo CallInfo;
      |                         ^
1 error generated.
internal error: compiler failed
compilation line: cc -fPIC -O0 -std=c99 -Wall -Werror -Wundef -Wno-unused  -x c -o /tmp/lua_ASuPlq -c /tmp/lua_fLecVi

@bjornbm
Copy link
Contributor Author

bjornbm commented Mar 10, 2025

FYI the source of the problem: https://github.com/pallene-lang/lua-internals/blob/4197fc71a7967436d117e3eb17c2aa04a5a5fd57/src/gen-lua-core-h.awk#L22

I guess the awk script could be updated to not include repeated definitions. It would be a bit ad hoc and ugly perhaps, but arguably so is the inclusion at the top?

@bjornbm
Copy link
Contributor Author

bjornbm commented Mar 10, 2025

See the proposed fix at pallene-lang/lua-internals#6 instead which avoids the C99 deviation and avoids the need for this change proposed here.

@bjornbm bjornbm closed this Mar 10, 2025
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

Successfully merging this pull request may close these issues.

1 participant