From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5920A4696C3 for ; Tue, 21 Apr 2020 22:40:09 +0300 (MSK) Date: Tue, 21 Apr 2020 22:33:01 +0300 From: Igor Munkin Message-ID: <20200421193301.GD8314@tarantool.org> References: <20200421140258.42949-1-sergeyb@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200421140258.42949-1-sergeyb@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: sergeyb@tarantool.org Cc: o.piskunov@tarantool.org, tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org Sergey, Thanks for the patch! Please adjust the commit subject considering our contributors guide[1]. Since the commit is for tarantool/luajit repo I propose the following: | test: fix warnings spotted by luacheck Also, It would be nice to mention in commit message that luacheck is integrated in tarantool CI pipeline that respect .luacheckrc in tarantool repo (since jit global is suppressed there). Furthermore I applied your patch and as a result of manual luacheck run in test directory I faced the following warnings: | $ luacheck *.lua --globals=jit | Checking gh-3196-incorrect-string-length.test.lua OK | Checking gh-4427-ffi-sandwich.test.lua OK | Checking gh-4476-fix-string-find-recording.test.lua 1 warning | | gh-4476-fix-string-find-recording.test.lua:54:11: variable s is never accessed | | Checking gh-4773-tonumber-fail-on-NUL-char.test.lua OK | Checking lj-494-table-chain-infinite-loop.test.lua OK | Checking lj-505-fold-no-strref-for-ptrdiff.test.lua OK | Checking lj-524-fold-conv-respect-src-irt.test.lua OK | Checking lj-flush-on-trace.test.lua OK | Checking or-232-unsink-64-kptr.test.lua 1 warning | | or-232-unsink-64-kptr.test.lua:34:18: empty if branch | | Checking utils.lua OK | | Total: 2 warnings / 0 errors in 10 files Here is the diff with the fix: ================================================================================ diff --git a/test/gh-4476-fix-string-find-recording.test.lua b/test/gh-4476-fix-string-find-recording.test.lua index 209090a..ef2bb97 100755 --- a/test/gh-4476-fix-string-find-recording.test.lua +++ b/test/gh-4476-fix-string-find-recording.test.lua @@ -51,13 +51,13 @@ local err = [[module 'kit.1.10.3-136' not found: no file '/usr/local/lib64/lua/5.1/kit.so' no file '/usr/lib64/lua/5.1/kit.so']] -local at, s, e +local _, at, e local count_vm = 0 jit.off() repeat - s, e = err:find("\n\t", at, true) + _, e = err:find("\n\t", at, true) at = e count_vm = count_vm + 1 until not e @@ -68,7 +68,7 @@ jit.on() jit.opt.start(0, 'hotloop=1') repeat - s, e = err:find("\n\t", at, true) + _, e = err:find("\n\t", at, true) at = e count_jit = count_jit + 1 assert(count_jit <= count_vm, "Trace goes in cycles") diff --git a/test/or-232-unsink-64-kptr.test.lua b/test/or-232-unsink-64-kptr.test.lua index d9b3f05..0178a6e 100755 --- a/test/or-232-unsink-64-kptr.test.lua +++ b/test/or-232-unsink-64-kptr.test.lua @@ -31,6 +31,7 @@ local array = ffi.new("struct { int x; } [1]") local function fn(i) local struct = array[0] -- Load pointer that the JIT will constify. + -- luacheck: ignore if i == 1000 then end -- Force trace exit when i==1000. struct.x = 0 -- Ensure that 'struct' is live after exit. end ================================================================================ I see no warnings after applying this diff. On 21.04.20, sergeyb@tarantool.org wrote: > From: Sergey Bronnikov > > --- > .../lj-494-table-chain-infinite-loop.test.lua | 26 +++++++++---------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > -- > 2.18.2 > [1]: https://www.tarantool.io/en/doc/2.2/dev_guide/developer_guidelines/ -- Best regards, IM