aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-07 11:35:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-07 11:35:55 -0300
commitc1c100a0c04bc77623b32269f37df49e7a2457d2 (patch)
treebb60e4c8a0edcef94b2cdfcf62b1ed82a98cb147
parentb6e2f1a86e2f75c8672b0e9fb8e75438a1f65db9 (diff)
downloadlua-c1c100a0c04bc77623b32269f37df49e7a2457d2.tar.gz
lua-c1c100a0c04bc77623b32269f37df49e7a2457d2.tar.bz2
lua-c1c100a0c04bc77623b32269f37df49e7a2457d2.zip
warnings in other compilers
-rw-r--r--ldebug.c41
-rw-r--r--ldo.h4
-rw-r--r--lobject.c4
3 files changed, 24 insertions, 25 deletions
diff --git a/ldebug.c b/ldebug.c
index c77278ec..82f82612 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.127 2002/08/06 15:32:22 roberto Exp roberto $ 2** $Id: ldebug.c,v 1.128 2002/08/06 18:01:50 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -25,14 +25,14 @@
25 25
26 26
27 27
28static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); 28static const char *getfuncname (CallInfo *ci, const char **name);
29 29
30 30
31static int isLua (CallInfo *ci) { 31static int isLua (CallInfo *ci) {
32 return isLfunction (ci->base - 1); 32 return isLfunction (ci->base - 1);
33} 33}
34 34
35static int currentpc (lua_State *L, CallInfo *ci) { 35static int currentpc (CallInfo *ci) {
36 if (!isLua(ci)) return -1; /* function is not a Lua function? */ 36 if (!isLua(ci)) return -1; /* function is not a Lua function? */
37 if (ci->pc != &luaV_callingmark) /* is not calling another Lua function? */ 37 if (ci->pc != &luaV_callingmark) /* is not calling another Lua function? */
38 ci->u.l.savedpc = *ci->pc; /* `pc' may not be saved; save it */ 38 ci->u.l.savedpc = *ci->pc; /* `pc' may not be saved; save it */
@@ -41,8 +41,8 @@ static int currentpc (lua_State *L, CallInfo *ci) {
41} 41}
42 42
43 43
44static int currentline (lua_State *L, CallInfo *ci) { 44static int currentline (CallInfo *ci) {
45 int pc = currentpc(L, ci); 45 int pc = currentpc(ci);
46 if (pc < 0) 46 if (pc < 0)
47 return -1; /* only active lua functions have current-line information */ 47 return -1; /* only active lua functions have current-line information */
48 else 48 else
@@ -62,7 +62,7 @@ LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask) {
62 setallowhook(L, allow); 62 setallowhook(L, allow);
63 resethookcount(L); 63 resethookcount(L);
64 for (ci = L->ci; ci != L->base_ci; ci--) /* update all `savedpc's */ 64 for (ci = L->ci; ci != L->base_ci; ci--) /* update all `savedpc's */
65 currentpc(L, ci); 65 currentpc(ci);
66 lua_unlock(L); 66 lua_unlock(L);
67 return 1; 67 return 1;
68} 68}
@@ -105,7 +105,7 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
105 ci = L->base_ci + ar->i_ci; 105 ci = L->base_ci + ar->i_ci;
106 fp = getluaproto(ci); 106 fp = getluaproto(ci);
107 if (fp) { /* is a Lua function? */ 107 if (fp) { /* is a Lua function? */
108 name = luaF_getlocalname(fp, n, currentpc(L, ci)); 108 name = luaF_getlocalname(fp, n, currentpc(ci));
109 if (name) 109 if (name)
110 luaA_pushobject(L, ci->base+(n-1)); /* push value */ 110 luaA_pushobject(L, ci->base+(n-1)); /* push value */
111 } 111 }
@@ -124,7 +124,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
124 fp = getluaproto(ci); 124 fp = getluaproto(ci);
125 L->top--; /* pop new value */ 125 L->top--; /* pop new value */
126 if (fp) { /* is a Lua function? */ 126 if (fp) { /* is a Lua function? */
127 name = luaF_getlocalname(fp, n, currentpc(L, ci)); 127 name = luaF_getlocalname(fp, n, currentpc(ci));
128 if (!name || name[0] == '(') /* `(' starts private locals */ 128 if (!name || name[0] == '(') /* `(' starts private locals */
129 name = NULL; 129 name = NULL;
130 else 130 else
@@ -205,7 +205,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
205 break; 205 break;
206 } 206 }
207 case 'l': { 207 case 'l': {
208 ar->currentline = (ci) ? currentline(L, ci) : -1; 208 ar->currentline = (ci) ? currentline(ci) : -1;
209 break; 209 break;
210 } 210 }
211 case 'u': { 211 case 'u': {
@@ -213,7 +213,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
213 break; 213 break;
214 } 214 }
215 case 'n': { 215 case 'n': {
216 ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; 216 ar->namewhat = (ci) ? getfuncname(ci, &ar->name) : NULL;
217 if (ar->namewhat == NULL) 217 if (ar->namewhat == NULL)
218 getname(L, f, ar); 218 getname(L, f, ar);
219 break; 219 break;
@@ -415,11 +415,10 @@ static const char *kname (Proto *p, int c) {
415} 415}
416 416
417 417
418static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, 418static const char *getobjname (CallInfo *ci, int stackpos, const char **name) {
419 const char **name) {
420 if (isLua(ci)) { /* a Lua function? */ 419 if (isLua(ci)) { /* a Lua function? */
421 Proto *p = ci_func(ci)->l.p; 420 Proto *p = ci_func(ci)->l.p;
422 int pc = currentpc(L, ci); 421 int pc = currentpc(ci);
423 Instruction i; 422 Instruction i;
424 *name = luaF_getlocalname(p, stackpos+1, pc); 423 *name = luaF_getlocalname(p, stackpos+1, pc);
425 if (*name) /* is a local? */ 424 if (*name) /* is a local? */
@@ -436,7 +435,7 @@ static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos,
436 int a = GETARG_A(i); 435 int a = GETARG_A(i);
437 int b = GETARG_B(i); /* move from `b' to `a' */ 436 int b = GETARG_B(i); /* move from `b' to `a' */
438 if (b < a) 437 if (b < a)
439 return getobjname(L, ci, b, name); /* get name for `b' */ 438 return getobjname(ci, b, name); /* get name for `b' */
440 break; 439 break;
441 } 440 }
442 case OP_GETTABLE: { 441 case OP_GETTABLE: {
@@ -454,17 +453,17 @@ static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos,
454} 453}
455 454
456 455
457static Instruction getcurrentinstr (lua_State *L, CallInfo *ci) { 456static Instruction getcurrentinstr (CallInfo *ci) {
458 return (!isLua(ci)) ? (Instruction)(-1) : 457 return (!isLua(ci)) ? (Instruction)(-1) :
459 ci_func(ci)->l.p->code[currentpc(L, ci)]; 458 ci_func(ci)->l.p->code[currentpc(ci)];
460} 459}
461 460
462 461
463static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { 462static const char *getfuncname (CallInfo *ci, const char **name) {
464 Instruction i; 463 Instruction i;
465 ci--; /* calling function */ 464 ci--; /* calling function */
466 i = getcurrentinstr(L, ci); 465 i = getcurrentinstr(ci);
467 return (GET_OPCODE(i) == OP_CALL ? getobjname(L, ci, GETARG_A(i), name) 466 return (GET_OPCODE(i) == OP_CALL ? getobjname(ci, GETARG_A(i), name)
468 : NULL); /* no useful name found */ 467 : NULL); /* no useful name found */
469} 468}
470 469
@@ -482,7 +481,7 @@ void luaG_typeerror (lua_State *L, const TObject *o, const char *op) {
482 const char *name = NULL; 481 const char *name = NULL;
483 const char *t = luaT_typenames[ttype(o)]; 482 const char *t = luaT_typenames[ttype(o)];
484 const char *kind = (isinstack(L->ci, o)) ? 483 const char *kind = (isinstack(L->ci, o)) ?
485 getobjname(L, L->ci, o - L->ci->base, &name) : NULL; 484 getobjname(L->ci, o - L->ci->base, &name) : NULL;
486 if (kind) 485 if (kind)
487 luaG_runerror(L, "attempt to %s %s `%s' (a %s value)", 486 luaG_runerror(L, "attempt to %s %s `%s' (a %s value)",
488 op, kind, name, t); 487 op, kind, name, t);
@@ -527,7 +526,7 @@ static void addinfo (lua_State *L, int internal) {
527 } 526 }
528 else { /* add file:line information */ 527 else { /* add file:line information */
529 char buff[LUA_IDSIZE]; 528 char buff[LUA_IDSIZE];
530 int line = currentline(L, ci); 529 int line = currentline(ci);
531 luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); 530 luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE);
532 luaO_pushfstring(L, "%s:%d: %s\n", buff, line, msg); 531 luaO_pushfstring(L, "%s:%d: %s\n", buff, line, msg);
533 } 532 }
diff --git a/ldo.h b/ldo.h
index 0d6047cc..70888b1c 100644
--- a/ldo.h
+++ b/ldo.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.h,v 1.49 2002/08/05 17:36:24 roberto Exp roberto $ 2** $Id: ldo.h,v 1.50 2002/08/06 15:32:22 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -39,7 +39,7 @@ int luaD_protectedparser (lua_State *L, ZIO *z, int bin);
39void luaD_callhook (lua_State *L, lua_Hookevent event, int line); 39void luaD_callhook (lua_State *L, lua_Hookevent event, int line);
40StkId luaD_precall (lua_State *L, StkId func); 40StkId luaD_precall (lua_State *L, StkId func);
41void luaD_call (lua_State *L, StkId func, int nResults); 41void luaD_call (lua_State *L, StkId func, int nResults);
42int luaD_pcall (lua_State *L, int nargs, int nresults, int errfunc); 42int luaD_pcall (lua_State *L, int nargs, int nresults, ptrdiff_t errfunc);
43void luaD_poscall (lua_State *L, int wanted, StkId firstResult); 43void luaD_poscall (lua_State *L, int wanted, StkId firstResult);
44void luaD_reallocCI (lua_State *L, int newsize); 44void luaD_reallocCI (lua_State *L, int newsize);
45void luaD_reallocstack (lua_State *L, int newsize); 45void luaD_reallocstack (lua_State *L, int newsize);
diff --git a/lobject.c b/lobject.c
index d2605ebd..f607aab2 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.84 2002/06/13 13:39:55 roberto Exp roberto $ 2** $Id: lobject.c,v 1.85 2002/07/17 16:25:13 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -122,7 +122,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
122 break; 122 break;
123 case 'c': { 123 case 'c': {
124 char buff[2]; 124 char buff[2];
125 buff[0] = va_arg(argp, int); 125 buff[0] = cast(char, va_arg(argp, int));
126 buff[1] = '\0'; 126 buff[1] = '\0';
127 pushstr(L, buff); 127 pushstr(L, buff);
128 break; 128 break;