From 6154c07461fabbf869bd4eee5220cb4e2abeaf4b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 16 Dec 2019 15:53:43 -0800 Subject: [PATCH] cppcheck: (error) Address of local auto-variable assigned Suppress autoVariables warnings in the lua interpreter. The usage here while unconventional in intentional and the same as upstream. [module/lua/ldebug.c:327]: (error) Address of local auto-variable assigned to a function parameter. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #9732 --- module/lua/ldebug.c | 1 + module/lua/ldo.c | 1 + 2 files changed, 2 insertions(+) diff --git a/module/lua/ldebug.c b/module/lua/ldebug.c index 15fe91b0b768..32bb908cd505 100644 --- a/module/lua/ldebug.c +++ b/module/lua/ldebug.c @@ -324,6 +324,7 @@ static void kname (Proto *p, int pc, int c, const char **name) { if (ISK(c)) { /* is 'c' a constant? */ TValue *kvalue = &p->k[INDEXK(c)]; if (ttisstring(kvalue)) { /* literal constant? */ + // cppcheck-suppress autoVariables *name = svalue(kvalue); /* it is its own name */ return; } diff --git a/module/lua/ldo.c b/module/lua/ldo.c index 59d0b6a2c298..d550cb5bfdba 100644 --- a/module/lua/ldo.c +++ b/module/lua/ldo.c @@ -168,6 +168,7 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { struct lua_longjmp lj; lj.status = LUA_OK; lj.previous = L->errorJmp; /* chain new error handler */ + // cppcheck-suppress autoVariables L->errorJmp = &lj; LUAI_TRY(L, &lj, (*f)(L, ud);