3rdparty: Avoid the need for -fpermissive since clang doesn't like it.

I'll try to get some of this upstreamed.
This commit is contained in:
Vas Crabb 2023-03-07 04:19:36 +11:00
parent b5475eb38b
commit dc87571a43
5 changed files with 17 additions and 18 deletions

View file

@ -202,7 +202,7 @@ static int cmp_range(const void *key, const void *cm)
static int utf8_in_range(const struct utf8range *range, int num, int ch) static int utf8_in_range(const struct utf8range *range, int num, int ch)
{ {
const struct utf8range *r = const struct utf8range *r =
bsearch(&ch, range, num, sizeof(*range), cmp_range); (const struct utf8range *)bsearch(&ch, range, num, sizeof(*range), cmp_range);
if (r) { if (r) {
return 1; return 1;

View file

@ -175,7 +175,7 @@ static void vm_push_column(lua_State *L, sqlite3_stmt *vm, int idx) {
lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx)); lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx));
break; break;
case SQLITE_BLOB: case SQLITE_BLOB:
lua_pushlstring(L, sqlite3_column_blob(vm, idx), sqlite3_column_bytes(vm, idx)); lua_pushlstring(L, (const char*)sqlite3_column_blob(vm, idx), sqlite3_column_bytes(vm, idx));
break; break;
case SQLITE_NULL: case SQLITE_NULL:
lua_pushnil(L); lua_pushnil(L);
@ -667,7 +667,7 @@ static int cleanupdb(lua_State *L, sdb *db) {
top = lua_gettop(L); top = lua_gettop(L);
lua_pushnil(L); lua_pushnil(L);
while (lua_next(L, -2)) { while (lua_next(L, -2)) {
sdb_vm *svm = lua_touserdata(L, -2); /* key: vm; val: sql text */ sdb_vm *svm = (sdb_vm*)lua_touserdata(L, -2); /* key: vm; val: sql text */
cleanupvm(L, svm); cleanupvm(L, svm);
lua_settop(L, top); lua_settop(L, top);
@ -961,7 +961,7 @@ static void db_push_value(lua_State *L, sqlite3_value *value) {
break; break;
case SQLITE_BLOB: case SQLITE_BLOB:
lua_pushlstring(L, sqlite3_value_blob(value), sqlite3_value_bytes(value)); lua_pushlstring(L, (const char*)sqlite3_value_blob(value), sqlite3_value_bytes(value));
break; break;
case SQLITE_NULL: case SQLITE_NULL:
@ -1179,8 +1179,8 @@ static int collwrapper(scc *co,int l1,const void *p1,
int res=0; int res=0;
lua_State *L=co->L; lua_State *L=co->L;
lua_rawgeti(L,LUA_REGISTRYINDEX,co->ref); lua_rawgeti(L,LUA_REGISTRYINDEX,co->ref);
lua_pushlstring(L,p1,l1); lua_pushlstring(L,(const char*)p1,l1);
lua_pushlstring(L,p2,l2); lua_pushlstring(L,(const char*)p2,l2);
if (lua_pcall(L,2,1,0)==0) res=(int)lua_tonumber(L,-1); if (lua_pcall(L,2,1,0)==0) res=(int)lua_tonumber(L,-1);
lua_pop(L,1); lua_pop(L,1);
return res; return res;
@ -2001,7 +2001,7 @@ static int db_close_vm(lua_State *L) {
/* close all used handles */ /* close all used handles */
lua_pushnil(L); lua_pushnil(L);
while (lua_next(L, -2)) { while (lua_next(L, -2)) {
sdb_vm *svm = lua_touserdata(L, -2); /* key: vm; val: sql text */ sdb_vm *svm = (sdb_vm*)lua_touserdata(L, -2); /* key: vm; val: sql text */
if ((!temp || svm->temp) && svm->vm) if ((!temp || svm->temp) && svm->vm)
{ {
@ -2112,7 +2112,7 @@ static int lsqlite_open_ptr(lua_State *L) {
int rc; int rc;
luaL_checktype(L, 1, LUA_TLIGHTUSERDATA); luaL_checktype(L, 1, LUA_TLIGHTUSERDATA);
db_ptr = lua_touserdata(L, 1); db_ptr = (sqlite3*)lua_touserdata(L, 1);
/* This is the only API function that runs sqlite3SafetyCheck regardless of /* This is the only API function that runs sqlite3SafetyCheck regardless of
* SQLITE_ENABLE_API_ARMOR and does almost nothing (without an SQL * SQLITE_ENABLE_API_ARMOR and does almost nothing (without an SQL
* statement) */ * statement) */

View file

@ -353,8 +353,8 @@ static int lz_checksum(lua_State *L) {
} }
static int lz_checksum_new(lua_State *L, checksum_t checksum, checksum_combine_t combine) { static int lz_checksum_new(lua_State *L, checksum_t checksum, checksum_combine_t combine) {
lua_pushlightuserdata(L, checksum); lua_pushlightuserdata(L, (void *)checksum);
lua_pushlightuserdata(L, combine); lua_pushlightuserdata(L, (void *)combine);
lua_pushnumber(L, checksum(0L, Z_NULL, 0)); lua_pushnumber(L, checksum(0L, Z_NULL, 0));
lua_pushnumber(L, 0); lua_pushnumber(L, 0);
lua_pushcclosure(L, lz_checksum, 4); lua_pushcclosure(L, lz_checksum, 4);

View file

@ -288,7 +288,7 @@ static int get_dir(lua_State * L)
size_t size = LFS_MAXPATHLEN; /* initial buffer size */ size_t size = LFS_MAXPATHLEN; /* initial buffer size */
int result; int result;
while (1) { while (1) {
char *path2 = realloc(path, size); char *path2 = (char *)realloc(path, size);
if (!path2) { /* failed to allocate */ if (!path2) { /* failed to allocate */
result = pusherror(L, "get_dir realloc() failed"); result = pusherror(L, "get_dir realloc() failed");
break; break;
@ -1078,7 +1078,7 @@ static int push_link_target(lua_State * L)
int tsize, size = 256; /* size = initial buffer capacity */ int tsize, size = 256; /* size = initial buffer capacity */
int ok = 0; int ok = 0;
while (!ok) { while (!ok) {
char *target2 = realloc(target, size); char *target2 = (char *)realloc(target, size);
if (!target2) { /* failed to allocate */ if (!target2) { /* failed to allocate */
break; break;
} }

View file

@ -936,9 +936,8 @@ project "lualibs"
} }
configuration { "gmake or ninja" } configuration { "gmake or ninja" }
buildoptions { -- Lua SQLite3, Lua filesystem and Lua zlib don't cast pointers* explicitly buildoptions {
"-Wno-error", "-Wno-error=unused-variable",
"-fpermissive",
} }
configuration { "vs*" } configuration { "vs*" }
@ -1680,9 +1679,9 @@ project "linenoise"
} }
configuration { "gmake or ninja" } configuration { "gmake or ninja" }
buildoptions { -- implicit pointer conversions buildoptions {
"-Wno-error", "-Wno-error=unused-variable",
"-fpermissive", "-Wno-error=implicit-fallthrough",
} }
configuration { "vs*" } configuration { "vs*" }