From 23b01e07a92ed92a40b3ee8dbdcf03174dc82db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 3 Nov 2021 17:41:56 +0800 Subject: add mark `---@nodiscard` --- meta/template/ffi.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'meta/template/ffi.lua') diff --git a/meta/template/ffi.lua b/meta/template/ffi.lua index 97dd4bc2..833232d4 100644 --- a/meta/template/ffi.lua +++ b/meta/template/ffi.lua @@ -26,21 +26,24 @@ function ffi.cdef(def) end ---@param name string ---@param global? boolean ---@return ffi.namespace* clib +---@nodiscard function ffi.load(name, global) end ---@param ct ffi.ct* ---@param nelem? integer ---@param init? any ---@return ffi.cdata* cdata +---@nodiscard function ffi.new(ct, nelem, init, ...) end ---@param nelem? integer ---@param init? any ---@return ffi.cdata* cdata -function ctype(nelem, init, ...) end +function ffi.ctype(nelem, init, ...) end ---@param ct ffi.ct* ---@return ffi.ctype* ctype +---@nodiscard function ffi.typeof(ct) end ---@param ct ffi.ct* @@ -61,10 +64,12 @@ function ffi.gc(cdata, finalizer) end ---@param ct ffi.ct* ---@param nelem? integer ---@return integer|nil size +---@nodiscard function ffi.sizeof(ct, nelem) end ---@param ct ffi.ct* ---@return integer align +---@nodiscard function ffi.alignof(ct) end ---@param ct ffi.ct* @@ -72,15 +77,18 @@ function ffi.alignof(ct) end ---@return integer ofs ---@return integer? bpos ---@return integer? bsize +---@nodiscard function ffi.offsetof(ct, field) end ---@param ct ffi.ct* ---@param obj any ---@return boolean status +---@nodiscard function ffi.istype(ct, obj) end ---@param newerr? integer ---@return integer err +---@nodiscard function ffi.errno(newerr) end ---@param ptr any -- cgit v1.2.3