fix warnings on Linux

pull/81/head
dibyendumajumdar 9 years ago
parent 71d35c4d9f
commit 8a94300518

@ -31,7 +31,7 @@ endif()
if (CMAKE_COMPILER_IS_GNUCXX OR APPLE)
set(CMAKE_C_FLAGS "-std=c99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX")
set(CMAKE_C_FLAGS_DEBUG "-std=c99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX")
set(CMAKE_C_FLAGS_DEBUG "-std=c99 -O0 -g3 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX")
set(CMAKE_C_FLAGS_RELEASE "-std=c99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX")
endif()

@ -14,6 +14,7 @@
#include "lua.h"
/*
** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count
** the total memory used by Lua (in bytes). Usually, 'size_t' and

@ -580,6 +580,8 @@ static const char* PrintRaviCode(char *buf, size_t n, Instruction i) {
if (getCMode(o) != OpArgN)
snprintf(buf + strlen(buf), n - strlen(buf), " C=%d", getCMode(o) == OpArgK ? (MYK(INDEXK(c))) : c);
break;
default:
break;
}
return buf;
}
@ -618,4 +620,4 @@ const char* print_instruction(char *buf, size_t n, Instruction i) {
break;
}
return buf;
}
}

@ -95,7 +95,7 @@ static void print_expdesc(FILE *fp, FuncState *fs, const expdesc *e) {
get_typename(e->ravi_type));
break;
case VKINT:
fprintf(fp, "{p=%p, k=VKINT, n=%ld, type=%s}", e, e->u.ival,
fprintf(fp, "{p=%p, k=VKINT, n=%lld, type=%s}", e, e->u.ival,
get_typename(e->ravi_type));
break;
case VNONRELOC:
@ -339,7 +339,6 @@ static void new_localvar (LexState *ls, TString *name, int tt) {
FuncState *fs = ls->fs;
Dyndata *dyd = ls->dyd;
int reg = registerlocalvar(ls, name, tt);
int oldsize = dyd->actvar.size;
checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
MAXVARS, "local variables");
luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1,
@ -402,13 +401,6 @@ int getlocvartype(FuncState *fs, int reg) {
return v->ravi_type;
}
/* set type of a local var (RAVI) */
static void setlocvartype(FuncState *fs, int i, int tt) {
if (i < 0 || (fs->firstlocal + i) >= fs->ls->dyd->actvar.n)
return;
getlocvar(fs, i)->ravi_type = tt;
}
/* set the starting code location (set to current instruction)
* for nvars new local variables; variable scope starts here
*/
@ -546,7 +538,6 @@ static void ravi_coercetype(LexState *ls, expdesc *v, int n)
Instruction *pc = &getcode(ls->fs, v); /* Obtain the instruction for OP_CALL */
lua_assert(GET_OPCODE(*pc) == OP_CALL);
int a = GETARG_A(*pc); /* function return values will be placed from register pointed by A and upwards */
int nrets = GETARG_C(*pc) - 1; /* operand C contais number of return values expected */
/* all return values that are going to be assigned to typed local vars must be converted to the correct type */
int i;
for (i = a + 1; i < a + n; i++) {

@ -673,7 +673,7 @@ void stackDump(lua_State *L, const char *s) {
else if (ttisfloat(p))
printf("stack[%d] = float (%.6f)\n", i, fltvalue(p));
else if (ttisinteger(p))
printf("stack[%d] = integer (%d)\n", i, ivalue(p));
printf("stack[%d] = integer (%lld)\n", i, ivalue(p));
else if (ttislightuserdata(p))
printf("stack[%d] = light user data\n", i);
else if (ttisfulluserdata(p))

Loading…
Cancel
Save