lua: clean up host patch fuzz

Refresh host patches to match target changes from the commit
4e800716ac ("lua: clean up patch fuzz").

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
master
Rafał Miłecki 5 years ago
parent ef5b7aa6c3
commit c0c5c63514

@ -73,7 +73,7 @@
return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; return (t == LUA_TNONE) ? "no value" : luaT_typenames[t];
} }
@@ -264,6 +265,14 @@ LUA_API int lua_isnumber (lua_State *L, @@ -264,6 +265,14 @@ LUA_API int lua_isnumber (lua_State *L,
} }
@ -88,7 +88,7 @@
LUA_API int lua_isstring (lua_State *L, int idx) { LUA_API int lua_isstring (lua_State *L, int idx) {
int t = lua_type(L, idx); int t = lua_type(L, idx);
return (t == LUA_TSTRING || t == LUA_TNUMBER); return (t == LUA_TSTRING || t == LUA_TNUMBER);
@@ -309,31 +318,66 @@ LUA_API int lua_lessthan (lua_State *L, @@ -309,31 +318,66 @@ LUA_API int lua_lessthan (lua_State *L,
} }
@ -173,7 +173,7 @@
case LUA_TNUMBER: { case LUA_TNUMBER: {
size_t l; size_t l;
lua_lock(L); /* `luaV_tostring' may create a new string */ lua_lock(L); /* `luaV_tostring' may create a new string */
@@ -426,6 +471,8 @@ LUA_API void lua_pushnil (lua_State *L) @@ -426,6 +471,8 @@ LUA_API void lua_pushnil (lua_State *L)
} }
@ -207,7 +207,7 @@
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
@@ -569,7 +626,7 @@ LUA_API void lua_rawgeti (lua_State *L, @@ -569,7 +626,7 @@ LUA_API void lua_rawgeti (lua_State *L,
lua_lock(L); lua_lock(L);
o = index2adr(L, idx); o = index2adr(L, idx);
api_check(L, ttistable(o)); api_check(L, ttistable(o));
@ -216,7 +216,7 @@
api_incr_top(L); api_incr_top(L);
lua_unlock(L); lua_unlock(L);
} }
@@ -597,6 +654,9 @@ LUA_API int lua_getmetatable (lua_State @@ -597,6 +654,9 @@ LUA_API int lua_getmetatable (lua_State
case LUA_TUSERDATA: case LUA_TUSERDATA:
mt = uvalue(obj)->metatable; mt = uvalue(obj)->metatable;
break; break;
@ -226,7 +226,7 @@
default: default:
mt = G(L)->mt[ttype(obj)]; mt = G(L)->mt[ttype(obj)];
break; break;
@@ -687,7 +747,7 @@ LUA_API void lua_rawseti (lua_State *L, @@ -687,7 +747,7 @@ LUA_API void lua_rawseti (lua_State *L,
api_checknelems(L, 1); api_checknelems(L, 1);
o = index2adr(L, idx); o = index2adr(L, idx);
api_check(L, ttistable(o)); api_check(L, ttistable(o));
@ -235,7 +235,7 @@
luaC_barriert(L, hvalue(o), L->top-1); luaC_barriert(L, hvalue(o), L->top-1);
L->top--; L->top--;
lua_unlock(L); lua_unlock(L);
@@ -721,7 +781,7 @@ LUA_API int lua_setmetatable (lua_State @@ -721,7 +781,7 @@ LUA_API int lua_setmetatable (lua_State
break; break;
} }
default: { default: {
@ -297,7 +297,7 @@
#define FREELIST_REF 0 /* free list of references */ #define FREELIST_REF 0 /* free list of references */
@@ -66,7 +66,7 @@ LUALIB_API int luaL_typerror (lua_State @@ -66,7 +66,7 @@ LUALIB_API int luaL_typerror (lua_State
static void tag_error (lua_State *L, int narg, int tag) { static void tag_error (lua_State *L, int narg, int tag) {
@ -362,7 +362,7 @@
@@ -54,20 +56,25 @@ static int luaB_tonumber (lua_State *L) @@ -54,20 +56,25 @@ static int luaB_tonumber (lua_State *L)
int base = luaL_optint(L, 2, 10); int base = luaL_optint(L, 2, 10);
if (base == 10) { /* standard conversion */ if (base == 10) { /* standard conversion */
luaL_checkany(L, 1); luaL_checkany(L, 1);
@ -514,7 +514,7 @@
case VKNUM: case VKNUM:
case VTRUE: case VTRUE:
case VFALSE: case VFALSE:
@@ -451,6 +489,10 @@ int luaK_exp2RK (FuncState *fs, expdesc @@ -451,6 +489,10 @@ int luaK_exp2RK (FuncState *fs, expdesc
if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */
e->u.s.info = (e->k == VNIL) ? nilK(fs) : e->u.s.info = (e->k == VNIL) ? nilK(fs) :
(e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) :
@ -907,7 +907,7 @@
lua_assert(isdigit(ls->current)); lua_assert(isdigit(ls->current));
do { do {
save_and_next(ls); save_and_next(ls);
@@ -202,8 +215,9 @@ static void read_numeral (LexState *ls, @@ -202,8 +215,9 @@ static void read_numeral (LexState *ls,
save_and_next(ls); save_and_next(ls);
save(ls, '\0'); save(ls, '\0');
buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
@ -1020,6 +1020,7 @@
-#define PI (3.14159265358979323846) -#define PI (3.14159265358979323846)
-#define RADIANS_PER_DEGREE (PI/180.0) -#define RADIANS_PER_DEGREE (PI/180.0)
- -
-
+#ifdef LNUM_FLOAT +#ifdef LNUM_FLOAT
+# define PI (3.14159265358979323846F) +# define PI (3.14159265358979323846F)
+#elif defined(M_PI) +#elif defined(M_PI)
@ -1028,7 +1029,7 @@
+# define PI (3.14159265358979323846264338327950288) +# define PI (3.14159265358979323846264338327950288)
+#endif +#endif
+#define RADIANS_PER_DEGREE (PI/180) +#define RADIANS_PER_DEGREE (PI/180)
+
+#undef HUGE +#undef HUGE
+#ifdef LNUM_FLOAT +#ifdef LNUM_FLOAT
+# define HUGE HUGE_VALF +# define HUGE HUGE_VALF
@ -2114,7 +2115,7 @@
case LUA_TBOOLEAN: case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
case LUA_TLIGHTUSERDATA: case LUA_TLIGHTUSERDATA:
@@ -86,21 +106,6 @@ int luaO_rawequalObj (const TValue *t1, @@ -86,21 +106,6 @@ int luaO_rawequalObj (const TValue *t1,
} }
} }
@ -2617,7 +2618,7 @@
nums[ceillog2(k)]++; /* count as such */ nums[ceillog2(k)]++; /* count as such */
return 1; return 1;
} }
@@ -308,7 +322,7 @@ static void resize (lua_State *L, Table @@ -308,7 +322,7 @@ static void resize (lua_State *L, Table
/* re-insert elements from vanishing slice */ /* re-insert elements from vanishing slice */
for (i=nasize; i<oldasize; i++) { for (i=nasize; i<oldasize; i++) {
if (!ttisnil(&t->array[i])) if (!ttisnil(&t->array[i]))
@ -2661,7 +2662,7 @@
} while (n); } while (n);
return luaO_nilobject; return luaO_nilobject;
} }
@@ -470,14 +487,12 @@ const TValue *luaH_get (Table *t, const @@ -470,14 +487,12 @@ const TValue *luaH_get (Table *t, const
switch (ttype(key)) { switch (ttype(key)) {
case LUA_TNIL: return luaO_nilobject; case LUA_TNIL: return luaO_nilobject;
case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
@ -3072,7 +3073,7 @@
/* /*
@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
** CHANGE it if your system requires alignments larger than double. (For ** CHANGE it if your system requires alignments larger than double. (For
@@ -728,28 +652,6 @@ union luai_Cast { double l_d; long l_l; @@ -728,28 +652,6 @@ union luai_Cast { double l_d; long l_l;
#define luai_userstateyield(L,n) ((void)L) #define luai_userstateyield(L,n) ((void)L)
@ -3103,7 +3104,7 @@
/* /*
--- a/src/lundump.c --- a/src/lundump.c
+++ b/src/lundump.c +++ b/src/lundump.c
@@ -73,6 +73,13 @@ static lua_Number LoadNumber(LoadState* @@ -73,6 +73,13 @@ static lua_Number LoadNumber(LoadState*
return x; return x;
} }
@ -3117,7 +3118,7 @@
static TString* LoadString(LoadState* S) static TString* LoadString(LoadState* S)
{ {
size_t size; size_t size;
@@ -119,6 +126,9 @@ static void LoadConstants(LoadState* S, @@ -119,6 +126,9 @@ static void LoadConstants(LoadState* S,
case LUA_TNUMBER: case LUA_TNUMBER:
setnvalue(o,LoadNumber(S)); setnvalue(o,LoadNumber(S));
break; break;
@ -3209,7 +3210,7 @@
setsvalue2s(L, obj, luaS_new(L, s)); setsvalue2s(L, obj, luaS_new(L, s));
return 1; return 1;
} }
@@ -222,59 +234,127 @@ static int l_strcmp (const TString *ls, @@ -222,59 +234,127 @@ static int l_strcmp (const TString *ls,
} }
@ -3432,10 +3433,10 @@
+ case TM_POW: if (try_powint( ri, ib, ic)) return; break; + case TM_POW: if (try_powint( ri, ib, ic)) return; break;
+ case TM_UNM: if (try_unmint( ri, ib)) return; break; + case TM_UNM: if (try_unmint( ri, ib)) return; break;
+ default: lua_assert(0); + default: lua_assert(0);
+ } }
+ } + }
+ /* Fallback to floating point, when leaving range. */ + /* Fallback to floating point, when leaving range. */
+
+#ifdef LNUM_COMPLEX +#ifdef LNUM_COMPLEX
+ if ((nvalue_img(b)!=0) || (nvalue_img(c)!=0)) { + if ((nvalue_img(b)!=0) || (nvalue_img(c)!=0)) {
+ lua_Complex r; + lua_Complex r;
@ -3455,7 +3456,7 @@
+ default: lua_assert(0); r=0; + default: lua_assert(0); r=0;
+ } + }
+ setnvalue_complex( ra, r ); + setnvalue_complex( ra, r );
} + }
+ return; + return;
+ } + }
+#endif +#endif
@ -3476,7 +3477,7 @@
+ if (!call_binTM(L, rb, rc, ra, op)) + if (!call_binTM(L, rb, rc, ra, op))
+ luaG_aritherror(L, rb, rc); + luaG_aritherror(L, rb, rc);
+} +}
+
+/* Helper macro to sort arithmetic operations into four categories: +/* Helper macro to sort arithmetic operations into four categories:
+ * TK_INT: integer - integer operands + * TK_INT: integer - integer operands
+ * TK_NUMBER: number - number (non complex, either may be integer) + * TK_NUMBER: number - number (non complex, either may be integer)

@ -1,6 +1,6 @@
--- a/src/lvm.c --- a/src/lvm.c
+++ b/src/lvm.c +++ b/src/lvm.c
@@ -284,7 +284,8 @@ int luaV_lessthan (lua_State *L, const T @@ -281,7 +281,8 @@ int luaV_lessthan (lua_State *L, const T
else else
return luai_numlt( nvalue_fast(l), cast_num(ivalue(r)) ); return luai_numlt( nvalue_fast(l), cast_num(ivalue(r)) );
@ -10,7 +10,7 @@
return res; return res;
return luaG_ordererror(L, l, r); return luaG_ordererror(L, l, r);
@@ -322,7 +323,8 @@ static int lessequal (lua_State *L, cons @@ -319,7 +320,8 @@ static int lessequal (lua_State *L, cons
else else
return luai_numle( nvalue_fast(l), cast_num(ivalue(r)) ); return luai_numle( nvalue_fast(l), cast_num(ivalue(r)) );

Loading…
Cancel
Save