From 570bd8f0fe1babc404db45cfdb7a318c31010364 Mon Sep 17 00:00:00 2001 From: fesily Date: Mon, 22 May 2023 16:06:51 +0800 Subject: fix warnning --- script/plugins/ffi/c-parser/cpp.lua | 3 ++- script/plugins/ffi/c-parser/ctypes.lua | 1 + script/plugins/ffi/searchCode.lua | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'script/plugins/ffi') diff --git a/script/plugins/ffi/c-parser/cpp.lua b/script/plugins/ffi/c-parser/cpp.lua index f885e724..989bca66 100644 --- a/script/plugins/ffi/c-parser/cpp.lua +++ b/script/plugins/ffi/c-parser/cpp.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: undefined-global, assign-type-mismatch local cpp = {} @@ -26,7 +27,7 @@ else ]])() end -local function debug() end +local function debug(...) end --[[ local inspect = require("inspect") local function debug(...) diff --git a/script/plugins/ffi/c-parser/ctypes.lua b/script/plugins/ffi/c-parser/ctypes.lua index 284fbe84..81d0ccf6 100644 --- a/script/plugins/ffi/c-parser/ctypes.lua +++ b/script/plugins/ffi/c-parser/ctypes.lua @@ -107,6 +107,7 @@ local convert_value = typed("TypeList, table -> CType?, string?", function (lst, src.ids = util.expandSingle(src.ids) -- FIXME multiple ids, e.g.: int *x, y, *z; local ok +---@diagnostic disable-next-line: cast-local-type ok, name, ret_pointer, idxs = get_name(src.id or src.ids) if not ok then return nil, name diff --git a/script/plugins/ffi/searchCode.lua b/script/plugins/ffi/searchCode.lua index 9e74e7c0..86dbc680 100644 --- a/script/plugins/ffi/searchCode.lua +++ b/script/plugins/ffi/searchCode.lua @@ -3,6 +3,9 @@ local vm = require 'vm' local function getLiterals(arg) local literals = vm.getLiterals(arg) local res = {} + if not literals then + return res + end for k, v in pairs(literals) do if type(k) == 'string' then res[#res+1] = k -- cgit v1.2.3