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)
{
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) {
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));
break;
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;
case SQLITE_NULL:
lua_pushnil(L);
@ -667,7 +667,7 @@ static int cleanupdb(lua_State *L, sdb *db) {
top = lua_gettop(L);
lua_pushnil(L);
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);
lua_settop(L, top);
@ -961,7 +961,7 @@ static void db_push_value(lua_State *L, sqlite3_value *value) {
break;
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;
case SQLITE_NULL:
@ -1179,8 +1179,8 @@ static int collwrapper(scc *co,int l1,const void *p1,
int res=0;
lua_State *L=co->L;
lua_rawgeti(L,LUA_REGISTRYINDEX,co->ref);
lua_pushlstring(L,p1,l1);
lua_pushlstring(L,p2,l2);
lua_pushlstring(L,(const char*)p1,l1);
lua_pushlstring(L,(const char*)p2,l2);
if (lua_pcall(L,2,1,0)==0) res=(int)lua_tonumber(L,-1);
lua_pop(L,1);
return res;
@ -2001,7 +2001,7 @@ static int db_close_vm(lua_State *L) {
/* close all used handles */
lua_pushnil(L);
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)
{
@ -2112,7 +2112,7 @@ static int lsqlite_open_ptr(lua_State *L) {
int rc;
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
* SQLITE_ENABLE_API_ARMOR and does almost nothing (without an SQL
* 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) {
lua_pushlightuserdata(L, checksum);
lua_pushlightuserdata(L, combine);
lua_pushlightuserdata(L, (void *)checksum);
lua_pushlightuserdata(L, (void *)combine);
lua_pushnumber(L, checksum(0L, Z_NULL, 0));
lua_pushnumber(L, 0);
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 */
int result;
while (1) {
char *path2 = realloc(path, size);
char *path2 = (char *)realloc(path, size);
if (!path2) { /* failed to allocate */
result = pusherror(L, "get_dir realloc() failed");
break;
@ -1078,7 +1078,7 @@ static int push_link_target(lua_State * L)
int tsize, size = 256; /* size = initial buffer capacity */
int ok = 0;
while (!ok) {
char *target2 = realloc(target, size);
char *target2 = (char *)realloc(target, size);
if (!target2) { /* failed to allocate */
break;
}

View file

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