From 52e27d3cfc72834afcd69cf8a1ac1e03373596c0 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Tue, 28 Apr 2026 22:37:36 -0400 Subject: [PATCH] fix unused luaLibrary_ warning --- src/addonloader/luastate.cpp | 9 ++++++++- src/addonloader/luastate.h | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/addonloader/luastate.cpp b/src/addonloader/luastate.cpp index f56279f..5366756 100644 --- a/src/addonloader/luastate.cpp +++ b/src/addonloader/luastate.cpp @@ -20,7 +20,14 @@ namespace fcitx { LuaState::LuaState(Library *library) - : luaLibrary_(library), state_(nullptr, _fcitx_lua_close) { + : +#ifdef USE_DLOPEN + luaLibrary_(library), +#endif + state_(nullptr, _fcitx_lua_close) { +#ifndef USE_DLOPEN + FCITX_UNUSED(library); +#endif // Resolve all required lua function first. #define FOREACH_LUA_FUNCTION(NAME) \ FILL_LUA_API(NAME); \ diff --git a/src/addonloader/luastate.h b/src/addonloader/luastate.h index 68ab988..02219a1 100644 --- a/src/addonloader/luastate.h +++ b/src/addonloader/luastate.h @@ -7,6 +7,7 @@ #ifndef _FCITX5_LUA_ADDONLOADER_LUASTATE_H_ #define _FCITX5_LUA_ADDONLOADER_LUASTATE_H_ +#include "config.h" #include "luastate_details.h" #include #include @@ -29,7 +30,9 @@ struct LuaState { } private: +#ifdef USE_DLOPEN Library *luaLibrary_; +#endif #define FOREACH_LUA_FUNCTION DECLARE_LUA_FUNCTION_PTR #include "luafunc.h"