aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-27 13:32:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-27 13:32:59 -0300
commit0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b (patch)
tree0ac634fed90877130b1f102bf4075af999de2158 /lgc.c
parent15231d4fb2f6984b25e0353ff46eda1a180b686d (diff)
downloadlua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.tar.gz
lua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.tar.bz2
lua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.zip
Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative numerical types.
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lgc.c b/lgc.c
index 0ad3a16f..93d2249b 100644
--- a/lgc.c
+++ b/lgc.c
@@ -246,7 +246,7 @@ void luaC_fix (lua_State *L, GCObject *o) {
246** create a new collectable object (with given type, size, and offset) 246** create a new collectable object (with given type, size, and offset)
247** and link it to 'allgc' list. 247** and link it to 'allgc' list.
248*/ 248*/
249GCObject *luaC_newobjdt (lua_State *L, int tt, size_t sz, size_t offset) { 249GCObject *luaC_newobjdt (lua_State *L, lu_byte tt, size_t sz, size_t offset) {
250 global_State *g = G(L); 250 global_State *g = G(L);
251 char *p = cast_charp(luaM_newobject(L, novariant(tt), sz)); 251 char *p = cast_charp(luaM_newobject(L, novariant(tt), sz));
252 GCObject *o = cast(GCObject *, p + offset); 252 GCObject *o = cast(GCObject *, p + offset);
@@ -262,7 +262,7 @@ GCObject *luaC_newobjdt (lua_State *L, int tt, size_t sz, size_t offset) {
262/* 262/*
263** create a new collectable object with no offset. 263** create a new collectable object with no offset.
264*/ 264*/
265GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { 265GCObject *luaC_newobj (lua_State *L, lu_byte tt, size_t sz) {
266 return luaC_newobjdt(L, tt, sz, 0); 266 return luaC_newobjdt(L, tt, sz, 0);
267} 267}
268 268
@@ -813,7 +813,7 @@ static void freeobj (lua_State *L, GCObject *o) {
813 case LUA_VSHRSTR: { 813 case LUA_VSHRSTR: {
814 TString *ts = gco2ts(o); 814 TString *ts = gco2ts(o);
815 luaS_remove(L, ts); /* remove it from hash table */ 815 luaS_remove(L, ts); /* remove it from hash table */
816 luaM_freemem(L, ts, sizestrshr(ts->shrlen)); 816 luaM_freemem(L, ts, sizestrshr(cast_uint(ts->shrlen)));
817 break; 817 break;
818 } 818 }
819 case LUA_VLNGSTR: { 819 case LUA_VLNGSTR: {
@@ -922,7 +922,7 @@ static void GCTM (lua_State *L) {
922 if (!notm(tm)) { /* is there a finalizer? */ 922 if (!notm(tm)) { /* is there a finalizer? */
923 int status; 923 int status;
924 lu_byte oldah = L->allowhook; 924 lu_byte oldah = L->allowhook;
925 int oldgcstp = g->gcstp; 925 lu_byte oldgcstp = g->gcstp;
926 g->gcstp |= GCSTPGC; /* avoid GC steps */ 926 g->gcstp |= GCSTPGC; /* avoid GC steps */
927 L->allowhook = 0; /* stop debug hooks during GC metamethod */ 927 L->allowhook = 0; /* stop debug hooks during GC metamethod */
928 setobj2s(L, L->top.p++, tm); /* push finalizer... */ 928 setobj2s(L, L->top.p++, tm); /* push finalizer... */
@@ -1235,7 +1235,7 @@ static void finishgencycle (lua_State *L, global_State *g) {
1235** the "sweep all" state to clear all objects, which are mostly black 1235** the "sweep all" state to clear all objects, which are mostly black
1236** in generational mode. 1236** in generational mode.
1237*/ 1237*/
1238static void minor2inc (lua_State *L, global_State *g, int kind) { 1238static void minor2inc (lua_State *L, global_State *g, lu_byte kind) {
1239 g->GCmajorminor = g->marked; /* number of live objects */ 1239 g->GCmajorminor = g->marked; /* number of live objects */
1240 g->gckind = kind; 1240 g->gckind = kind;
1241 g->reallyold = g->old1 = g->survival = NULL; 1241 g->reallyold = g->old1 = g->survival = NULL;
@@ -1522,7 +1522,7 @@ static l_obj atomic (lua_State *L) {
1522** elements. The fast case sweeps the whole list. 1522** elements. The fast case sweeps the whole list.
1523*/ 1523*/
1524static void sweepstep (lua_State *L, global_State *g, 1524static void sweepstep (lua_State *L, global_State *g,
1525 int nextstate, GCObject **nextlist, int fast) { 1525 lu_byte nextstate, GCObject **nextlist, int fast) {
1526 if (g->sweepgc) 1526 if (g->sweepgc)
1527 g->sweepgc = sweeplist(L, g->sweepgc, fast ? MAX_LOBJ : GCSWEEPMAX); 1527 g->sweepgc = sweeplist(L, g->sweepgc, fast ? MAX_LOBJ : GCSWEEPMAX);
1528 else { /* enter next state */ 1528 else { /* enter next state */
@@ -1706,7 +1706,7 @@ static void fullinc (lua_State *L, global_State *g) {
1706void luaC_fullgc (lua_State *L, int isemergency) { 1706void luaC_fullgc (lua_State *L, int isemergency) {
1707 global_State *g = G(L); 1707 global_State *g = G(L);
1708 lua_assert(!g->gcemergency); 1708 lua_assert(!g->gcemergency);
1709 g->gcemergency = isemergency; /* set flag */ 1709 g->gcemergency = cast_byte(isemergency); /* set flag */
1710 switch (g->gckind) { 1710 switch (g->gckind) {
1711 case KGC_GENMINOR: fullgen(L, g); break; 1711 case KGC_GENMINOR: fullgen(L, g); break;
1712 case KGC_INC: fullinc(L, g); break; 1712 case KGC_INC: fullinc(L, g); break;