diff options
-rw-r--r-- | ldebug.c | 11 | ||||
-rw-r--r-- | ldebug.h | 20 | ||||
-rw-r--r-- | ldo.c | 6 | ||||
-rw-r--r-- | ldo.h | 4 | ||||
-rw-r--r-- | llimits.h | 15 | ||||
-rw-r--r-- | lvm.c | 16 |
6 files changed, 42 insertions, 30 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.85 2011/09/13 17:40:20 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.86 2011/09/13 18:05:59 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 | */ |
@@ -520,7 +520,7 @@ void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { | |||
520 | } | 520 | } |
521 | 521 | ||
522 | 522 | ||
523 | void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { | 523 | l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { |
524 | TValue temp; | 524 | TValue temp; |
525 | if (luaV_tonumber(p1, &temp) == NULL) | 525 | if (luaV_tonumber(p1, &temp) == NULL) |
526 | p2 = p1; /* first operand is wrong */ | 526 | p2 = p1; /* first operand is wrong */ |
@@ -528,14 +528,13 @@ void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { | |||
528 | } | 528 | } |
529 | 529 | ||
530 | 530 | ||
531 | int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { | 531 | l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { |
532 | const char *t1 = objtypename(p1); | 532 | const char *t1 = objtypename(p1); |
533 | const char *t2 = objtypename(p2); | 533 | const char *t2 = objtypename(p2); |
534 | if (t1 == t2) | 534 | if (t1 == t2) |
535 | luaG_runerror(L, "attempt to compare two %s values", t1); | 535 | luaG_runerror(L, "attempt to compare two %s values", t1); |
536 | else | 536 | else |
537 | luaG_runerror(L, "attempt to compare %s with %s", t1, t2); | 537 | luaG_runerror(L, "attempt to compare %s with %s", t1, t2); |
538 | return 0; | ||
539 | } | 538 | } |
540 | 539 | ||
541 | 540 | ||
@@ -555,7 +554,7 @@ static void addinfo (lua_State *L, const char *msg) { | |||
555 | } | 554 | } |
556 | 555 | ||
557 | 556 | ||
558 | void luaG_errormsg (lua_State *L) { | 557 | l_noret luaG_errormsg (lua_State *L) { |
559 | if (L->errfunc != 0) { /* is there an error handling function? */ | 558 | if (L->errfunc != 0) { /* is there an error handling function? */ |
560 | StkId errfunc = restorestack(L, L->errfunc); | 559 | StkId errfunc = restorestack(L, L->errfunc); |
561 | if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); | 560 | if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); |
@@ -568,7 +567,7 @@ void luaG_errormsg (lua_State *L) { | |||
568 | } | 567 | } |
569 | 568 | ||
570 | 569 | ||
571 | void luaG_runerror (lua_State *L, const char *fmt, ...) { | 570 | l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { |
572 | va_list argp; | 571 | va_list argp; |
573 | va_start(argp, fmt); | 572 | va_start(argp, fmt); |
574 | addinfo(L, luaO_pushvfstring(L, fmt, argp)); | 573 | addinfo(L, luaO_pushvfstring(L, fmt, argp)); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.h,v 2.5 2009/06/10 16:57:53 roberto Exp roberto $ | 2 | ** $Id: ldebug.h,v 2.6 2011/06/02 19:31:40 roberto Exp roberto $ |
3 | ** Auxiliary functions from Debug Interface module | 3 | ** Auxiliary functions from Debug Interface module |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -21,14 +21,14 @@ | |||
21 | #define ci_func(ci) (clLvalue((ci)->func)) | 21 | #define ci_func(ci) (clLvalue((ci)->func)) |
22 | 22 | ||
23 | 23 | ||
24 | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, | 24 | LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, |
25 | const char *opname); | 25 | const char *opname); |
26 | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); | 26 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2); |
27 | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, | 27 | LUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1, |
28 | const TValue *p2); | 28 | const TValue *p2); |
29 | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, | 29 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, |
30 | const TValue *p2); | 30 | const TValue *p2); |
31 | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); | 31 | LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); |
32 | LUAI_FUNC void luaG_errormsg (lua_State *L); | 32 | LUAI_FUNC l_noret luaG_errormsg (lua_State *L); |
33 | 33 | ||
34 | #endif | 34 | #endif |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.99 2011/08/23 17:24:34 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.100 2011/09/12 20:33:03 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 | */ |
@@ -100,7 +100,7 @@ static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { | |||
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | void luaD_throw (lua_State *L, int errcode) { | 103 | l_noret luaD_throw (lua_State *L, int errcode) { |
104 | if (L->errorJmp) { /* thread has an error handler? */ | 104 | if (L->errorJmp) { /* thread has an error handler? */ |
105 | L->errorJmp->status = errcode; /* set status */ | 105 | L->errorJmp->status = errcode; /* set status */ |
106 | LUAI_THROW(L, L->errorJmp); /* jump to it */ | 106 | LUAI_THROW(L, L->errorJmp); /* jump to it */ |
@@ -472,7 +472,7 @@ static int recover (lua_State *L, int status) { | |||
472 | ** coroutine itself. (Such errors should not be handled by any coroutine | 472 | ** coroutine itself. (Such errors should not be handled by any coroutine |
473 | ** error handler and should not kill the coroutine.) | 473 | ** error handler and should not kill the coroutine.) |
474 | */ | 474 | */ |
475 | static void resume_error (lua_State *L, const char *msg, StkId firstArg) { | 475 | static l_noret resume_error (lua_State *L, const char *msg, StkId firstArg) { |
476 | L->top = firstArg; /* remove args from the stack */ | 476 | L->top = firstArg; /* remove args from the stack */ |
477 | setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ | 477 | setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ |
478 | incr_top(L); | 478 | incr_top(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.h,v 2.17 2009/11/25 15:27:51 roberto Exp roberto $ | 2 | ** $Id: ldo.h,v 2.18 2009/12/17 12:28:57 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 | */ |
@@ -38,7 +38,7 @@ LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); | |||
38 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); | 38 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); |
39 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); | 39 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); |
40 | 40 | ||
41 | LUAI_FUNC void luaD_throw (lua_State *L, int errcode); | 41 | LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); |
42 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); | 42 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); |
43 | 43 | ||
44 | #endif | 44 | #endif |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.91 2011/09/13 17:39:23 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.92 2011/09/30 12:46:06 roberto Exp roberto $ |
3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other `installation-dependent' definitions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -97,6 +97,19 @@ typedef LUAI_UACNUMBER l_uacNumber; | |||
97 | 97 | ||
98 | 98 | ||
99 | /* | 99 | /* |
100 | ** non-return type | ||
101 | */ | ||
102 | #if defined(__GNUC__) | ||
103 | #define l_noret void __attribute__((noreturn)) | ||
104 | #elif defined(_MSC_VER) | ||
105 | #define l_noret void __declspec(noreturn) | ||
106 | #else | ||
107 | #define l_noret void | ||
108 | #endif | ||
109 | |||
110 | |||
111 | |||
112 | /* | ||
100 | ** maximum depth for nested C calls and syntactical nested non-terminals | 113 | ** maximum depth for nested C calls and syntactical nested non-terminals |
101 | ** in a program. (Value must fit in an unsigned short int.) | 114 | ** in a program. (Value must fit in an unsigned short int.) |
102 | */ | 115 | */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.142 2011/08/09 20:58:29 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.143 2011/08/17 20:26:47 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -226,9 +226,9 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { | |||
226 | return luai_numlt(L, nvalue(l), nvalue(r)); | 226 | return luai_numlt(L, nvalue(l), nvalue(r)); |
227 | else if (ttisstring(l) && ttisstring(r)) | 227 | else if (ttisstring(l) && ttisstring(r)) |
228 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; | 228 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; |
229 | else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) | 229 | else if ((res = call_orderTM(L, l, r, TM_LT)) < 0) |
230 | return res; | 230 | luaG_ordererror(L, l, r); |
231 | return luaG_ordererror(L, l, r); | 231 | return res; |
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
@@ -238,11 +238,11 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { | |||
238 | return luai_numle(L, nvalue(l), nvalue(r)); | 238 | return luai_numle(L, nvalue(l), nvalue(r)); |
239 | else if (ttisstring(l) && ttisstring(r)) | 239 | else if (ttisstring(l) && ttisstring(r)) |
240 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; | 240 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; |
241 | else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ | 241 | else if ((res = call_orderTM(L, l, r, TM_LE)) >= 0) /* first try `le' */ |
242 | return res; | 242 | return res; |
243 | else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ | 243 | else if ((res = call_orderTM(L, r, l, TM_LT)) < 0) /* else try `lt' */ |
244 | return !res; | 244 | luaG_ordererror(L, l, r); |
245 | return luaG_ordererror(L, l, r); | 245 | return !res; |
246 | } | 246 | } |
247 | 247 | ||
248 | 248 | ||