lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> All feedback welcome. Thanks.

No more warnings or errors on the C compilers I am using, when using
regular compiling options.
Thank you !

I now tried to compile in C++ mode, and there are minor issues.

1) IAR Workbench points out the following warning in C++ mode:
Warning[Pa118]: mixing boolean and non-boolean types in a comparison
results in the boolean being promoted   lvm.c 665

2) IAR Workbench as well as Green Hills signals that variable
lua_ident is not used:
"..\src\lua\lapi.c", line 32: warning #177-D: variable "lua_ident" was
          declared but never referenced
  const char lua_ident[] =
             ^
This is probably harmless, but some linkers are smart enough to remove
unused symbols from the output executable (i.e. on MacOS, using
--delete option).
If you want to ensure that your copyright is not removed, you might
have to reference it somewhere in the code.
My suggestion is to modify function lua_load (which is not called
thousand of times per second):

LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
                      const char *chunkname, const char *mode) {
  ZIO z;
  int status;
  lua_lock(L);
  if (!chunkname) chunkname = "?";
+  if (!chunkname) chunkname = lua_ident;
  luaZ_init(L, &z, reader, data);
  status = luaD_protectedparser(L, &z, chunkname, mode);

3) More severe, but in a quite special configuration.
It seems impossible to compile the amalgamation in C++.
I try to use the one.c file from Luiz. It works fine in C mode. When
trying in C++ mode, you have several errors like:
  lobject.h:581:24: error: uninitialized const 'luaO_nilobject_'
both on GCC than on Visual Studio.

[1] http://lua-users.org/lists/lua-l/2011-02/msg01493.html