[Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck

Igor Munkin imun at tarantool.org
Tue Apr 21 22:33:01 MSK 2020


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 at tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb at tarantool.org>
> 
> ---
>  .../lj-494-table-chain-infinite-loop.test.lua | 26 +++++++++----------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 

<snipped>

> -- 
> 2.18.2
> 

[1]: https://www.tarantool.io/en/doc/2.2/dev_guide/developer_guidelines/

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list