Lua diffu-lua-5.4.0-alpha-rc1-rc2


README

@@ -1,5 +1,5 @@
 
-This is Lua 5.4.0 (alpha), released on 29 May 2019.
+This is Lua 5.4.0 (alpha), released on 06 Jun 2019.
 
 For installation instructions, license details, and
 further information about Lua, see doc/readme.html.

doc/contents.html

@@ -173,9 +173,9 @@
 
 <P>
 <A HREF="manual.html#6.2">coroutine</A><BR>
+<A HREF="manual.html#pdf-coroutine.close">coroutine.close</A><BR>
 <A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR>
 <A HREF="manual.html#pdf-coroutine.isyieldable">coroutine.isyieldable</A><BR>
-<A HREF="manual.html#pdf-coroutine.kill">coroutine.kill</A><BR>
 <A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR>
 <A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR>
 <A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR>

@@ -623,7 +623,7 @@
 
 <P CLASS="footer">
 Last update:
-Wed May 29 08:06:44 -03 2019
+Wed Jun  5 21:27:06 -03 2019
 </P>
 <!--
 Last change: revised for Lua 5.4.0 (alpha)

doc/manual.html

@@ -781,19 +781,7 @@
 the collector does a <em>major</em> collection,
 which traverses all objects.
 The generational mode uses two parameters:
-the <em>major multiplier</em> and the <em>the minor multiplier</em>.
-
-
-<p>
-The major multiplier controls the frequency of major collections.
-For a major multiplier <em>x</em>,
-a new major collection will be done when memory
-grows <em>x%</em> larger than the memory in use after the previous major
-collection.
-For instance, for a multiplier of 100,
-the collector will do a major collection when the use of memory
-gets larger than twice the use after the previous collection.
-The default value is 100; the maximum value is 1000.
+the <em>minor multiplier</em> and the <em>the major multiplier</em>.
 
 
 <p>

@@ -808,6 +796,18 @@
 The default value is 20; the maximum value is 200.
 
 
+<p>
+The major multiplier controls the frequency of major collections.
+For a major multiplier <em>x</em>,
+a new major collection will be done when memory
+grows <em>x%</em> larger than the memory in use after the previous major
+collection.
+For instance, for a multiplier of 100,
+the collector will do a major collection when the use of memory
+gets larger than twice the use after the previous collection.
+The default value is 100; the maximum value is 1000.
+
+
 
 
 

@@ -1061,7 +1061,7 @@
 the function created by <a href="#pdf-coroutine.wrap"><code>coroutine.wrap</code></a>
 propagates any error to the caller.
 In this case,
-the function also kills the coroutine (see <a href="#pdf-coroutine.kill"><code>coroutine.kill</code></a>).
+the function also closes the coroutine (see <a href="#pdf-coroutine.close"><code>coroutine.close</code></a>).
 
 
 <p>

@@ -1839,7 +1839,7 @@
 <code>const</code>, which declares a constant variable,
 that is, a variable that cannot be assigned to
 after its initialization;
-and <code>toclose</code>, wich declares a to-be-closed variable (see <a href="#3.3.8">&sect;3.3.8</a>).
+and <code>toclose</code>, which declares a to-be-closed variable (see <a href="#3.3.8">&sect;3.3.8</a>).
 
 
 <p>

@@ -1885,25 +1885,34 @@
 <p>
 If several to-be-closed variables go out of scope at the same event,
 they are closed in the reverse order that they were declared.
+
+
+<p>
 If there is any error while running a closing method,
 that error is handled like an error in the regular code
 where the variable was defined;
 in particular,
 the other pending closing methods will still be called.
+After an error,
+other errors in closing methods
+interrupt the respective method,
+but are otherwise ignored;
+the error reported is the original one.
 
 
 <p>
 If a coroutine yields inside a block and is never resumed again,
 the variables visible at that block will never go out of scope,
-and therefore they will not be closed.
+and therefore they will never be closed.
 Similarly, if a coroutine ends with an error,
 it does not unwind its stack,
 so it does not close any variable.
-You should either use finalizers
-or call <a href="#pdf-coroutine.kill"><code>coroutine.kill</code></a> to close the variables in these cases.
-However, note that if the coroutine was created
+In both cases,
+you should either use finalizers
+or call <a href="#pdf-coroutine.close"><code>coroutine.close</code></a> to close the variables.
+However, if the coroutine was created
 through <a href="#pdf-coroutine.wrap"><code>coroutine.wrap</code></a>,
-then its corresponding function will close all variables
+then its corresponding function will close the coroutine
 in case of errors.
 
 

@@ -3676,7 +3685,7 @@
 
 <hr><h3><a name="lua_gc"><code>lua_gc</code></a></h3><p>
 <span class="apii">[-0, +0, &ndash;]</span>
-<pre>int lua_gc (lua_State *L, int what, int data);</pre>
+<pre>int lua_gc (lua_State *L, int what, ...);</pre>
 
 <p>
 Controls the garbage collector.

@@ -3684,50 +3693,53 @@
 
 <p>
 This function performs several tasks,
-according to the value of the parameter <code>what</code>:
+according to the value of the parameter <code>what</code>.
+For options that need extra arguments,
+they are listed after the option.
 
 <ul>
 
-<li><b><code>LUA_GCSTOP</code>: </b>
-stops the garbage collector.
+<li><b><code>LUA_GCCOLLECT</code>: </b>
+Performs a full garbage-collection cycle.
 </li>
 
-<li><b><code>LUA_GCRESTART</code>: </b>
-restarts the garbage collector.
+<li><b><code>LUA_GCSTOP</code>: </b>
+Stops the garbage collector.
 </li>
 
-<li><b><code>LUA_GCCOLLECT</code>: </b>
-performs a full garbage-collection cycle.
+<li><b><code>LUA_GCRESTART</code>: </b>
+Restarts the garbage collector.
 </li>
 
 <li><b><code>LUA_GCCOUNT</code>: </b>
-returns the current amount of memory (in Kbytes) in use by Lua.
+Returns the current amount of memory (in Kbytes) in use by Lua.
 </li>
 
 <li><b><code>LUA_GCCOUNTB</code>: </b>
-returns the remainder of dividing the current amount of bytes of
+Returns the remainder of dividing the current amount of bytes of
 memory in use by Lua by 1024.
 </li>
 
-<li><b><code>LUA_GCSTEP</code>: </b>
-performs an incremental step of garbage collection.
+<li><b><code>LUA_GCSTEP</code> <code>(int stepsize)</code>: </b>
+Performs an incremental step of garbage collection,
+corresponding to the allocation of <code>stepsize</code> Kbytes.
 </li>
 
-<li><b><code>LUA_GCSETPAUSE</code>: </b>
-sets <code>data</code> as the new value
-for the <em>pause</em> of the collector (see <a href="#2.5">&sect;2.5</a>)
-and returns the previous value of the pause.
+<li><b><code>LUA_GCISRUNNING</code>: </b>
+Returns a boolean that tells whether the collector is running
+(i.e., not stopped).
 </li>
 
-<li><b><code>LUA_GCSETSTEPMUL</code>: </b>
-sets <code>data</code> as the new value for the <em>step multiplier</em> of
-the collector (see <a href="#2.5">&sect;2.5</a>)
-and returns the previous value of the step multiplier.
+<li><b><code>LUA_GCINC</code> (int pause, int stepmul, stepsize): </b>
+Changes the collector to incremental mode
+with the given parameters (see <a href="#2.5.1">&sect;2.5.1</a>).
+Returns the previous mode (<code>LUA_GCGEN</code> or <code>LUA_GCINC</code>).
 </li>
 
-<li><b><code>LUA_GCISRUNNING</code>: </b>
-returns a boolean that tells whether the collector is running
-(i.e., not stopped).
+<li><b><code>LUA_GCGEN</code> (int minormul, int majormul): </b>
+Changes the collector to generational mode
+with the given parameters (see <a href="#2.5.2">&sect;2.5.2</a>).
+Returns the previous mode (<code>LUA_GCGEN</code> or <code>LUA_GCINC</code>).
 </li>
 
 </ul><p>

@@ -4254,7 +4266,6 @@
 
 
 <p>
-There is no explicit function to close or to destroy a thread.
 Threads are subject to garbage collection,
 like any Lua object.
 

@@ -4938,7 +4949,7 @@
 <a href="#pdf-LUA_OK"><code>LUA_OK</code></a> for no errors in closing methods,
 or an error status otherwise.
 In case of error,
-leave the error object on the stack,
+leaves the error object on the top of the stack,
 
 
 

@@ -7586,42 +7597,41 @@
 <ul>
 
 <li><b>"<code>collect</code>": </b>
-performs a full garbage-collection cycle.
+Performs a full garbage-collection cycle.
 This is the default option.
 </li>
 
 <li><b>"<code>stop</code>": </b>
-stops automatic execution of the garbage collector.
+Stops automatic execution of the garbage collector.
 The collector will run only when explicitly invoked,
 until a call to restart it.
 </li>
 
 <li><b>"<code>restart</code>": </b>
-restarts automatic execution of the garbage collector.
+Restarts automatic execution of the garbage collector.
 </li>
 
 <li><b>"<code>count</code>": </b>
-returns the total memory in use by Lua in Kbytes.
+Returns the total memory in use by Lua in Kbytes.
 The value has a fractional part,
 so that it multiplied by 1024
 gives the exact number of bytes in use by Lua.
 </li>
 
 <li><b>"<code>step</code>": </b>
-performs a garbage-collection step.
+Performs a garbage-collection step.
 The step "size" is controlled by <code>arg</code>.
 With a zero value,
 the collector will perform one basic (indivisible) step.
 For non-zero values,
 the collector will perform as if that amount of memory
-(in KBytes) had been allocated by Lua.
+(in Kbytes) had been allocated by Lua.
 Returns <b>true</b> if the step finished a collection cycle.
 </li>
 
-<li><b>"<code>setpause</code>": </b>
-sets <code>arg</code> as the new value for the <em>pause</em> of
-the collector (see <a href="#2.5">&sect;2.5</a>).
-Returns the previous value for <em>pause</em>.
+<li><b>"<code>isrunning</code>": </b>
+Returns a boolean that tells whether the collector is running
+(i.e., not stopped).
 </li>
 
 <li><b>"<code>incremental</code>": </b>

@@ -7629,7 +7639,7 @@
 This option can be followed by three numbers:
 the garbage-collector pause,
 the step multiplier,
-and the step size.
+and the step size (see <a href="#2.5.1">&sect;2.5.1</a>).
 A zero means to not change that value.
 </li>
 

@@ -7637,15 +7647,10 @@
 Change the collector mode to generational.
 This option can be followed by two numbers:
 the garbage-collector minor multiplier
-and the major multiplier.
+and the major multiplier (see <a href="#2.5.2">&sect;2.5.2</a>).
 A zero means to not change that value.
 </li>
 
-<li><b>"<code>isrunning</code>": </b>
-returns a boolean that tells whether the collector is running
-(i.e., not stopped).
-</li>
-
 </ul><p>
 See <a href="#2.5">&sect;2.5</a> for more details about garbage collection
 and some of these options.

@@ -8076,14 +8081,12 @@
 
 
 <p>
-<hr><h3><a name="pdf-warn"><code>warn (message [, tocont])</code></a></h3>
+<hr><h3><a name="pdf-warn"><code>warn (msg1, &middot;&middot;&middot;)</code></a></h3>
 
 
 <p>
-Emits a warning with the given message.
-A message in a call with <code>tocont</code> true should be
-continued in another call to this function.
-The default for <code>tocont</code> is false.
+Emits a warning with a message composed by the concatenation
+of all its arguments (which should be strings).
 
 
 

@@ -8111,6 +8114,23 @@
 
 
 <p>
+<hr><h3><a name="pdf-coroutine.close"><code>coroutine.close (co)</code></a></h3>
+
+
+<p>
+Closes coroutine <code>co</code>,
+that is,
+closes all its pending to-be-closed variables
+and puts the coroutine in a dead state.
+The given coroutine must be dead or suspended.
+In case of error closing some variable,
+returns <b>false</b> plus the error object;
+otherwise returns <b>true</b>.
+
+
+
+
+<p>
 <hr><h3><a name="pdf-coroutine.create"><code>coroutine.create (f)</code></a></h3>
 
 

@@ -8140,21 +8160,6 @@
 
 
 <p>
-<hr><h3><a name="pdf-coroutine.kill"><code>coroutine.kill (co)</code></a></h3>
-
-
-<p>
-Kills coroutine <code>co</code>,
-closing all its pending to-be-closed variables
-and putting the coroutine in a dead state.
-In case of error closing some variable,
-returns <b>false</b> plus the error object;
-otherwise returns <b>true</b>.
-
-
-
-
-<p>
 <hr><h3><a name="pdf-coroutine.resume"><code>coroutine.resume (co [, val1, &middot;&middot;&middot;])</code></a></h3>
 
 

@@ -8199,7 +8204,8 @@
 <p>
 Returns the status of the coroutine <code>co</code>, as a string:
 <code>"running"</code>,
-if the coroutine is running (that is, it called <code>status</code>);
+if the coroutine is running
+(that is, it is the one that called <code>status</code>);
 <code>"suspended"</code>, if the coroutine is suspended in a call to <code>yield</code>,
 or if it has not started running yet;
 <code>"normal"</code> if the coroutine is active but not running

@@ -8223,7 +8229,7 @@
 The function returns the same values returned by <code>resume</code>,
 except the first boolean.
 In case of error,
-the function kills the coroutine and propagates the error.
+the function closes the coroutine and propagates the error.
 
 
 

@@ -11396,6 +11402,12 @@
 An extra parameter in these functions makes them more permissive.
 </li>
 
+<li>
+The options "<code>setpause</code>" and "<code>setstepmul</code>"
+of the function <a href="#pdf-collectgarbage"><code>collectgarbage</code></a> are deprecated.
+You should use the new option "<code>incremental</code>" to set them.
+</li>
+
 </ul>
 
 

@@ -11445,6 +11457,12 @@
 instead, they generate a warning.
 </li>
 
+<li>
+The options <code>LUA_GCSETPAUSE</code> and <code>LUA_GCSETSTEPMUL</code>
+of the function <a href="#lua_gc"><code>lua_gc</code></a> are deprecated.
+You should use the new option <code>LUA_GCINC</code> to set them.
+</li>
+
 </ul>
 
 

@@ -11544,7 +11562,7 @@
 
 <P CLASS="footer">
 Last update:
-Wed May 29 08:06:33 -03 2019
+Thu Jun  6 15:59:35 -03 2019
 </P>
 <!--
 Last change: revised for Lua 5.4.0 (alpha)

doc/readme.html

@@ -277,8 +277,8 @@
 <LI> debug information about function arguments and returns
 <LI> new semantics for the integer 'for' loop
 <LI> optional 'init' argument to 'string.gmatch'
-<LI> new functions 'lua_resetthread' and 'coroutine.kill'
-<LI> coersions string->number moved to the string library
+<LI> new functions 'lua_resetthread' and 'coroutine.close'
+<LI> coersions string-to-number moved to the string library
 <LI> allocation function allowed to fail when shrinking a memory block
 <LI> new format '%p' in 'string.format'
 <LI> utf8 library accepts codepoints up to 2^31

@@ -329,7 +329,7 @@
 
 <P CLASS="footer">
 Last update:
-Wed May 29 16:02:01 BRT 2019
+Thu Jun  6 10:58:49 -03 2019
 </P>
 <!--
 Last change: revised for Lua 5.4.0 (alpha)

src/lbaselib.c

@@ -37,9 +37,20 @@
 }
 
 
+/*
+** Creates a warning with all given arguments.
+** Check first for errors; otherwise an error may interrupt
+** the composition of a warning, leaving it unfinished.
+*/
 static int luaB_warn (lua_State *L) {
-  const char *msg = luaL_checkstring(L, 1);
-  lua_warning(L, msg, lua_toboolean(L, 2));
+  int n = lua_gettop(L);  /* number of arguments */
+  int i;
+  luaL_checkstring(L, 1);  /* at least one argument */
+  for (i = 2; i <= n; i++)
+    luaL_checkstring(L, i);  /* make sure all arguments are strings */
+  for (i = 1; i <= n; i++)  /* compose warning */
+    lua_warning(L, lua_tostring(L, i), 1);
+  lua_warning(L, "", 0);  /* close warning */
   return 0;
 }
 

src/lcorolib.c

@@ -75,11 +75,8 @@
   int r = auxresume(L, co, lua_gettop(L));
   if (r < 0) {
     int stat = lua_status(co);
-    if (stat != LUA_OK && stat != LUA_YIELD) {
-      stat = lua_resetthread(co);  /* close variables in case of errors */
-      if (stat != LUA_OK)  /* error closing variables? */
-        lua_xmove(co, L, 1);  /* get new error object */
-    }
+    if (stat != LUA_OK && stat != LUA_YIELD)
+      lua_resetthread(co);  /* close variables in case of errors */
     if (lua_type(L, -1) == LUA_TSTRING) {  /* error object is a string? */
       luaL_where(L, 1);  /* add extra info, if available */
       lua_insert(L, -2);

@@ -165,7 +162,7 @@
 }
 
 
-static int luaB_kill (lua_State *L) {
+static int luaB_close (lua_State *L) {
   lua_State *co = getco(L);
   int status = auxstatus(L, co);
   switch (status) {

@@ -182,7 +179,7 @@
       }
     }
     default:  /* normal or running coroutine */
-      return luaL_error(L, "cannot kill a %s coroutine", statname[status]);
+      return luaL_error(L, "cannot close a %s coroutine", statname[status]);
   }
 }
 

@@ -195,7 +192,7 @@
   {"wrap", luaB_cowrap},
   {"yield", luaB_yield},
   {"isyieldable", luaB_yieldable},
-  {"kill", luaB_kill},
+  {"close", luaB_close},
   {NULL, NULL}
 };
 

src/ldebug.c

@@ -373,6 +373,7 @@
           ar->ftransfer = ci->u2.transferinfo.ftransfer;
           ar->ntransfer = ci->u2.transferinfo.ntransfer;
         }
+        break;
       }
       case 'L':
       case 'f':  /* handled by lua_getinfo */

@@ -525,8 +526,8 @@
 }
 
 
- const char *getobjname (const Proto *p, int lastpc, int reg,
-                         const char **name) {
+static const char *getobjname (const Proto *p, int lastpc, int reg,
+                               const char **name) {
   int pc;
   *name = luaF_getlocalname(p, reg + 1, lastpc);
   if (*name)  /* is a local? */

src/lfunc.c

@@ -144,13 +144,16 @@
       luaG_runerror(L, "attempt to close non-closable variable '%s'", vname);
     }
   }
-  else {  /* there was an error */
+  else {  /* must close the object in protected mode */
+    ptrdiff_t oldtop = savestack(L, level + 1);
     /* save error message and set stack top to 'level + 1' */
     luaD_seterrorobj(L, status, level);
     if (prepclosingmethod(L, uv, s2v(level))) {  /* something to call? */
-      int newstatus = luaD_pcall(L, callclose, NULL, savestack(L, level), 0);
-      if (newstatus != LUA_OK)  /* another error when closing? */
+      int newstatus = luaD_pcall(L, callclose, NULL, oldtop, 0);
+      if (newstatus != LUA_OK && status == CLOSEPROTECT)  /* first error? */
         status = newstatus;  /* this will be the new error */
+      else  /* leave original error (or nil) on top */
+        L->top = restorestack(L, oldtop);
     }
     /* else no metamethod; ignore this case and keep original error */
   }

src/lgc.c

@@ -484,8 +484,8 @@
   const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
   markobjectN(g, h->metatable);
   if (mode && ttisstring(mode) &&  /* is there a weak mode? */
-      ((weakkey = strchr(svalue(mode), 'k')),
-       (weakvalue = strchr(svalue(mode), 'v')),
+      (cast_void(weakkey = strchr(svalue(mode), 'k')),
+       cast_void(weakvalue = strchr(svalue(mode), 'v')),
        (weakkey || weakvalue))) {  /* is really weak? */
     black2gray(h);  /* keep table gray */
     if (!weakkey)  /* strong keys? */

src/llex.c

@@ -29,7 +29,7 @@
 
 
 
-#define next(ls) (ls->current = zgetc(ls->z))
+#define next(ls)	(ls->current = zgetc(ls->z))
 
 
 

@@ -337,7 +337,7 @@
   save_and_next(ls);  /* skip 'u' */
   esccheck(ls, ls->current == '{', "missing '{'");
   r = gethexa(ls);  /* must have at least one digit */
-  while ((save_and_next(ls), lisxdigit(ls->current))) {
+  while (cast_void(save_and_next(ls)), lisxdigit(ls->current)) {
     i++;
     esccheck(ls, r <= (0x7FFFFFFFu >> 4), "UTF-8 value too large");
     r = (r << 4) + luaO_hexavalue(ls->current);

src/lobject.c

@@ -366,8 +366,8 @@
 /*
 ** Convert a number object to a string, adding it to a buffer
 */
-static size_t tostringbuff (TValue *obj, char *buff) {
-  size_t len;
+static int tostringbuff (TValue *obj, char *buff) {
+  int len;
   lua_assert(ttisnumber(obj));
   if (ttisinteger(obj))
     len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj));

@@ -387,7 +387,7 @@
 */
 void luaO_tostring (lua_State *L, TValue *obj) {
   char buff[MAXNUMBER2STR];
-  size_t len = tostringbuff(obj, buff);
+  int len = tostringbuff(obj, buff);
   setsvalue(L, obj, luaS_newlstr(L, buff, len));
 }
 

@@ -439,11 +439,11 @@
 
 /*
 ** Get a space of size 'sz' in the buffer. If buffer has not enough
-** space, empty it. 'sz' must fit in an empty space.
+** space, empty it. 'sz' must fit in an empty buffer.
 */
-static char *getbuff (BuffFS *buff, size_t sz) {
+static char *getbuff (BuffFS *buff, int sz) {
   lua_assert(buff->blen <= BUFVFS); lua_assert(sz <= BUFVFS);
-  if (sz > BUFVFS - cast_sizet(buff->blen))  /* string does not fit? */
+  if (sz > BUFVFS - buff->blen)  /* not enough space? */
     clearbuff(buff);
   return buff->space + buff->blen;
 }

@@ -458,9 +458,9 @@
 */
 static void addstr2buff (BuffFS *buff, const char *str, size_t slen) {
   if (slen <= BUFVFS) {  /* does string fit into buffer? */
-    char *bf = getbuff(buff, slen);
+    char *bf = getbuff(buff, cast_int(slen));
     memcpy(bf, str, slen);  /* add string to buffer */
-    addsize(buff, slen);
+    addsize(buff, cast_int(slen));
   }
   else {  /* string larger than buffer */
     clearbuff(buff);  /* string comes after buffer's content */

@@ -474,7 +474,7 @@
 */
 static void addnum2buff (BuffFS *buff, TValue *num) {
   char *numbuff = getbuff(buff, MAXNUMBER2STR);
-  size_t len = tostringbuff(num, numbuff);  /* format number into 'numbuff' */
+  int len = tostringbuff(num, numbuff);  /* format number into 'numbuff' */
   addsize(buff, len);
 }
 

src/lstring.c

@@ -121,8 +121,8 @@
   int i, j;
   for (i = 0; i < STRCACHE_N; i++)
     for (j = 0; j < STRCACHE_M; j++) {
-    if (iswhite(g->strcache[i][j]))  /* will entry be collected? */
-      g->strcache[i][j] = g->memerrmsg;  /* replace it with something fixed */
+      if (iswhite(g->strcache[i][j]))  /* will entry be collected? */
+        g->strcache[i][j] = g->memerrmsg;  /* replace it with something fixed */
     }
 }
 

src/ltablib.c

@@ -306,7 +306,7 @@
     }
     /* after the loop, a[i] >= P and a[lo .. i - 1] < P */
     /* next loop: repeat --j while P < a[j] */
-    while (lua_geti(L, 1, --j), sort_comp(L, -3, -1)) {
+    while ((void)lua_geti(L, 1, --j), sort_comp(L, -3, -1)) {
       if (j < i)  /* j < i  but  a[j] > P ?? */
         luaL_error(L, "invalid order function for sorting");
       lua_pop(L, 1);  /* remove a[j] */

src/lvm.c

@@ -1151,7 +1151,7 @@
         TValue *rc = vRC(i);
         lua_Unsigned n;
         if (ttisinteger(rc)  /* fast track for integers? */
-            ? (n = ivalue(rc), luaV_fastgeti(L, rb, n, slot))
+            ? (cast_void(n = ivalue(rc)), luaV_fastgeti(L, rb, n, slot))
             : luaV_fastget(L, rb, rc, slot, luaH_get)) {
           setobj2s(L, ra, slot);
         }

@@ -1204,7 +1204,7 @@
         TValue *rc = RKC(i);  /* value */
         lua_Unsigned n;
         if (ttisinteger(rb)  /* fast track for integers? */
-            ? (n = ivalue(rb), luaV_fastgeti(L, s2v(ra), n, slot))
+            ? (cast_void(n = ivalue(rb)), luaV_fastgeti(L, s2v(ra), n, slot))
             : luaV_fastget(L, s2v(ra), rb, slot, luaH_get)) {
           luaV_finishfastset(L, s2v(ra), slot, rc);
         }

@@ -1593,9 +1593,9 @@
         savepc(ci);
         if (TESTARG_k(i)) {
           int nparams1 = GETARG_C(i);
+          luaF_close(L, base, LUA_OK);  /* there may be open upvalues */
           if (nparams1)  /* vararg function? */
             ci->func -= ci->u.l.nextraargs + nparams1;
-          luaF_close(L, base, LUA_OK);  /* there may be open upvalues */
         }
         luaD_poscall(L, ci, n);
         return;