Workaround to compile with Clang. Fix Clang warnings.

This commit is contained in:
Mike Pall 2011-04-19 17:12:41 +02:00
parent e94a12f4f6
commit 9ea679410c
3 changed files with 12 additions and 7 deletions

View File

@ -533,6 +533,11 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
#if defined(__GNUC__) && !LJ_TARGET_ARM
#ifdef __clang__
/* http://llvm.org/bugs/show_bug.cgi?id=8703 */
#define __unwind_word__ word
#endif
#include <unwind.h>
#define LJ_UEXCLASS 0x4c55414a49543200ULL /* LUAJIT2\0 */

View File

@ -556,7 +556,7 @@ static void rec_call_setup(jit_State *J, BCReg func, ptrdiff_t nargs)
TRef trfunc, *fbase = &J->base[func];
ptrdiff_t i;
for (i = 0; i <= nargs; i++)
getslot(J, func+i); /* Ensure func and all args have a reference. */
(void)getslot(J, func+i); /* Ensure func and all args have a reference. */
if (!tref_isfunc(fbase[0])) { /* Resolve __call metamethod. */
ix.tab = fbase[0];
copyTV(J->L, &ix.tabv, functv);
@ -634,7 +634,7 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
TValue *frame = J->L->base - 1;
ptrdiff_t i;
for (i = 0; i < gotresults; i++)
getslot(J, rbase+i); /* Ensure all results have a reference. */
(void)getslot(J, rbase+i); /* Ensure all results have a reference. */
while (frame_ispcall(frame)) { /* Immediately resolve pcall() returns. */
BCReg cbase = (BCReg)frame_delta(frame);
if (--J->framedepth < 0)

View File

@ -97,7 +97,7 @@ static GCtab *newtab(lua_State *L, uint32_t asize, uint32_t hbits)
{
GCtab *t;
/* First try to colocate the array part. */
if (LJ_MAX_COLOSIZE && asize > 0 && asize <= LJ_MAX_COLOSIZE) {
if (LJ_MAX_COLOSIZE != 0 && asize > 0 && asize <= LJ_MAX_COLOSIZE) {
lua_assert((sizeof(GCtab) & 7) == 0);
t = (GCtab *)lj_mem_newgco(L, sizetabcolo(asize));
t->gct = ~LJ_TTAB;
@ -203,9 +203,9 @@ void LJ_FASTCALL lj_tab_free(global_State *g, GCtab *t)
{
if (t->hmask > 0)
lj_mem_freevec(g, noderef(t->node), t->hmask+1, Node);
if (t->asize > 0 && LJ_MAX_COLOSIZE && t->colo <= 0)
if (t->asize > 0 && LJ_MAX_COLOSIZE != 0 && t->colo <= 0)
lj_mem_freevec(g, tvref(t->array), t->asize, TValue);
if (LJ_MAX_COLOSIZE && t->colo)
if (LJ_MAX_COLOSIZE != 0 && t->colo)
lj_mem_free(g, t, sizetabcolo((uint32_t)t->colo & 0x7f));
else
lj_mem_freet(g, t);
@ -224,7 +224,7 @@ static void resizetab(lua_State *L, GCtab *t, uint32_t asize, uint32_t hbits)
uint32_t i;
if (asize > LJ_MAX_ASIZE)
lj_err_msg(L, LJ_ERR_TABOV);
if (LJ_MAX_COLOSIZE && t->colo > 0) {
if (LJ_MAX_COLOSIZE != 0 && t->colo > 0) {
/* A colocated array must be separated and copied. */
TValue *oarray = tvref(t->array);
array = lj_mem_newvec(L, asize, TValue);
@ -257,7 +257,7 @@ static void resizetab(lua_State *L, GCtab *t, uint32_t asize, uint32_t hbits)
if (!tvisnil(&array[i]))
copyTV(L, lj_tab_setinth(L, t, (int32_t)i), &array[i]);
/* Physically shrink only separated arrays. */
if (LJ_MAX_COLOSIZE && t->colo <= 0)
if (LJ_MAX_COLOSIZE != 0 && t->colo <= 0)
setmref(t->array, lj_mem_realloc(L, array,
oldasize*sizeof(TValue), asize*sizeof(TValue)));
}