From nobody Fri Dec 19 04:01:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1744791512; cv=none; d=zohomail.com; s=zohoarc; b=OYqZryy2olO/Y2xB7ghxlXfcx7mZsgKSTn44g7oOZ5dM8IldRkePdHSNW4ty8T0G+Si7laxOPxDFQvGGJeTCIXb38NxrCPg6ArGgQ7oh5KOOHNWbeCAyYDbpTnO5png6ZwTEV2niz7kbeQCeHEw4LDfCVNBOD0DhsdfuD6g8YzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744791512; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YLS6yLiQ1Mf5QnPvZYo55MhWKQTC2OarW9pme0RmkFs=; b=CQRJTjy3ij7m18RUPVegxtMC1Xzi1sPk57juCRgYA0ztdLbJ1g55++32HdEd+larG6erHGt+CUwfO1hfOTO7MA4pYQ2ohiGxCUMSMEMmeDU+zmN7hk2DvQQVUJmBFAPUbBRE1ChjqsGkHPadtf7k7VwYn0kqTgYnVWsL7S3r+Gk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1744791512985359.4405311975115; Wed, 16 Apr 2025 01:18:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u4xwL-0001YB-Cd; Wed, 16 Apr 2025 04:16:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u4xw5-0001AK-P6; Wed, 16 Apr 2025 04:16:00 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u4xw1-0005k5-4i; Wed, 16 Apr 2025 04:15:55 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-7399838db7fso483745b3a.0; Wed, 16 Apr 2025 01:15:50 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:3b6:8b00:ee5a:e672:7d4c:d43]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73bd21c3263sm9839445b3a.38.2025.04.16.01.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Apr 2025 01:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744791349; x=1745396149; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YLS6yLiQ1Mf5QnPvZYo55MhWKQTC2OarW9pme0RmkFs=; b=MSeMwibloTewYe2zzBBua1hCOPpWwaurWlMve0YBztL4q0AM5xNm4i8o4PFh2zosHC L/QXJ9aVjpjK6rceHA8LRfqGHtp8GomG2O9sXFP4CCJSt68ZWPEdw0vR6SxD+DD083Qo kUf4C++tG4kdCpoG4Cvs93yXqZxgitbiqXE++fJtzGAgTnMgdDuPpLCTr42LOcQMuh/8 DaEQogQDszWUBzihqE9s+AsUtvZpvFRXpX6KmO80pj8Y9ZQl1EV8CpdVNoKwrRqqLLE1 6DndxTAkAuJeN+CGNNH3nvKL/29x9YTqKI2zqx37dxf3Rw+oTSu6abiSMdnNzdH+WV3T aDIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744791349; x=1745396149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YLS6yLiQ1Mf5QnPvZYo55MhWKQTC2OarW9pme0RmkFs=; b=otwHn056gIoVgOITeutPkMVEglxDaqAPhuAZYpRbbX2X1uZB8E6nit655CguOE3Odr IDpoKyl35g8iC24pz8wMJNaf27ggExc9Va3IOkl0XSkk2/B4E1NdVuhvf5qBz2CmWAdl DEsNWyEM5qg9vPoU++yfJUofuV7/p7Hz+/rQZK+dKzqpNtuMVWYvrDIM4oda0mk0JA/2 qbR14dyssK4Lk8Q36zBCrCQklO0WuZhs5xzZs569V1kO39o+Jv57b7EJSrwtCrba/y4L XN6V8XrxVNiPCF74Ug1hxbyRG3/NsSv0gYAvcBOG6HHGwz2ZErJwOi5vWuCl5qRjjfts 4K5g== X-Forwarded-Encrypted: i=1; AJvYcCUozKNfnxbhO1JuCiCAT9d/QaWMnJhP+SpyBJPsb35m7+X8nc+Qqgs4Ck7Jwj6yWFmdxSoqwNQETFqBCA==@nongnu.org, AJvYcCVx5c9kmPpEDgXep+8N7RVuhWbinJD1SiZWO7vBUzw4f2P83IB2ASq9eAiAAxCOrf+UTDBzF0rGxjs=@nongnu.org, AJvYcCX2bFpSk10AIC0aqhanOAiWa2lEQTDEAQN2VnCLzt1bAR41H46FlOPrdM70S7SzP8m5zIvF2wwnNjNJ2Q==@nongnu.org, AJvYcCXkD8qmyotbP9zGmMK/nf6yjuZ8NdhYbTNXfIhX2XmnUOhIaCL6Dr7ZyXcO0S/eDJK9YAEdPFy2cQ==@nongnu.org X-Gm-Message-State: AOJu0YyEnvu04AiRGsqf7ERleCnPoVkaQkL0IYySbAdlJAVjjEI0DxQs MTk0Gf+sBfkCo5F0ZvuEJxGxWQKmlGfpUidDBKY7jZjlR1z4kEBP+gzZ+7Vb X-Gm-Gg: ASbGncu0p0wHBuuAZKwvMPggsr82v9zGjRIKHf1fQSrz8380oycuHhYGkXq2iSgvB8N E8/Zc/tRXzZ7yv7w8fb6vJlMIfu/fAD4o9z11g7/M+e8+qyUjvGZsV1xgPLKTtyvxfBYepxSm2t 1tlmDD5sLPBNJzqHK+xd9/iFr4fwd+MfIdy+gQLPsfEFY2XmYSfbuCUI8prVf1t1N0kmhzkEfP4 hpWnH2Gi4X795fxkbG6rkO12Qa0EdttX6B9CJl74LJJDKA9JCXKaYLWiG8OzxELx2fSRFPeqEnS miBsIwg5N1Dfi3iyr2YjFKJN1JFpWP/I68ta07n90awZv/LCH/zGZdHUKg== X-Google-Smtp-Source: AGHT+IENMKjfdhGzf7kqBp8NXUGixVOGLTQfJgHI0y0GI+HSpVK6nMqsODrZOEyt9kh+1JN/MlNNWA== X-Received: by 2002:a05:6a00:4644:b0:730:9637:b2ff with SMTP id d2e1a72fcca58-73c26e06d63mr1106371b3a.7.1744791349159; Wed, 16 Apr 2025 01:15:49 -0700 (PDT) From: Kohei Tokunaga To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Kevin Wolf , Hanna Reitz , Kohei Tokunaga , Paolo Bonzini , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier , Pavel Pisa , Francisco Iglesias , Vikram Garhwal , Jason Wang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Eduardo Habkost , Peter Maydell , Zhao Liu , Nicholas Piggin , Daniel Henrique Barboza , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Stefan Hajnoczi , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH 06/19] contrib/plugins: Fix type conflict of GLib function pointers Date: Wed, 16 Apr 2025 17:14:11 +0900 Message-Id: <7f24174c2659cc61b29e707686ceb9c58833e93b.1744787186.git.ktokunaga.mail@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=ktokunaga.mail@gmail.com; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1744791515210019000 Content-Type: text/plain; charset="utf-8" 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 using g_list_sort_with_data. Signed-off-by: Kohei Tokunaga --- contrib/plugins/cache.c | 12 ++++++------ contrib/plugins/cflow.c | 10 +++++----- contrib/plugins/hotblocks.c | 4 ++-- contrib/plugins/hotpages.c | 4 ++-- contrib/plugins/howvec.c | 4 ++-- contrib/plugins/hwprofile.c | 8 ++++---- tests/tcg/plugins/mem.c | 4 ++-- tests/tcg/plugins/syscall.c | 4 ++-- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index 7cfd3df249..56508587d3 100644 --- a/contrib/plugins/cache.c +++ b/contrib/plugins/cache.c @@ -576,7 +576,7 @@ static void sum_stats(void) } } =20 -static int dcmp(gconstpointer a, gconstpointer b) +static int dcmp(gconstpointer a, gconstpointer b, gpointer d) { InsnData *insn_a =3D (InsnData *) a; InsnData *insn_b =3D (InsnData *) b; @@ -584,7 +584,7 @@ static int dcmp(gconstpointer a, gconstpointer b) return insn_a->l1_dmisses < insn_b->l1_dmisses ? 1 : -1; } =20 -static int icmp(gconstpointer a, gconstpointer b) +static int icmp(gconstpointer a, gconstpointer b, gpointer d) { InsnData *insn_a =3D (InsnData *) a; InsnData *insn_b =3D (InsnData *) b; @@ -592,7 +592,7 @@ static int icmp(gconstpointer a, gconstpointer b) return insn_a->l1_imisses < insn_b->l1_imisses ? 1 : -1; } =20 -static int l2_cmp(gconstpointer a, gconstpointer b) +static int l2_cmp(gconstpointer a, gconstpointer b, gpointer d) { InsnData *insn_a =3D (InsnData *) a; InsnData *insn_b =3D (InsnData *) b; @@ -645,7 +645,7 @@ static void log_top_insns(void) InsnData *insn; =20 miss_insns =3D g_hash_table_get_values(miss_ht); - miss_insns =3D g_list_sort(miss_insns, dcmp); + miss_insns =3D g_list_sort_with_data(miss_insns, dcmp, NULL); g_autoptr(GString) rep =3D g_string_new(""); g_string_append_printf(rep, "%s", "address, data misses, instruction\n= "); =20 @@ -659,7 +659,7 @@ static void log_top_insns(void) insn->l1_dmisses, insn->disas_str); } =20 - miss_insns =3D g_list_sort(miss_insns, icmp); + miss_insns =3D g_list_sort_with_data(miss_insns, icmp, NULL); g_string_append_printf(rep, "%s", "\naddress, fetch misses, instructio= n\n"); =20 for (curr =3D miss_insns, i =3D 0; curr && i < limit; i++, curr =3D cu= rr->next) { @@ -676,7 +676,7 @@ static void log_top_insns(void) goto finish; } =20 - miss_insns =3D g_list_sort(miss_insns, l2_cmp); + miss_insns =3D g_list_sort_with_data(miss_insns, l2_cmp, NULL); g_string_append_printf(rep, "%s", "\naddress, L2 misses, instruction\n= "); =20 for (curr =3D miss_insns, i =3D 0; curr && i < limit; i++, curr =3D cu= rr->next) { diff --git a/contrib/plugins/cflow.c b/contrib/plugins/cflow.c index 930ecb46fc..b5e33f25f9 100644 --- a/contrib/plugins/cflow.c +++ b/contrib/plugins/cflow.c @@ -98,7 +98,7 @@ static GHashTable *nodes; struct qemu_plugin_scoreboard *state; =20 /* SORT_HOTTEST */ -static gint hottest(gconstpointer a, gconstpointer b) +static gint hottest(gconstpointer a, gconstpointer b, gpointer d) { NodeData *na =3D (NodeData *) a; NodeData *nb =3D (NodeData *) b; @@ -107,7 +107,7 @@ static gint hottest(gconstpointer a, gconstpointer b) na->dest_count =3D=3D nb->dest_count ? 0 : 1; } =20 -static gint exception(gconstpointer a, gconstpointer b) +static gint exception(gconstpointer a, gconstpointer b, gpointer d) { NodeData *na =3D (NodeData *) a; NodeData *nb =3D (NodeData *) b; @@ -116,7 +116,7 @@ static gint exception(gconstpointer a, gconstpointer b) na->early_exit =3D=3D nb->early_exit ? 0 : 1; } =20 -static gint popular(gconstpointer a, gconstpointer b) +static gint popular(gconstpointer a, gconstpointer b, gpointer d) { NodeData *na =3D (NodeData *) a; NodeData *nb =3D (NodeData *) b; @@ -138,7 +138,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) { g_autoptr(GString) result =3D g_string_new("collected "); GList *data; - GCompareFunc sort =3D &hottest; + GCompareDataFunc sort =3D &hottest; int i =3D 0; =20 g_mutex_lock(&node_lock); @@ -162,7 +162,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) break; } =20 - data =3D g_list_sort(data, sort); + data =3D g_list_sort_with_data(data, sort, NULL); =20 for (GList *l =3D data; l !=3D NULL && i < topn; diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index f12bfb7a26..98404b6885 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -39,7 +39,7 @@ typedef struct { unsigned long insns; } ExecCount; =20 -static gint cmp_exec_count(gconstpointer a, gconstpointer b) +static gint cmp_exec_count(gconstpointer a, gconstpointer b, gpointer d) { ExecCount *ea =3D (ExecCount *) a; ExecCount *eb =3D (ExecCount *) b; @@ -79,7 +79,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) g_string_append_printf(report, "%d entries in the hash table\n", g_hash_table_size(hotblocks)); counts =3D g_hash_table_get_values(hotblocks); - it =3D g_list_sort(counts, cmp_exec_count); + it =3D g_list_sort_with_data(counts, cmp_exec_count, NULL); =20 if (it) { g_string_append_printf(report, "pc, tcount, icount, ecount\n"); diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c index c6e6493719..9d48ac969e 100644 --- a/contrib/plugins/hotpages.c +++ b/contrib/plugins/hotpages.c @@ -48,7 +48,7 @@ typedef struct { static GMutex lock; static GHashTable *pages; =20 -static gint cmp_access_count(gconstpointer a, gconstpointer b) +static gint cmp_access_count(gconstpointer a, gconstpointer b, gpointer d) { PageCounters *ea =3D (PageCounters *) a; PageCounters *eb =3D (PageCounters *) b; @@ -83,7 +83,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) if (counts && g_list_next(counts)) { GList *it; =20 - it =3D g_list_sort(counts, cmp_access_count); + it =3D g_list_sort_with_data(counts, cmp_access_count, NULL); =20 for (i =3D 0; i < limit && it->next; i++, it =3D it->next) { PageCounters *rec =3D (PageCounters *) it->data; diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 2aa9029c3f..42bddb6566 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -155,7 +155,7 @@ static ClassSelector class_tables[] =3D { static InsnClassExecCount *class_table; static int class_table_sz; =20 -static gint cmp_exec_count(gconstpointer a, gconstpointer b) +static gint cmp_exec_count(gconstpointer a, gconstpointer b, gpointer d) { InsnExecCount *ea =3D (InsnExecCount *) a; InsnExecCount *eb =3D (InsnExecCount *) b; @@ -208,7 +208,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) counts =3D g_hash_table_get_values(insns); if (counts && g_list_next(counts)) { g_string_append_printf(report, "Individual Instructions:\n"); - counts =3D g_list_sort(counts, cmp_exec_count); + counts =3D g_list_sort_with_data(counts, cmp_exec_count, NULL); =20 for (i =3D 0; i < limit && g_list_next(counts); i++, counts =3D g_list_next(counts)) { diff --git a/contrib/plugins/hwprofile.c b/contrib/plugins/hwprofile.c index 2a4cbc47d4..a9838ccc87 100644 --- a/contrib/plugins/hwprofile.c +++ b/contrib/plugins/hwprofile.c @@ -71,7 +71,7 @@ static void plugin_init(void) devices =3D g_hash_table_new(NULL, NULL); } =20 -static gint sort_cmp(gconstpointer a, gconstpointer b) +static gint sort_cmp(gconstpointer a, gconstpointer b, gpointer d) { DeviceCounts *ea =3D (DeviceCounts *) a; DeviceCounts *eb =3D (DeviceCounts *) b; @@ -79,7 +79,7 @@ static gint sort_cmp(gconstpointer a, gconstpointer b) eb->totals.reads + eb->totals.writes ? -1 : 1; } =20 -static gint sort_loc(gconstpointer a, gconstpointer b) +static gint sort_loc(gconstpointer a, gconstpointer b, gpointer d) { IOLocationCounts *ea =3D (IOLocationCounts *) a; IOLocationCounts *eb =3D (IOLocationCounts *) b; @@ -126,13 +126,13 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) if (counts && g_list_next(counts)) { GList *it; =20 - it =3D g_list_sort(counts, sort_cmp); + it =3D g_list_sort_with_data(counts, sort_cmp, NULL); =20 while (it) { DeviceCounts *rec =3D (DeviceCounts *) it->data; if (rec->detail) { GList *accesses =3D g_hash_table_get_values(rec->detail); - GList *io_it =3D g_list_sort(accesses, sort_loc); + GList *io_it =3D g_list_sort_with_data(accesses, sort_loc,= NULL); const char *prefix =3D pattern ? "off" : "pc"; g_string_append_printf(report, "%s @ 0x%"PRIx64"\n", rec->name, rec->base); diff --git a/tests/tcg/plugins/mem.c b/tests/tcg/plugins/mem.c index d87d6628e0..ca4e8883dd 100644 --- a/tests/tcg/plugins/mem.c +++ b/tests/tcg/plugins/mem.c @@ -67,7 +67,7 @@ static enum qemu_plugin_mem_rw rw =3D QEMU_PLUGIN_MEM_RW; static GMutex lock; static GHashTable *regions; =20 -static gint addr_order(gconstpointer a, gconstpointer b) +static gint addr_order(gconstpointer a, gconstpointer b, gpointer d) { RegionInfo *na =3D (RegionInfo *) a; RegionInfo *nb =3D (RegionInfo *) b; @@ -94,7 +94,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) if (do_region_summary) { GList *counts =3D g_hash_table_get_values(regions); =20 - counts =3D g_list_sort(counts, addr_order); + counts =3D g_list_sort_with_data(counts, addr_order, NULL); =20 g_string_printf(out, "Region Base, Reads, Writes, Seen all\n"); =20 diff --git a/tests/tcg/plugins/syscall.c b/tests/tcg/plugins/syscall.c index 47aad55fc1..42801f5c86 100644 --- a/tests/tcg/plugins/syscall.c +++ b/tests/tcg/plugins/syscall.c @@ -180,7 +180,7 @@ static void print_entry(gpointer val, gpointer user_dat= a) qemu_plugin_outs(out); } =20 -static gint comp_func(gconstpointer ea, gconstpointer eb) +static gint comp_func(gconstpointer ea, gconstpointer eb, gpointer d) { SyscallStats *ent_a =3D (SyscallStats *) ea; SyscallStats *ent_b =3D (SyscallStats *) eb; @@ -197,7 +197,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) =20 g_mutex_lock(&lock); GList *entries =3D g_hash_table_get_values(statistics); - entries =3D g_list_sort(entries, comp_func); + entries =3D g_list_sort_with_data(entries, comp_func, NULL); qemu_plugin_outs("syscall no. calls errors\n"); =20 g_list_foreach(entries, print_entry, NULL); --=20 2.25.1