vegetablemao / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Vim doesn't compile with Lua 5.3 on windows #329

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to compile vim with Lua enabled (using MSVC or Mingw)

What is the expected output? What do you see instead?

Expected is a gvim.exe with +lua/dyn actual output is:

gobji386/if_lua.o:if_lua.c:(.text+0x35a2): undefined reference to 
`luaL_optlong' 

What version of the product are you using? On what operating system?

This was built with the hg tip version 
(c80ef2bf390ba312cbba7d7aa07a7ddd4ac92f43) of vim and lua 5.3.

Please provide any additional information below.

If one looks at lauxlib.h it's obvious that the definition of the missing 
luaL_optlong symbol is guarded by a ifdef LUA_COMPAT_APIINTCASTS 

Following patch fixes the build

diff -r c80ef2bf390b src/if_lua.c
--- a/src/if_lua.c  Wed Feb 04 23:08:02 2015 +0100
+++ b/src/if_lua.c  Wed Feb 11 16:52:12 2015 +0100
@@ -13,6 +13,7 @@

 #include <lua.h>
 #include <lualib.h>
+#define LUA_COMPAT_APIINTCASTS 1
 #include <lauxlib.h>

 /* Only do the following when the feature is enabled.  Needed for "make

Original issue reported on code.google.com by mpc.jans...@gmail.com on 11 Feb 2015 at 3:53

GoogleCodeExporter commented 9 years ago
According to the Lua's manual, luaL_optlong was deprecated.
http://www.lua.org/manual/5.3/manual.html#8.3

I think type cast is better than defining LUA_COMPAT_APIINTCASTS.

--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -774,7 +774,7 @@ luaV_list_insert (lua_State *L)
 {
     luaV_List *lis = luaV_checkudata(L, 1, LUAVIM_LIST);
     list_T *l = (list_T *) luaV_checkcache(L, (void *) *lis);
-    long pos = luaL_optlong(L, 3, 0);
+    long pos = (long) luaL_optinteger(L, 3, 0);
     listitem_T *li = NULL;
     typval_T v;
     if (l->lv_lock)

Original comment by ktakata6...@gmail.com on 11 Feb 2015 at 10:28

GoogleCodeExporter commented 9 years ago
That sounds like the proper way of doing it. I am just wondering if this will 
break the build for people using older Lua versions?

Original comment by mpc.jans...@gmail.com on 13 Feb 2015 at 9:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I also tested the patch with Lua 5.1.

Original comment by ktakata6...@gmail.com on 13 Feb 2015 at 1:54

GoogleCodeExporter commented 9 years ago
Fixed by 7.4.638

Original comment by chrisbr...@googlemail.com on 17 Feb 2015 at 3:34