@@ -102,10 +102,17 @@ static bool csr_qtest_callback(CharBackend *chr, gchar **words)
return false;
}
+static gpointer g_qtest_set_command_cb(
+ bool (*pc_cb)(CharBackend *chr, gchar **words))
+{
+ qtest_set_command_cb(pc_cb);
+ return NULL;
+}
+
static void riscv_cpu_register_csr_qtest_callback(void)
{
static GOnce once;
- g_once(&once, (GThreadFunc)qtest_set_command_cb, csr_qtest_callback);
+ g_once(&once, (GThreadFunc)g_qtest_set_command_cb, csr_qtest_callback);
}
#endif
@@ -1191,7 +1191,8 @@ GSList *object_class_get_list(const char *implements_type,
return list;
}
-static gint object_class_cmp(gconstpointer a, gconstpointer b)
+static gint object_class_cmp(gconstpointer a, gconstpointer b,
+ gpointer user_data)
{
return strcasecmp(object_class_get_name((ObjectClass *)a),
object_class_get_name((ObjectClass *)b));
@@ -1201,7 +1202,7 @@ GSList *object_class_get_list_sorted(const char *implements_type,
bool include_abstract)
{
return g_slist_sort(object_class_get_list(implements_type, include_abstract),
- object_class_cmp);
+ (GCompareFunc)object_class_cmp);
}
Object *object_ref(void *objptr)
@@ -220,7 +220,7 @@ static void count_cpreg(gpointer key, gpointer opaque)
}
}
-static gint cpreg_key_compare(gconstpointer a, gconstpointer b)
+static gint cpreg_key_compare(gconstpointer a, gconstpointer b, void *d)
{
uint64_t aidx = cpreg_to_kvm_id((uintptr_t)a);
uint64_t bidx = cpreg_to_kvm_id((uintptr_t)b);
@@ -244,7 +244,7 @@ void init_cpreg_list(ARMCPU *cpu)
int arraylen;
keys = g_hash_table_get_keys(cpu->cp_regs);
- keys = g_list_sort(keys, cpreg_key_compare);
+ keys = g_list_sort(keys, (GCompareFunc)cpreg_key_compare);
cpu->cpreg_array_len = 0;
On emscripten, function pointer casts can cause function call failure. This commit fixes the function definition to match to the type of the function call. - qtest_set_command_cb passed to g_once should match to GThreadFunc - object_class_cmp and cpreg_key_compare are passed to g_list_sort as GCopmareFunc but GLib cast them to GCompareDataFunc. Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com> --- hw/riscv/riscv_hart.c | 9 ++++++++- qom/object.c | 5 +++-- target/arm/helper.c | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-)