From 0ddc0f47bd2a03678e1afbc384550aecb55a318f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 23 Apr 2020 14:48:15 -0300 Subject: [PATCH] Several details about 5.4.0 rc1 Corrected several small details: added 'const', adjusts in tabs x spaces, removed unused #includes and #defines, misspellings, etc. --- ljumptab.h | 2 +- lmathlib.c | 2 +- loadlib.c | 2 -- lobject.h | 3 +-- lopcodes.c | 2 -- lopcodes.h | 20 ++++++++++---------- lopnames.h | 3 +++ loslib.c | 2 +- lprefix.h | 2 +- ltable.h | 2 +- lvm.h | 4 ++-- manual/manual.of | 2 +- 12 files changed, 22 insertions(+), 24 deletions(-) diff --git a/ljumptab.h b/ljumptab.h index 0edd79d5..8306f250 100644 --- a/ljumptab.h +++ b/ljumptab.h @@ -16,7 +16,7 @@ #define vmbreak vmfetch(); vmdispatch(GET_OPCODE(i)); -static void *disptab[NUM_OPCODES] = { +static const void *const disptab[NUM_OPCODES] = { #if 0 ** you can update the following list with this command: diff --git a/lmathlib.c b/lmathlib.c index 63f6036a..86def470 100644 --- a/lmathlib.c +++ b/lmathlib.c @@ -328,7 +328,7 @@ static Rand64 nextrand (Rand64 *state) { */ /* must throw out the extra (64 - FIGS) bits */ -#define shift64_FIG (64 - FIGS) +#define shift64_FIG (64 - FIGS) /* to scale to [0, 1), multiply by scaleFIG = 2^(-FIGS) */ #define scaleFIG (l_mathop(0.5) / ((Rand64)1 << (FIGS - 1))) diff --git a/loadlib.c b/loadlib.c index 56167f64..9d86b158 100644 --- a/loadlib.c +++ b/loadlib.c @@ -269,8 +269,6 @@ static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { #endif -#define AUXMARK "\1" /* auxiliary mark */ - /* ** return registry.LUA_NOENV as a boolean diff --git a/lobject.h b/lobject.h index 428145a4..2d63c001 100644 --- a/lobject.h +++ b/lobject.h @@ -356,8 +356,7 @@ typedef struct GCObject { /* -** Header for string value; string bytes follow the end of this structure -** (aligned according to 'UTString'; see next). +** Header for string value; string bytes follow the end of this structure. */ typedef struct TString { CommonHeader; diff --git a/lopcodes.c b/lopcodes.c index 4e983e08..c67aa227 100644 --- a/lopcodes.c +++ b/lopcodes.c @@ -10,8 +10,6 @@ #include "lprefix.h" -#include - #include "lopcodes.h" diff --git a/lopcodes.h b/lopcodes.h index d3a3f08e..122e5d21 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -201,9 +201,9 @@ OP_MOVE,/* A B R[A] := R[B] */ OP_LOADI,/* A sBx R[A] := sBx */ OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */ OP_LOADK,/* A Bx R[A] := K[Bx] */ -OP_LOADKX,/* A R[A] := K[extra arg] */ -OP_LOADFALSE,/* A R[A] := false */ -OP_LFALSESKIP,/*A R[A] := false; pc++ */ +OP_LOADKX,/* A R[A] := K[extra arg] */ +OP_LOADFALSE,/* A R[A] := false */ +OP_LFALSESKIP,/*A R[A] := false; pc++ */ OP_LOADTRUE,/* A R[A] := true */ OP_LOADNIL,/* A B R[A], R[A+1], ..., R[A+B] := nil */ OP_GETUPVAL,/* A B R[A] := UpValue[B] */ @@ -263,11 +263,11 @@ OP_BNOT,/* A B R[A] := ~R[B] */ OP_NOT,/* A B R[A] := not R[B] */ OP_LEN,/* A B R[A] := length of R[B] */ -OP_CONCAT,/* A B R[A] := R[A].. ... ..R[A + B - 1] */ +OP_CONCAT,/* A B R[A] := R[A].. ... ..R[A + B - 1] */ OP_CLOSE,/* A close all upvalues >= R[A] */ OP_TBC,/* A mark variable A "to be closed" */ -OP_JMP,/* sJ pc += sJ */ +OP_JMP,/* sJ pc += sJ */ OP_EQ,/* A B k if ((R[A] == R[B]) ~= k) then pc++ */ OP_LT,/* A B k if ((R[A] < R[B]) ~= k) then pc++ */ OP_LE,/* A B k if ((R[A] <= R[B]) ~= k) then pc++ */ @@ -279,15 +279,15 @@ OP_LEI,/* A sB k if ((R[A] <= sB) ~= k) then pc++ */ OP_GTI,/* A sB k if ((R[A] > sB) ~= k) then pc++ */ OP_GEI,/* A sB k if ((R[A] >= sB) ~= k) then pc++ */ -OP_TEST,/* A k if (not R[A] == k) then pc++ */ +OP_TEST,/* A k if (not R[A] == k) then pc++ */ OP_TESTSET,/* A B k if (not R[B] == k) then pc++ else R[A] := R[B] */ OP_CALL,/* A B C R[A], ... ,R[A+C-2] := R[A](R[A+1], ... ,R[A+B-1]) */ OP_TAILCALL,/* A B C k return R[A](R[A+1], ... ,R[A+B-1]) */ OP_RETURN,/* A B C k return R[A], ... ,R[A+B-2] (see note) */ -OP_RETURN0,/* return */ -OP_RETURN1,/* A return R[A] */ +OP_RETURN0,/* return */ +OP_RETURN1,/* A return R[A] */ OP_FORLOOP,/* A Bx update counters; if loop continues then pc-=Bx; */ OP_FORPREP,/* A Bx ; @@ -301,9 +301,9 @@ OP_SETLIST,/* A B C k R[A][(C-1)*FPF+i] := R[A+i], 1 <= i <= B */ OP_CLOSURE,/* A Bx R[A] := closure(KPROTO[Bx]) */ -OP_VARARG,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */ +OP_VARARG,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */ -OP_VARARGPREP,/*A (adjust vararg parameters) */ +OP_VARARGPREP,/*A (adjust vararg parameters) */ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ } OpCode; diff --git a/lopnames.h b/lopnames.h index f20147e3..965cec9b 100644 --- a/lopnames.h +++ b/lopnames.h @@ -7,6 +7,9 @@ #if !defined(lopnames_h) #define lopnames_h +#include + + /* ORDER OP */ static const char *const opnames[] = { diff --git a/loslib.c b/loslib.c index 29449e40..5e0fafb4 100644 --- a/loslib.c +++ b/loslib.c @@ -91,7 +91,7 @@ /* ISO C definitions */ #define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) -#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) +#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) #endif /* } */ diff --git a/lprefix.h b/lprefix.h index dd14767e..484f2ad6 100644 --- a/lprefix.h +++ b/lprefix.h @@ -33,7 +33,7 @@ /* ** Windows stuff */ -#if defined(_WIN32) /* { */ +#if defined(_WIN32) /* { */ #if !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ diff --git a/ltable.h b/ltable.h index 9565833f..ebd7f8ec 100644 --- a/ltable.h +++ b/ltable.h @@ -27,7 +27,7 @@ /* returns the Node, given the value of a table entry */ -#define nodefromval(v) cast(Node *, (v)) +#define nodefromval(v) cast(Node *, (v)) LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); diff --git a/lvm.h b/lvm.h index 71038572..2d4ac160 100644 --- a/lvm.h +++ b/lvm.h @@ -41,9 +41,9 @@ ** Rounding modes for float->integer coercion */ typedef enum { - F2Ieq, /* no rounding; accepts only integral values */ + F2Ieq, /* no rounding; accepts only integral values */ F2Ifloor, /* takes the floor of the number */ - F2Iceil, /* takes the ceil of the number */ + F2Iceil /* takes the ceil of the number */ } F2Imod; diff --git a/manual/manual.of b/manual/manual.of index b237ad46..9eeb94aa 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -9013,7 +9013,7 @@ not a float. Literal decimal integer constants that overflow are read as floats, instead of wrapping around. You can use hexadecimal notation for such constants if you -want the old bevhavior +want the old behavior (reading them as integers with wrap around). }