From a3f456ad999c7ec317fdf71d61cbcd80db74d0fe Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 3 Sep 2017 17:57:43 +1000 Subject: Use FALLTHROUGH annotation to fix -Wimplicit-fallthrough warning Using a form that passes -Wimplicit-fallthrough=4. See https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Warning-Options.html#index-Wimplicit-fallthrough --- c-api/compat-5.3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'c-api') diff --git a/c-api/compat-5.3.c b/c-api/compat-5.3.c index 883efb8..fab89c0 100644 --- a/c-api/compat-5.3.c +++ b/c-api/compat-5.3.c @@ -110,7 +110,7 @@ COMPAT53_API void lua_len (lua_State *L, int i) { case LUA_TUSERDATA: if (luaL_callmeta(L, i, "__len")) break; - /* maybe fall through */ + /* FALLTHROUGH */ default: luaL_error(L, "attempt to get length of a %s value", lua_typename(L, lua_type(L, i))); -- cgit v1.2.3-55-g6feb From 690239bc52cf1f9e22af0b602dcc1fca4dda557a Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 8 Sep 2017 18:07:21 +1000 Subject: Add lua_resume --- README.md | 1 + c-api/compat-5.3.h | 3 +++ 2 files changed, 4 insertions(+) (limited to 'c-api') diff --git a/README.md b/README.md index 08614a1..d80405c 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ For Lua 5.1 additionally: * `lua_isinteger` * `lua_numbertointeger` * `lua_callk` and `lua_pcallk` (limited compatibility, see [here][14]) +* `lua_resume` * `lua_rawget` and `lua_rawgeti` (return values) * `lua_rawgetp` and `lua_rawsetp` * `luaL_requiref` (now checks `package.loaded` first) diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index bee77a1..3d20d21 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h @@ -186,6 +186,9 @@ COMPAT53_API int luaL_execresult (lua_State *L, int stat); #define lua_pcallk(L, na, nr, err, ctx, cont) \ ((void)(ctx), (void)(cont), lua_pcall((L), (na), (nr), (err))) +#define lua_resume(L, from, nargs) \ + ((void)(from), lua_resume((L), (nargs))) + #define luaL_buffinit COMPAT53_CONCAT(COMPAT53_PREFIX, _buffinit_53) COMPAT53_API void luaL_buffinit (lua_State *L, luaL_Buffer_53 *B); -- cgit v1.2.3-55-g6feb From 7320d58358de2d981135e7d8ef03eaed665bb2bc Mon Sep 17 00:00:00 2001 From: ThePhD Date: Wed, 13 Sep 2017 00:44:25 -0400 Subject: define LUA_ERRGCMM code for return values --- README.md | 1 + c-api/compat-5.3.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) (limited to 'c-api') diff --git a/README.md b/README.md index d80405c..eaaf6ee 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ For Lua 5.1 additionally: For Lua 5.1 additionally: * `LUA_OK` +* `LUA_ERRGCMM` * `LUA_OP*` macros for `lua_arith` and `lua_compare` * `lua_Unsigned` * `lua_absindex` diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index 3d20d21..6c76930 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h @@ -88,6 +88,19 @@ extern "C" { # define LUA_OPLE 2 #endif +/* LuaJIT/Lua 5.1 does not have the updated + * error codes for thread status/function returns (but some patched versions do) + * define it only if it's not found + */ +#if !defined(LUA_ERRGCMM) +/* Use + 2 because in some versions of Lua (Lua 5.1) + * LUA_ERRFILE is defined as (LUA_ERRERR+1) + * so we need to avoid it (LuaJIT might have something at this + * integer value too) + */ +# define LUA_ERRGCMM (LUA_ERRERR + 2) +#endif /* LUA_ERRGCMM define */ + typedef size_t lua_Unsigned; typedef struct luaL_Buffer_53 { -- cgit v1.2.3-55-g6feb