summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldebug.c11
-rw-r--r--ldebug.h20
-rw-r--r--ldo.c6
-rw-r--r--ldo.h4
-rw-r--r--llimits.h15
-rw-r--r--lvm.c16
6 files changed, 42 insertions, 30 deletions
diff --git a/ldebug.c b/ldebug.c
index f9c30ce0..24e9aaca 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -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
523void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { 523l_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
531int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { 531l_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
558void luaG_errormsg (lua_State *L) { 557l_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
571void luaG_runerror (lua_State *L, const char *fmt, ...) { 570l_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));
diff --git a/ldebug.h b/ldebug.h
index 5f865ee8..7af551e2 100644
--- a/ldebug.h
+++ b/ldebug.h
@@ -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
24LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, 24LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
25 const char *opname); 25 const char *opname);
26LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); 26LUAI_FUNC l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2);
27LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, 27LUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1,
28 const TValue *p2); 28 const TValue *p2);
29LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, 29LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1,
30 const TValue *p2); 30 const TValue *p2);
31LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); 31LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...);
32LUAI_FUNC void luaG_errormsg (lua_State *L); 32LUAI_FUNC l_noret luaG_errormsg (lua_State *L);
33 33
34#endif 34#endif
diff --git a/ldo.c b/ldo.c
index b74efd31..ed9771e1 100644
--- a/ldo.c
+++ b/ldo.c
@@ -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
103void luaD_throw (lua_State *L, int errcode) { 103l_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*/
475static void resume_error (lua_State *L, const char *msg, StkId firstArg) { 475static 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);
diff --git a/ldo.h b/ldo.h
index dd651040..2ff768db 100644
--- a/ldo.h
+++ b/ldo.h
@@ -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);
38LUAI_FUNC void luaD_growstack (lua_State *L, int n); 38LUAI_FUNC void luaD_growstack (lua_State *L, int n);
39LUAI_FUNC void luaD_shrinkstack (lua_State *L); 39LUAI_FUNC void luaD_shrinkstack (lua_State *L);
40 40
41LUAI_FUNC void luaD_throw (lua_State *L, int errcode); 41LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode);
42LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 42LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
43 43
44#endif 44#endif
diff --git a/llimits.h b/llimits.h
index d9445501..d0be3ab5 100644
--- a/llimits.h
+++ b/llimits.h
@@ -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*/
diff --git a/lvm.c b/lvm.c
index 5b816239..55bd8ec9 100644
--- a/lvm.c
+++ b/lvm.c
@@ -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