martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.23k stars 256 forks source link

Vis fails to build against Lua 5.4.0 #843

Closed sham1 closed 4 years ago

sham1 commented 4 years ago

Rawhide in Fedora had its Lua version bumped to 5.4.0. And on the rebuild of the package, I stumbled across the following build error:

vis-lua.c: In function 'mappings':
vis-lua.c:970:2: error: declaration of non-variable 'luaL_checkint' in 'for' loop initial declaration
  970 |  for (Mode *mode = mode_get(vis, luaL_checkint(L, 2)); mode; mode = mode->parent) {
      |  ^~~

On further inspection, it seems as though luaL_checkint was deprecated and has now been removed in 5.4. And that the new way should be to use luaL_checkinteger instead.

Alongside that build error, there were the following warnings, which all seem to be somewhat related to the above:

vis-lua.c: In function 'getpos':
vis-lua.c:500:9: warning: implicit declaration of function 'lua_tounsigned' [-Wimplicit-function-declaration]
  500 |  return lua_tounsigned(L, narg);
      |         ^~~~~~~~~~~~~~
vis-lua.c: In function 'pushpos':
vis-lua.c:514:3: warning: implicit declaration of function 'lua_pushunsigned'; did you mean 'lua_pushinteger'? [-Wimplicit-function-declaration]
  514 |   lua_pushunsigned(L, pos);
      |   ^~~~~~~~~~~~~~~~
      |   lua_pushinteger
vis-lua.c: In function 'keymap':
vis-lua.c:820:13: warning: implicit declaration of function 'luaL_checkint'; did you mean 'luaL_checkany'? [-Wimplicit-function-declaration]
  820 |  int mode = luaL_checkint(L, 2);
      |             ^~~~~~~~~~~~~
      |             luaL_checkany

vis-lua.c: In function 'motion':
vis-lua.c:988:22: warning: implicit declaration of function 'luaL_checkunsigned'; did you mean 'luaL_checkinteger'? [-Wimplicit-function-declaration]
  988 |  enum VisMotion id = luaL_checkunsigned(L, 2);
      |                      ^~~~~~~~~~~~~~~~~~
      |                      luaL_checkinteger
vis-lua.c: In function 'file_lines_iterator':
vis-lua.c:2158:16: warning: implicit declaration of function 'luaL_optunsigned'; did you mean 'luaL_optinteger'? [-Wimplicit-function-declaration]
 2158 |  size_t line = luaL_optunsigned(L, 2, 1);
      |                ^~~~~~~~~~~~~~~~
      |                luaL_optinteger

On some further digging, it seems as though all of these should be replaceable by luaL_checkinteger or luaL_optinteger.

Full buildlog is here: https://kojipkgs.fedoraproject.org//work/tasks/6118/46376118/build.log

martanne commented 4 years ago

This should be fixed by #844?