From patchwork Wed Apr 16 08:14:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kohei Tokunaga X-Patchwork-Id: 14053444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB0D9C369BA for ; Wed, 16 Apr 2025 08:16:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u4xwL-0001YC-Cp; 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 1u4xw0-00012k-TZ; Wed, 16 Apr 2025 04:16:00 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u4xvt-0005fn-Qg; Wed, 16 Apr 2025 04:15:50 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-736ab1c43c4so5947718b3a.1; Wed, 16 Apr 2025 01:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744791341; x=1745396141; 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=WpJvxCQGaFnF6HY7NcaQ25KSvKw9uO9sC1x3AjQFOq0=; b=WsXJpWl7bfdeyN8nMABcUNYxoiU85xAqlrsyRgZXeY8gctRWBKKqs25skkGq2TAN0Y iYvR2EdmjSPKeooHUofLRIu5r2Qb6fLF/VC4Q3u5P+OuevE4QLdONKVqekN5BA3Z2mcw rOeIHUdr8+7ITgM8/Qq2Tvp0Yfxcz3w7BSkMOFfTzgGAKqQFqUP+xoWP4VDZSIfcFGwy 707e6xJzUmtZQJcUvW26sm3Ezv9tNcDfz94lCeSzyv1OWPq2EtpNbJFsmy8u8zIywZEP tgONpfwtNJKH83Cmsbl6eTEdBE25axWJW5KS0KiuhWamMGdGlxkvGucFEeKPcI2q+6QO k3/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744791341; x=1745396141; 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=WpJvxCQGaFnF6HY7NcaQ25KSvKw9uO9sC1x3AjQFOq0=; b=rPJT2mhKWJtMkvXnNX0b9041aB9opR0Gfnsou9bOYQXfBFBSsC8vkLjgk3H69HPbgN vNZ9IuT8jYIBVxQacBGThwtJJbHv9bWUAc4vqyjzRwz6DtAEiiommIqtMxP+x9YskuYM q0xfAAKbuELeyOuK2oZkwAC1AQHiyfCJ4mn9QS3767pfIyn5bKsINBLGEfqjf7KrwAKo 0ZGtFMslktEiKOcjOQpOSic0yce8jphjwWBN3OLk2fPEwZikpgENuHyyuewWN9169/uh onM4xw87CNdrowMfhM0L+iqV1Vu8cFfGUs0sKP0CmwN5IEQww8hDOwuaUezNBKaNKkEU mShQ== X-Forwarded-Encrypted: i=1; AJvYcCU4i1pJz+EMb5v0TOTm/GXu2QvnuoAu5qwQ5cKHAYK4gBP/q6QiXQOs3sv19tr035p8Yyfa6nR53yTdZg==@nongnu.org, AJvYcCUzj7WS73Og2li/1P0EpXNw2i8/8aooNtaJkSGB8F0fwARpl5xznjPcpA7uLihDyu+ZQaQ3TCoGEydo+Q==@nongnu.org, AJvYcCWgGnPGd+LUKQNNU+KhjrnOCj5rzgsCuWHYrpeTzhxJWSsZgZ+/rui2H2wuXpTuqn9As7c/JE7hMiM=@nongnu.org, AJvYcCXlvMfwH/qjs/GD4EKlozius1KD4nxJHXXjRtj0tNC94DluBSZ/Vq0uSIk6IJAbRvP5Tm19fT4wpQ==@nongnu.org X-Gm-Message-State: AOJu0YwDmE/DlcnJ5Qc6BMSWesah2IkdugJ11zQaRfHR4sQGTxDKijCF w1WAOpbaHxjwqZKn/xNF9OmuASBrsayIZNEMuD7MJZr44qCZ7/FtkC7qITzC X-Gm-Gg: ASbGnct4SEUZHFnZZSpc3WmB61YwXbK8v7Nudw2fbfGxbXGVEOa467LaIGuyfTKd6Cb d5h0wmEkYzFRlXWxlO2VE/yMpPULoWgDESoAcxrfjPuA2D6Kamx158veEgOIQH10/+6Ta0Rxomj uqHn18LD/EH8icLerNlb+sv19y4E6fARj51JGFqnYhhmgEkMF87t0yUyGobhA+IrC+jWObgi99h jddow5Zhj7cHLKNz8rWjE4KdpG6pUIR60CI2PYgAWZKksZhZzCGezjkrX6rx/J/OWJetvUH4S6t ImYzYwwSe/syELxxPk6CQqt9FPCr/TMP/JnjOYkYDyZuzz14ApNKCCcmJg== X-Google-Smtp-Source: AGHT+IGxLpFGOdeLk9mPFSkfHfbJw8A0iENnrM/+hSulZm4CxoTeH4oVbmxYU8fUDsz6zRCOaAXueA== X-Received: by 2002:a05:6a21:670d:b0:1f5:60ce:6cc6 with SMTP id adf61e73a8af0-203b3eed04emr1324160637.21.1744791341546; Wed, 16 Apr 2025 01:15:41 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Apr 2025 01:15:40 -0700 (PDT) From: Kohei Tokunaga To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-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_Lureau?= , =?utf-8?q?Daniel_P_=2E_Berrang=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 05/19] target/i386/cpu.c: Fix type conflict of GLib function pointers Date: Wed, 16 Apr 2025 17:14:10 +0900 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=ktokunaga.mail@gmail.com; helo=mail-pf1-x430.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 and g_slist_sort_with_data. Signed-off-by: Kohei Tokunaga --- target/i386/cpu.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 1b64ceaaba..2c494e4b0b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6226,7 +6226,7 @@ static void listflags(GList *features) } /* Sort alphabetically by type name, respecting X86CPUClass::ordering. */ -static gint x86_cpu_list_compare(gconstpointer a, gconstpointer b) +static gint x86_cpu_list_compare(gconstpointer a, gconstpointer b, gpointer d) { ObjectClass *class_a = (ObjectClass *)a; ObjectClass *class_b = (ObjectClass *)b; @@ -6247,7 +6247,7 @@ static gint x86_cpu_list_compare(gconstpointer a, gconstpointer b) static GSList *get_sorted_cpu_model_list(void) { GSList *list = object_class_get_list(TYPE_X86_CPU, false); - list = g_slist_sort(list, x86_cpu_list_compare); + list = g_slist_sort_with_data(list, x86_cpu_list_compare, NULL); return list; } @@ -6304,6 +6304,11 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data) qemu_printf(" %-20s %s\n", name, desc); } +static gint strcmp_wrap(gconstpointer a, gconstpointer b, gpointer d) +{ + return strcmp(a, b); +} + /* list available CPU models and flags */ void x86_cpu_list(void) { @@ -6326,7 +6331,7 @@ void x86_cpu_list(void) } } - names = g_list_sort(names, (GCompareFunc)strcmp); + names = g_list_sort_with_data(names, strcmp_wrap, NULL); qemu_printf("\nRecognized CPUID flags:\n"); listflags(names);