[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/20] target/s390x: Fix type conflict of GLib function pointe
From: |
Kohei Tokunaga |
Subject: |
[PATCH v2 09/20] target/s390x: Fix type conflict of GLib function pointers |
Date: |
Tue, 22 Apr 2025 14:27:13 +0900 |
On Emscripten, function pointer casts can result in runtime failures due to
strict function signature checks. This affects the use of g_list_sort and
g_slist_sort, which internally perform function pointer casts that are not
supported by Emscripten. To avoid these issues, g_list_sort_with_data and
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
---
target/s390x/cpu_models.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
V2:
- Updated the commit message to explicitly explain that function pointer
casts are performed internally by GLib.
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 93a05e43d7..48cdef285d 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -373,7 +373,7 @@ static void s390_print_cpu_model_list_entry(gpointer data,
gpointer user_data)
g_free(name);
}
-static gint s390_cpu_list_compare(gconstpointer a, gconstpointer b)
+static gint s390_cpu_list_compare(gconstpointer a, gconstpointer b, gpointer d)
{
const S390CPUClass *cc_a = S390_CPU_CLASS((ObjectClass *)a);
const S390CPUClass *cc_b = S390_CPU_CLASS((ObjectClass *)b);
@@ -415,7 +415,7 @@ void s390_cpu_list(void)
qemu_printf("Available CPUs:\n");
list = object_class_get_list(TYPE_S390_CPU, false);
- list = g_slist_sort(list, s390_cpu_list_compare);
+ list = g_slist_sort_with_data(list, s390_cpu_list_compare, NULL);
g_slist_foreach(list, s390_print_cpu_model_list_entry, NULL);
g_slist_free(list);
--
2.25.1
- [PATCH v2 01/20] hw/core/loader.c: Fix type conflict of GLib function pointers, (continued)
- [PATCH v2 01/20] hw/core/loader.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 02/20] qom/object.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 03/20] system/vl.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 04/20] target/arm/helper.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 05/20] target/i386/cpu.c: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 09/20] target/s390x: Fix type conflict of GLib function pointers,
Kohei Tokunaga <=
- [PATCH v2 07/20] hw/net/can: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 06/20] contrib/plugins: Fix type conflict of GLib function pointers, Kohei Tokunaga, 2025/04/22
- [PATCH v2 10/20] include/glib-compat.h: Poison g_list_sort and g_slist_sort, Kohei Tokunaga, 2025/04/22
- [PATCH v2 11/20] util/cacheflush.c: Update cache flushing mechanism for Emscripten, Kohei Tokunaga, 2025/04/22