lua-users home
lua-l archive

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


I just downloaded a fresh Lua 5.2.2 and added those two lines to luaconf.h:

#define lua_number2int ((int(*)(double))NULL)
#define lua_number2integer ((int(*)(double)NULL)

What I get is tons of those messages:

llimits.h:236:0: warning: "lua_number2int" redefined [enabled by default]
 #define lua_number2int(i,n)  lua_number2int32(i, n, int)
 ^
In file included from lua.h:16:0,
                 from lzio.c:13:
luaconf.h:386:0: note: this is the location of the previous definition
 #define lua_number2int ((int(*)(double))NULL)

If some default settings cause that to happen, it should either be
pointed out more explicitly (especially the settings which are
responsible), or the defaults should be changed, or llimits.h should
ignore those LUA_MSASMTRICK etc things if lua_numbers2int is already
defined.

An additional check if lua_numbers2int is already defined should only
slow down compilation speed I suppose? (which doesn't seem like a huge
problem/downside to me?)

Regards,
Jonas Thiem

On 08/27/2013 04:10 PM, Roberto Ierusalimschy wrote:
>> This is from Lua 5.2.1. I suppose I should update to 5.2.2, was it fixed
>> there?
> 
> I may be wrong, but I think all definitions of lua_number2int in
> llimits.h are protected by some previous define (either MS_ASMTRICK
> or LUA_MSASMTRICK or LUA_IEEE754TRICK). If you undefine all them in
> luaconf.h, then llimits.h will respect your definition:
> 
>   /* the following definitions always work, but may be slow */
>   
>   #if !defined(lua_number2int)
>   #define lua_number2int(i,n)     ((i)=(int)(n))
>   #endif
> 
>    ...
> 
> -- Roberto
> 

Attachment: signature.asc
Description: OpenPGP digital signature