Added gcc option '-Wconversion'

No warnings for standard numerical types. Still pending alternative
numerical types.
This commit is contained in:
Roberto Ierusalimschy
2024-07-27 13:32:59 -03:00
parent 15231d4fb2
commit 0acd55898d
44 changed files with 398 additions and 359 deletions

View File

@@ -130,6 +130,7 @@ typedef LUAI_UACINT l_uacInt;
#define cast_num(i) cast(lua_Number, (i))
#define cast_int(i) cast(int, (i))
#define cast_uint(i) cast(unsigned int, (i))
#define cast_ulong(i) cast(unsigned long, (i))
#define cast_byte(i) cast(lu_byte, (i))
#define cast_uchar(i) cast(unsigned char, (i))
#define cast_char(i) cast(char, (i))
@@ -151,6 +152,16 @@ typedef LUAI_UACINT l_uacInt;
#define l_castU2S(i) ((lua_Integer)(i))
#endif
/*
** cast a size_t to lua_Integer: These casts are always valid for
** sizes of Lua objects (see MAX_SIZE)
*/
#define cast_st2S(sz) ((lua_Integer)(sz))
/* Cast a ptrdiff_t to size_t, when it is known that the minuend
** comes from the subtraend (the base)
*/
#define ct_diff2sz(df) ((size_t)(df))
/*
** Special type equivalent to '(void*)' for functions (to suppress some