lua-users home
lua-l archive

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


Hi,

When compiling Lua with the Lcc-Win32 compiler, I get the following 
warnings:

-----
Warning c:\lua-4.0\src\lib\lstrlib.c: 60  indexing array 33[512] out 
of bounds (512)
Warning c:\lua-4.0\src\lib\lstrlib.c: 73  indexing array 47[512] out 
of bounds (512)
Warning c:\lua-4.0\src\lib\lstrlib.c: 109  indexing array 84[512] out 
of bounds (512)
Warning c:\lua-4.0\src\lib\lstrlib.c: 501  indexing array 469[512] 
out of bounds (512)
Warning c:\lua-4.0\src\lib\lstrlib.c: 544  indexing array 536[512] 
out of bounds (512)
Warning c:\lua-4.0\src\lib\lstrlib.c: 546  indexing array 542[512] 
out of bounds (512)
Warning c:\lua-4.0\src\lib\liolib.c: 317  indexing array 129[512] out 
of bounds (512)

The above refer to the 'luaL_putchar' macro:

#define luaL_putchar(B,c) \
  ((void)((B)->p < &(B)->buffer[LUAL_BUFFERSIZE] || luaL_prepbuffer
(B)), \
   (*(B)->p++ = (char)(c)))

To supress the warnings I changed it to:

#define luaL_putchar(B,c) \
  ((void)((B)->p <= &(B)->buffer[LUAL_BUFFERSIZE-1] || luaL_prepbuffer
(B)), \
   (*(B)->p++ = (char)(c)))


-----
Warning c:\lua-4.0\src\lib\lstrlib.c: 384  possible usage of init 
before definition

The above refer to the 'lmem_find' function:

To supress this warning I changed the line:

const char *init;  /* to search for a `*s2' inside `s1' */

To:

const char *init = NULL;  /* to search for a `*s2' inside `s1' */


-----
Warning c:\lua-4.0\src\lib\liolib.c: 512  Different const qualifiers
Warning c:\lua-4.0\src\lib\liolib.c: 517  Different const qualifiers
Warning c:\lua-4.0\src\lib\liolib.c: 518  Different const qualifiers
Warning c:\lua-4.0\src\lib\liolib.c: 530  Different const qualifiers
Warning c:\lua-4.0\src\lib\liolib.c: 547  Different const qualifiers

I could not figure out why the above warnings were being generated, 
but I figured I'd pass them onto you anyway. :)

David