From 89dd05fdf35ce465fcc2b3588337f79f818a78aa Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 31 Oct 2020 18:19:23 +0000 Subject: Fix segfault in deprecation logging due to tail call, log by default (#10174) --- src/script/lua_api/l_internal.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/script/lua_api/l_internal.h') diff --git a/src/script/lua_api/l_internal.h b/src/script/lua_api/l_internal.h index a86eeaf79..a10c259ba 100644 --- a/src/script/lua_api/l_internal.h +++ b/src/script/lua_api/l_internal.h @@ -29,7 +29,16 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_internal.h" #define luamethod(class, name) {#name, class::l_##name} -#define luamethod_aliased(class, name, alias) {#name, class::l_##name}, {#alias, class::l_##name} + +#define luamethod_dep(class, good, bad) \ + {#bad, [](lua_State *L) -> int { \ + return l_deprecated_function(L, #bad, #good, &class::l_##good); \ + }} + +#define luamethod_aliased(class, name, alias) \ + luamethod(class, name), \ + luamethod_dep(class, name, alias) + #define API_FCT(name) registerFunction(L, #name, l_##name, top) // For future use -- cgit v1.2.3 From 9c9344ceb31892a8563994190f1ec31cb872f12c Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 1 Nov 2020 12:52:09 +0100 Subject: Fix incorrect deprecation hints "good" and "bad" were swapped in the process, resulting in wrong deprecation messages --- src/script/lua_api/l_internal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/script/lua_api/l_internal.h') diff --git a/src/script/lua_api/l_internal.h b/src/script/lua_api/l_internal.h index a10c259ba..672e535ca 100644 --- a/src/script/lua_api/l_internal.h +++ b/src/script/lua_api/l_internal.h @@ -32,12 +32,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #define luamethod_dep(class, good, bad) \ {#bad, [](lua_State *L) -> int { \ - return l_deprecated_function(L, #bad, #good, &class::l_##good); \ + return l_deprecated_function(L, #good, #bad, &class::l_##good); \ }} -#define luamethod_aliased(class, name, alias) \ - luamethod(class, name), \ - luamethod_dep(class, name, alias) +#define luamethod_aliased(class, good, bad) \ + luamethod(class, good), \ + luamethod_dep(class, good, bad) #define API_FCT(name) registerFunction(L, #name, l_##name, top) -- cgit v1.2.3