lua-users home
lua-l archive

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


OK, I managed to compile the latest beta for Lua 4.1 with Visual C++ 6 sp3,
thanks to Peter Loveday messages.

For reference and to help other souls trying to do the same, I will detail
here the steps I had to do to have a compilation without errors nor warnings.

As Peter mentioned, we must avoid to have #defined macros with same names as
structure members they use. This is a bug (in VC6), but for portability
purpose, I suppose Lua authors can make some small concessions to keep all
compilers happy...

First, I renamed the G member of the lua_State structure as gs (global
state), in lstate.h (in the structure and in the macro). I though it was easier to
rename the member than to rename all calls of G(). I had to rename a few
occurences of the G member in lstate.c.

Next, I renamed the val(), key() and node() macro functions as VAL(), KEY()
and NODE(), in ltable.h. I renamed them in lapi.c, ldebug.c, lgc.c, ltests.c
and ltable.c as well.

I removed lua_getweakregistry from my .def file, since it don't seems to be
defined yet.

I made some slight changes to remove the following warnings:
src\lfunc.c(32) : warning C4244: '=' : conversion from 'int ' to 'unsigned
char ', possible loss of data
src\lfunc.c(41) : warning C4244: '=' : conversion from 'int ' to 'unsigned
char ', possible loss of data
src\lparser.c(452) : warning C4701: local variable 'args' may be used
without having been initialized
src\lib\liolib.c(560) : warning C4702: unreachable code
src\luac\ldumplib.c(18) : warning C4244: '=' : conversion from 'int ' to
'char ', possible loss of data
src\luac\print.c(183) : warning C4505: 'PrintLocal' : unreferenced local
function has been removed

Actually, I kept the unreachable code one (a return after an exit, added to
avoid warnings in another compiler :-), and the PrintLocal one (either
obsolete or for future use).
The conversion warnings were wipped with casts, and the args problem fixed
by moving the args.k = VVOID; initialization before the switch, and removing
it from the first case. Indeed, if we go in the default:, it is not
initialized.

I don't release yet my project files nor the corrected file (moving
target!), but I can send them if (privately) requested.

I suggest to Lua authors to take in account these changes (if not already
done; of course, adjusted to their coding standards), since they are quite
minor and this would help compiling with stupid compilers :-)

Regards.

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--

Sent through GMX FreeMail - http://www.gmx.net