BUG rc4 with LUA_USE_APICHECK

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG rc4 with LUA_USE_APICHECK

Tom N Harris
When building with LUA_USE_APICHECK defined, I get

     gcc -g -O2 -Wall -DLUA_COMPAT_ALL -D__NO_STRING_INLINES
-DLUA_USE_APICHECK -DLUA_USE_LINUX   -c -o lapi.o lapi.c
     lapi.c: In function ‘lua_arith’:
     lapi.c:289: error: ‘else’ without a previous ‘if’
     make: *** [lapi.o] Error 1

Had to scratch my head at that until I remembered that "api_check(...);"
is a macro that expands to "{ ... };" so line 288 needs to be in braces.

--
- tom
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: BUG rc4 with LUA_USE_APICHECK

Edgar Toernig
Tom N Harris wrote:

> When building with LUA_USE_APICHECK defined, I get
>
>      gcc -g -O2 -Wall -DLUA_COMPAT_ALL -D__NO_STRING_INLINES
> -DLUA_USE_APICHECK -DLUA_USE_LINUX   -c -o lapi.o lapi.c
>      lapi.c: In function ‘lua_arith’:
>      lapi.c:289: error: ‘else’ without a previous ‘if’
>      make: *** [lapi.o] Error 1
>
> Had to scratch my head at that until I remembered that "api_check(...);"
> is a macro that expands to "{ ... };" so line 288 needs to be in braces.

Actually, all those "#define foo {...}" should be "#define foo do {...} while (0)".

   http://c-faq.com/cpp/multistmt.html

Ciao, ET.