diff --git a/lcode.c b/lcode.c index 641f0d09..8c04d8ab 100644 --- a/lcode.c +++ b/lcode.c @@ -1439,7 +1439,7 @@ static void finishbinexpval (FuncState *fs, expdesc *e1, expdesc *e2, e1->u.info = pc; e1->k = VRELOC; /* all those operations are relocatable */ luaK_fixline(fs, line); - luaK_codeABCk(fs, mmop, v1, v2, event, flip); /* to call metamethod */ + luaK_codeABCk(fs, mmop, v1, v2, cast_int(event), flip); /* metamethod */ luaK_fixline(fs, line); } diff --git a/llex.c b/llex.c index 3518f0da..1c4227ca 100644 --- a/llex.c +++ b/llex.c @@ -349,9 +349,14 @@ static int readhexaesc (LexState *ls) { } +/* +** When reading a UTF-8 escape sequence, save everything to the buffer +** for error reporting in case of errors; 'i' counts the number of +** saved characters, so that they can be removed if case of success. +*/ static unsigned long readutf8esc (LexState *ls) { unsigned long r; - int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ + int i = 4; /* number of chars to be removed: start with #"\u{X" */ save_and_next(ls); /* skip 'u' */ esccheck(ls, ls->current == '{', "missing '{'"); r = cast_ulong(gethexa(ls)); /* must have at least one digit */ diff --git a/lmem.h b/lmem.h index 204ce3bc..08358592 100644 --- a/lmem.h +++ b/lmem.h @@ -39,11 +39,11 @@ ** Computes the minimum between 'n' and 'MAX_SIZET/sizeof(t)', so that ** the result is not larger than 'n' and cannot overflow a 'size_t' ** when multiplied by the size of type 't'. (Assumes that 'n' is an -** 'int' or 'unsigned int' and that 'int' is not larger than 'size_t'.) +** 'int' and that 'int' is not larger than 'size_t'.) */ #define luaM_limitN(n,t) \ ((cast_sizet(n) <= MAX_SIZET/sizeof(t)) ? (n) : \ - cast_uint((MAX_SIZET/sizeof(t)))) + cast_int((MAX_SIZET/sizeof(t)))) /* diff --git a/lobject.c b/lobject.c index 97dacaf5..c0fd182f 100644 --- a/lobject.c +++ b/lobject.c @@ -194,6 +194,7 @@ void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, lu_byte luaO_hexavalue (int c) { + lua_assert(lisxdigit(c)); if (lisdigit(c)) return cast_byte(c - '0'); else return cast_byte((ltolower(c) - 'a') + 10); } diff --git a/lparser.c b/lparser.c index 83e341ed..380e45f5 100644 --- a/lparser.c +++ b/lparser.c @@ -405,7 +405,7 @@ static int searchvar (FuncState *fs, TString *n, expdesc *var) { init_exp(var, VCONST, fs->firstlocal + i); else /* real variable */ init_var(fs, var, i); - return var->k; + return cast_int(var->k); } } return -1; /* not found */ diff --git a/ltable.c b/ltable.c index b6b1fa1a..122b7f17 100644 --- a/ltable.c +++ b/ltable.c @@ -96,7 +96,7 @@ typedef union { ** between 2^MAXHBITS and the maximum size such that, measured in bytes, ** it fits in a 'size_t'. */ -#define MAXHSIZE luaM_limitN(1u << MAXHBITS, Node) +#define MAXHSIZE luaM_limitN(1 << MAXHBITS, Node) /* @@ -598,7 +598,7 @@ static void setnodevector (lua_State *L, Table *t, unsigned size) { else { int i; int lsize = luaO_ceillog2(size); - if (lsize > MAXHBITS || (1u << lsize) > MAXHSIZE) + if (lsize > MAXHBITS || (1 << lsize) > MAXHSIZE) luaG_runerror(L, "table overflow"); size = twoto(lsize); if (lsize < LIMFORLAST) /* no 'lastfree' field? */ diff --git a/makefile b/makefile index 64dee501..8506e93c 100644 --- a/makefile +++ b/makefile @@ -15,7 +15,6 @@ CWARNSCPP= \ -Wdouble-promotion \ -Wmissing-declarations \ -Wconversion \ - -Wuninitialized \ -Wstrict-overflow=2 \ # the next warnings might be useful sometimes, # but usually they generate too much noise diff --git a/manual/manual.of b/manual/manual.of index bb95148a..77e37de3 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -3848,7 +3848,6 @@ or zero if the value at @id{idx} is not a number. Calls a function (or a callable object) in protected mode. - Both @id{nargs} and @id{nresults} have the same meaning as in @Lid{lua_call}. If there are no errors during the call, @@ -3998,9 +3997,9 @@ Lua will call @id{falloc} before raising the error. Pushes onto the stack a formatted string and returns a pointer to this string @see{constchar}. The result is a copy of @id{fmt} with -each @emph{conversion specifier} replaced by its respective -extra argument. -A conversion specifier can be +each @emph{conversion specifier} replaced by a string representation +of its respective extra argument. +A conversion specifier (and its corresponding extra argument) can be @Char{%%} (inserts the character @Char{%}), @Char{%s} (inserts a zero-terminated string, with no size restrictions), @Char{%f} (inserts a @Lid{lua_Number}), diff --git a/testes/libs/makefile b/testes/libs/makefile index 9c0c4e3f..4e7f965e 100644 --- a/testes/libs/makefile +++ b/testes/libs/makefile @@ -5,7 +5,7 @@ LUA_DIR = ../../ CC = gcc # compilation should generate Dynamic-Link Libraries -CFLAGS = -Wall -std=gnu99 -O2 -I$(LUA_DIR) -fPIC -shared +CFLAGS = -Wall -std=c99 -O2 -I$(LUA_DIR) -fPIC -shared # libraries used by the tests all: lib1.so lib11.so lib2.so lib21.so lib2-v2.so