lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




Le mer. 2 oct. 2019 à 23:54, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> a écrit :
Lua 5.4.0 (beta) is now available for testing at
        http://www.lua.org/work/lua-5.4.0-beta-rc1.tar.gz

The checksums are
        MD5     eb6b27dfd42fb47aec5d1516c3487c68  -
        SHA1    0813c72e04a349cf3623c7d44b7fd0abafe92fd7  -

This is an beta version. Some details may change in the final version.

The main changes in Lua 5.4.0 are listed at
        http://www.lua.org/work/doc/#changes

An updated reference manual is included and also available at
        http://www.lua.org/work/doc

The complete diffs from alpha to beta-rc1 are available at
        http://www.lua.org/work/diffs-lua-5.4.0-alpha-beta-rc1.html
        http://www.lua.org/work/diffu-lua-5.4.0-alpha-beta-rc1.html

A test suite is available at
        http://www.lua.org/work/lua-5.4.0-beta-tests.tar.gz

If your platform is a common Unix-like platform, just do
        make guess
The Makefile will guess your platform using uname and build Lua for it.
We welcome feedback on this, which is new, especially more uname targets
with explicit rules and fixes for existing ones.

We also welcome feedback on the listings output by luac -l -l, because
luac has been rewritten to account for the new VM instructions.

All feedback welcome. Thanks.

find in attachment some fixes for minor issues (found with a linter).

François
 
--lhf

const

diff --git a/src/lcorolib.c b/src/lcorolib.c
index 4d47ea2..a6896ad 100644
--- a/src/lcorolib.c
+++ b/src/lcorolib.c
@@ -116,7 +116,7 @@ static int luaB_yield (lua_State *L) {
 #define COS_NORM	3
 
 
-static const char *statname[] = {"running", "dead", "suspended", "normal"};
+static const char *const statname[] = {"running", "dead", "suspended", "normal"};
 
 
 static int auxstatus (lua_State *L, lua_State *co) {
diff --git a/src/ldblib.c b/src/ldblib.c
index a9a84c5..fc164a8 100644
--- a/src/ldblib.c
+++ b/src/ldblib.c
@@ -24,7 +24,7 @@
 ** The hook table at registry[HOOKKEY] maps threads to their current
 ** hook function.
 */
-static const char* HOOKKEY = "_HOOKKEY";
+static const char* const HOOKKEY = "_HOOKKEY";
 
 
 /*
diff --git a/src/lgc.c b/src/lgc.c
index f24074f..cf62a45 100644
--- a/src/lgc.c
+++ b/src/lgc.c
@@ -998,7 +998,7 @@ static void sweep2old (lua_State *L, GCObject **p) {
 */
 static GCObject **sweepgen (lua_State *L, global_State *g, GCObject **p,
                             GCObject *limit) {
-  static lu_byte nextage[] = {
+  static const lu_byte nextage[] = {
     G_SURVIVAL,  /* from G_NEW */
     G_OLD1,      /* from G_SURVIVAL */
     G_OLD1,      /* from G_OLD0 */
diff --git a/src/loadlib.c b/src/loadlib.c
index d7a3fb2..689767f 100644
--- a/src/loadlib.c
+++ b/src/loadlib.c
@@ -59,7 +59,7 @@
 ** key for table in the registry that keeps handles
 ** for all loaded C libraries
 */
-static const char *CLIBS = "_CLIBS";
+static const char *const CLIBS = "_CLIBS";
 
 #define LIB_FAIL	"open"
 
diff --git a/src/lparser.c b/src/lparser.c
index 2dcd320..8c81203 100644
--- a/src/lparser.c
+++ b/src/lparser.c
@@ -1523,8 +1523,8 @@ static void fixforjump (FuncState *fs, int pc, int dest, int back) {
 */
 static void forbody (LexState *ls, int base, int line, int nvars, int isgen) {
   /* forbody -> DO block */
-  static OpCode forprep[2] = {OP_FORPREP, OP_TFORPREP};
-  static OpCode forloop[2] = {OP_FORLOOP, OP_TFORLOOP};
+  static const OpCode forprep[2] = {OP_FORPREP, OP_TFORPREP};
+  static const OpCode forloop[2] = {OP_FORLOOP, OP_TFORLOOP};
   BlockCnt bl;
   FuncState *fs = ls->fs;
   int prep, endfor;
-- 
switch

diff --git a/src/luac.c b/src/luac.c
index c79543c..517f365 100644
--- a/src/luac.c
+++ b/src/luac.c
@@ -508,8 +508,8 @@ static void PrintCode(const Proto* f)
 	break;
    case OP_MMBIN:
 	printf("%d %d %d",a,b,c);
-	break;
 	printf(COMMENT); printf("%s ",eventname(c));
+	break;
    case OP_MMBINI:
 	printf("%d %d %d",a,sb,c);
 	printf(COMMENT); printf("%s ",eventname(c));
--