removed function cast warnings (initial patch by saghul)

This commit is contained in:
Fabrice Bellard
2025-08-27 15:16:52 +02:00
parent 5689f30cd0
commit 0b3c73ed9c
2 changed files with 18 additions and 8 deletions

View File

@@ -1049,7 +1049,9 @@ static inline JSValue JS_NewCFunctionMagic(JSContext *ctx, JSCFunctionMagic *fun
const char *name,
int length, JSCFunctionEnum cproto, int magic)
{
return JS_NewCFunction2(ctx, (JSCFunction *)func, name, length, cproto, magic);
/* Used to squelch a -Wcast-function-type warning. */
JSCFunctionType ft = { .generic_magic = func };
return JS_NewCFunction2(ctx, ft.generic, name, length, cproto, magic);
}
void JS_SetConstructor(JSContext *ctx, JSValueConst func_obj,
JSValueConst proto);