lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:
> Lua 5.1 (alpha) is now frozen. Any other fixes will have to wait till beta.
> Please keep sending them.

Ok, here's the next bunch of fixes from me:

- lstate.c: luaE_freethread() is missing a call to luai_userstatefree(L1)
  (right before the call to freestack()).

- ldo.c: at the end of luaD_precall() when the C function yields:
  ci->nresults = nresults is redundant (already set a few lines above).

- loadlib.c: setprogdir() should be marked static.

- loadlib.c: the compiler complains about lb being uninitialized
  in setprogdir(). Added a return after luaL_error() (plus braces).

- luaconf.h: OpenBSD only defines __i386__ (but not __i386). I added
  the check for both variants to the lua_number2int() selection.

- luaconf.h: _POSIX_C_SOURCE is a 'feature test' macro. According to
  the POSIX standard this is to be defined by the application and to
  be checked by system headers (and not vice versa). In fact this
  macro is only defined on Linux as a side-effect of limits.h
  including features.h. No other POSIX system I tried this on defines
  this macro. I.e. none of the POSIX features are enabled there!
  This macro cannot be used to find out whether you are running on
  a POSIX system.

  Unfortunately defining this macro is a really bad idea, too.
  Because this will hide many needed definitions from system headers
  (I tried and it was hopeless to get it to work everywhere).

  I've not found _any_ single macro that is predefined on all POSIX
  compliant systems. So I've resorted to the following in luaconf.h:

@@ LUA_USE_POSIX controls the use of POSIX features.
** CHANGE it (define it) if this is not autodetected.
#if !defined(LUA_USE_POSIX)
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || \
    defined(unix) || defined(__unix) || defined(__unix__) || \
    defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
    defined(__OpenBSD__) || defined(__sun) || defined(sgi) || \
    defined(__hpux) || defined(_AIX) || defined(__APPLE__)

  And then modified all other occurences of _POSIX_C_SOURCE to
  LUA_USE_POSIX. I changed the popen check to:

#if !defined(LUA_ANSI) && (defined(LUA_USE_POSIX) || defined(LUA_USE_POPEN))

  Because there are no POSIX.1-only systems left and non-POSIX
  systems may have popen(), too.

  I modified the 'no loadlib' error message selection in loadlib.c, too:

#if defined(__ELF__) || defined(LUA_USE_POSIX)

  Note that I didn't include __ELF__ in the POSIX check above
  because ELF is not limited to POSIX systems (but it's a strong
  indication that dynamic loading should work).

- The bsd target in the top-level Makefile does not set LUA_USE_ULONGJMP.
  A target for Mac OS X should be added, too (LUA_DL_DYLD is autodetected):



- The missing '"' in the mingw target was already noted by Doug Currie.
  Exporting all symbols should not have an adverse effect, since each
  DLL has its own namespace. There is no danger of global namespace
  pollution (as there is no such thing on Windows).

  But I guess this will assign more or less random values to the
  DLL ordinals (bad for updates). At least the official symbols should
  get fixed ordinals. Anyone have a script to autogenerate a .def file
  from the headers?

- The provided HTML documents do not validate. There are too many errors
  to list them here. Check with:
  My suggestion is to switch to xhtml 1.1 first before fixing this.