Skip to content

Commit bc51ff1

Browse files
committed
Port to Lua 5.4.2
1 parent 29a051c commit bc51ff1

File tree

11 files changed

+1841
-14
lines changed

11 files changed

+1841
-14
lines changed

.github/workflows/run-tests.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
name: run-tests
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches: ["master"]
5+
pull_request:
36
jobs:
47
test:
58
strategy:
69
fail-fast: false
710
matrix:
8-
luaVersion: ["5.1.3", "5.1.4", "5.1.5", "5.2.2", "5.2.3", "5.2.4", "5.3.0", "5.3.1", "5.3.2", "5.3.3", "5.3.4", "5.3.5", "5.3.6", "5.4.0", "5.4.1"]
11+
luaVersion:
12+
- "5.1.3"
13+
- "5.1.4"
14+
- "5.1.5"
15+
- "5.2.2"
16+
- "5.2.3"
17+
- "5.2.4"
18+
- "5.3.0"
19+
- "5.3.1"
20+
- "5.3.2"
21+
- "5.3.3"
22+
- "5.3.4"
23+
- "5.3.5"
24+
- "5.3.6"
25+
- "5.4.0"
26+
- "5.4.1"
27+
- "5.4.2"
928
runs-on: ubuntu-latest
1029
steps:
1130
- uses: actions/checkout@v2
12-
- uses: leafo/gh-actions-lua@v7
31+
- uses: leafo/gh-actions-lua@v8
1332
with:
1433
luaVersion: ${{ matrix.luaVersion }}
15-
- uses: leafo/gh-actions-luarocks@v3
34+
- uses: leafo/gh-actions-luarocks@v4
1635
- run: luarocks make CFLAGS="-Wall -Wextra -O2 -fPIC"
1736
- run: lua tests/test.lua
1837

compat.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static GetArgFunction const getArgFuncs[] = {
1616
#elif LUA_VERSION_NUM == 503
1717
getArg_50300, getArg_50300, getArg_50300, getArg_50300, getArg_50300, getArg_50300, getArg_50300
1818
#elif LUA_VERSION_NUM == 504
19-
getArg_50400, getArg_50400
19+
getArg_50400, getArg_50400, getArg_50400
2020
#else
2121
#error unsupported Lua version
2222
#endif
@@ -37,7 +37,7 @@ static BooleanSizeFunction const booleanSizeFuncs[] = {
3737
#elif LUA_VERSION_NUM == 503
3838
sizeBoolean_50300, sizeBoolean_50300, sizeBoolean_50300, sizeBoolean_50300, sizeBoolean_50300, sizeBoolean_50300, sizeBoolean_50300
3939
#elif LUA_VERSION_NUM == 504
40-
sizeBoolean_50400, sizeBoolean_50400
40+
sizeBoolean_50400, sizeBoolean_50400, sizeBoolean_50400
4141
#else
4242
#error unsupported Lua version
4343
#endif
@@ -58,7 +58,7 @@ static NumberSizeFunction const numberSizeFuncs[] = {
5858
#elif LUA_VERSION_NUM == 503
5959
sizeNumber_50300, sizeNumber_50300, sizeNumber_50300, sizeNumber_50300, sizeNumber_50300, sizeNumber_50300, sizeNumber_50300
6060
#elif LUA_VERSION_NUM == 504
61-
sizeNumber_50400, sizeNumber_50400
61+
sizeNumber_50400, sizeNumber_50400, sizeNumber_50400
6262
#else
6363
#error unsupported Lua version
6464
#endif
@@ -80,7 +80,7 @@ static StringSizeFunction const stringSizeFuncs[] = {
8080
#elif LUA_VERSION_NUM == 503
8181
sizeString_50300, sizeString_50301, sizeString_50301, sizeString_50301, sizeString_50301, sizeString_50301, sizeString_50301
8282
#elif LUA_VERSION_NUM == 504
83-
sizeString_50400, sizeString_50400
83+
sizeString_50400, sizeString_50400, sizeString_50400
8484
#else
8585
#error unsupported Lua version
8686
#endif
@@ -101,7 +101,7 @@ static FunctionSizeFunction const functionSizeFuncs[] = {
101101
#elif LUA_VERSION_NUM == 503
102102
sizeFunction_50300, sizeFunction_50300, sizeFunction_50300, sizeFunction_50300, sizeFunction_50300, sizeFunction_50300, sizeFunction_50300
103103
#elif LUA_VERSION_NUM == 504
104-
sizeFunction_50400, sizeFunction_50400
104+
sizeFunction_50400, sizeFunction_50400, sizeFunction_50400
105105
#else
106106
#error unsupported Lua version
107107
#endif
@@ -123,7 +123,7 @@ static TableNodeFunction const tableNodeFuncs[] = {
123123
#elif LUA_VERSION_NUM == 503
124124
tableNode_50300, tableNode_50300, tableNode_50300, tableNode_50300, tableNode_50300, tableNode_50300, tableNode_50300
125125
#elif LUA_VERSION_NUM == 504
126-
tableNode_50400, tableNode_50400
126+
tableNode_50400, tableNode_50400, tableNode_50400
127127
#else
128128
#error unsupported Lua version
129129
#endif
@@ -145,7 +145,7 @@ static TableSizeFunction const tableSizeFuncs[] = {
145145
#elif LUA_VERSION_NUM == 503
146146
sizeTable_50300, sizeTable_50300, sizeTable_50300, sizeTable_50300, sizeTable_50300, sizeTable_50300, sizeTable_50300
147147
#elif LUA_VERSION_NUM == 504
148-
sizeTable_50400, sizeTable_50400
148+
sizeTable_50400, sizeTable_50400, sizeTable_50400
149149
#else
150150
#error unsupported Lua version
151151
#endif
@@ -166,7 +166,7 @@ static UserdataSizeFunction const userdataSizeFuncs[] = {
166166
#elif LUA_VERSION_NUM == 503
167167
sizeUserdata_50300, sizeUserdata_50300, sizeUserdata_50300, sizeUserdata_50300, sizeUserdata_50300, sizeUserdata_50300, sizeUserdata_50300
168168
#elif LUA_VERSION_NUM == 504
169-
sizeUserdata_50400, sizeUserdata_50400
169+
sizeUserdata_50400, sizeUserdata_50400, sizeUserdata_50400
170170
#else
171171
#error unsupported Lua version
172172
#endif
@@ -180,6 +180,7 @@ extern size_t sizeThread_50300(void const*);
180180
extern size_t sizeThread_50302(void const*);
181181
extern size_t sizeThread_50400(void const*);
182182
extern size_t sizeThread_50401(void const*);
183+
extern size_t sizeThread_50402(void const*);
183184

184185
static ThreadSizeFunction const threadSizeFuncs[] = {
185186
#if LUA_VERSION_NUM == 501
@@ -189,7 +190,7 @@ static ThreadSizeFunction const threadSizeFuncs[] = {
189190
#elif LUA_VERSION_NUM == 503
190191
sizeThread_50300, sizeThread_50300, sizeThread_50302, sizeThread_50302, sizeThread_50302, sizeThread_50302, sizeThread_50302
191192
#elif LUA_VERSION_NUM == 504
192-
sizeThread_50400, sizeThread_50401
193+
sizeThread_50400, sizeThread_50401, sizeThread_50402
193194
#else
194195
#error unsupported Lua version
195196
#endif

compat_50402.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <lua.h>
2+
3+
4+
#if LUA_VERSION_NUM == 504
5+
#define LUA_CORE
6+
#include "lua5.4/2/lstate.h"
7+
8+
9+
size_t sizeThread_50402(void const* o)
10+
{
11+
lua_State const* th = thvalue((TValue const*)o);
12+
CallInfo *ci = th->base_ci.next;
13+
size_t cisize = 0;
14+
for (; ci != NULL; ci = ci->next)
15+
cisize += sizeof(CallInfo);
16+
return sizeof(lua_State) + sizeof(TValue) * (stacksize(th) + EXTRA_STACK) + cisize;
17+
}
18+
19+
#endif
20+

getsize-scm-0.rockspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ build = {
3737
"compat_50301.c",
3838
"compat_50302.c",
3939
"compat_50401.c",
40+
"compat_50402.c",
4041
}
4142
}
4243
}

0 commit comments

Comments
 (0)