From 69402f4d78cc118ed12a2eed00e7c62a289d446e Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 13 Dec 2024 08:09:17 -0800 Subject: [PATCH] Support building ltests.c in MODE=dbg Fixes #1226 --- third_party/lua/ltests.c | 46 ++++++++++++++++++++++++++-------------- third_party/lua/lua.h | 8 +++++++ 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/third_party/lua/ltests.c b/third_party/lua/ltests.c index 8a9a6634722..851284956fa 100644 --- a/third_party/lua/ltests.c +++ b/third_party/lua/ltests.c @@ -28,25 +28,39 @@ #define ltests_c #define LUA_CORE -#include "third_party/lua/lapi.h" -#include "third_party/lua/lauxlib.h" -#include "third_party/lua/lcode.h" -#include "third_party/lua/lctype.h" -#include "third_party/lua/ldebug.h" -#include "third_party/lua/ldo.h" -#include "third_party/lua/lfunc.h" -#include "third_party/lua/lmem.h" -#include "third_party/lua/lopcodes.h" -#include "third_party/lua/lopnames.inc" -#include "third_party/lua/lprefix.h" -#include "third_party/lua/lstate.h" -#include "third_party/lua/lstring.h" -#include "third_party/lua/ltable.h" -#include "third_party/lua/lua.h" -#include "third_party/lua/lualib.h" +#include "lprefix.h" + +#include +#include +#include +#include +#include +#include "libc/mem/gc.h" +#include "libc/log/log.h" + +#include "lua.h" + +#include "lapi.h" +#include "lauxlib.h" +#include "lcode.h" +#include "lctype.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lopcodes.h" +#include "lopnames.inc" +#include "lprefix.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lualib.h" +#include "ltm.h" + __static_yoink("lua_notice"); + /* ** The whole module only makes sense with LUA_DEBUG on */ diff --git a/third_party/lua/lua.h b/third_party/lua/lua.h index f17da40f386..470e0f423ae 100644 --- a/third_party/lua/lua.h +++ b/third_party/lua/lua.h @@ -133,6 +133,14 @@ typedef struct lua_Debug lua_Debug; typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); +/* +** [jart] support ltests.h without unsafe LUA_USER_H kludge +** use `make MODE=dbg` to get this functionality +*/ +#ifdef MODE_DBG +#include "ltests.h" +#endif + /* ** generic extra include file */