All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Kohei Tokunaga" <ktokunaga.mail@gmail.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Mahmoud Mandour" <ma.mandourr@gmail.com>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Pavel Pisa" <pisa@cmp.felk.cvut.cz>,
	"Francisco Iglesias" <francisco.iglesias@amd.com>,
	"Vikram Garhwal" <vikram.garhwal@bytedance.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	"zmta06.collab.prod.int.phx2.redhat.com,
	list@suse.de" <qemu-ppc@nongnu.org>,
	qemu-s390x <qemu-s390x@nongnu.org>
Subject: Re: [PATCH 01/19] hw/core/loader.c: Fix type conflict of GLib function pointers
Date: Wed, 16 Apr 2025 10:12:10 +0100	[thread overview]
Message-ID: <Z_90aqNE74sonn8O@redhat.com> (raw)
In-Reply-To: <CABgObfaj0ycyc2jVSJEVvQJ1m+uLf=_HYiOafn2MECgU36aspw@mail.gmail.com>

On Wed, Apr 16, 2025 at 11:00:37AM +0200, Paolo Bonzini wrote:
> Il mer 16 apr 2025, 10:29 Daniel P. Berrangé <berrange@redhat.com> ha
> scritto:
> 
> > > -    secs = g_list_sort(secs, sort_secs);
> > > +    secs = g_list_sort_with_data(secs, sort_secs, NULL);
> >
> > I don't see what the problem is with the original code.
> >
> > The commit message says we have a bad function cast, but the original
> > method decl is
> >
> >   GList *g_list_sort(GList*list, GCompareFunc compare_func);
> >
> > where the callback is
> >
> >    typedef gint (*GCompareFunc)(gconstpointer a, gconstpointer b);
> >
> > Our code complies with that GCompareFunc signature.
> >
> 
> The cast is inside glib; g_list_sort casts the function pointer and calls
> g_list_sort_with_data.

Sigh, the commit message should have said that, as it reads like the
problem is in QEMU code, not glib code.

> I suggested this solution to Kohei because it's easy to check that we're
> converting all users and not introducing new ones in the future (see
> poisoning in patch 10).

It is easy to check this /one/ example, but this pattern of bad casts
is typical in glib with likely many more examples, so avoidance in this
way does not feel like a sustainable long term strategy to me.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2025-04-16  9:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16  8:14 [PATCH 00/19] Enable QEMU TCI to run 32bit guests on browsers Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 01/19] hw/core/loader.c: Fix type conflict of GLib function pointers Kohei Tokunaga
2025-04-16  8:28   ` Daniel P. Berrangé
2025-04-16  9:00     ` Paolo Bonzini
2025-04-16  9:12       ` Daniel P. Berrangé [this message]
2025-04-16  9:31         ` Paolo Bonzini
2025-04-17  9:18           ` Kohei Tokunaga
2025-04-16  9:14       ` Thomas Huth
2025-04-16  9:35     ` Philippe Mathieu-Daudé
2025-04-17  9:07       ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 02/19] qom/object.c: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 03/19] system/vl.c: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 04/19] target/arm/helper.c: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 05/19] target/i386/cpu.c: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 06/19] contrib/plugins: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 07/19] hw/net/can: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 08/19] target/ppc: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 09/19] target/s390x: " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 10/19] include/glib-compat.h: Poison g_list_sort and g_slist_sort Kohei Tokunaga
2025-04-16 11:56   ` BALATON Zoltan
2025-04-17  9:20     ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 11/19] util/cacheflush.c: Update cache flushing mechanism for Emscripten Kohei Tokunaga
2025-04-16  9:37   ` Philippe Mathieu-Daudé
2025-04-17  9:27     ` Kohei Tokunaga
2025-04-17  9:50       ` Philippe Mathieu-Daudé
2025-04-16  8:14 ` [PATCH 12/19] block: Update block to compile with Emscripten Kohei Tokunaga
2025-04-16  9:00   ` Philippe Mathieu-Daudé
2025-04-16  9:33     ` Philippe Mathieu-Daudé
2025-04-16 15:45       ` Richard Henderson
2025-04-17  9:32       ` Kohei Tokunaga
2025-04-17  9:55         ` Philippe Mathieu-Daudé
2025-04-18  6:53           ` Kohei Tokunaga
2025-04-18  9:51             ` Philippe Mathieu-Daudé
2025-04-17  9:43     ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 13/19] include/qemu/osdep.h: Add Emscripten-specific OS dependencies Kohei Tokunaga
2025-04-17  9:58   ` Philippe Mathieu-Daudé
2025-04-18  6:55     ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 14/19] Disable options unsupported on Emscripten Kohei Tokunaga
2025-04-16  9:03   ` Philippe Mathieu-Daudé
2025-04-17  9:33     ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 15/19] util/mmap-alloc: Add qemu_ram_mmap implementation for emscripten Kohei Tokunaga
2025-04-16  9:18   ` Philippe Mathieu-Daudé
2025-04-17  9:35     ` Kohei Tokunaga
2025-04-21  3:23       ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 16/19] util: Add coroutine backend " Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 17/19] meson: Add wasm build in build scripts Kohei Tokunaga
2025-04-16  9:22   ` Philippe Mathieu-Daudé
2025-04-17  9:37     ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 18/19] gitlab: Enable CI for wasm build Kohei Tokunaga
2025-04-16  9:23   ` Philippe Mathieu-Daudé
2025-04-17  9:39     ` Kohei Tokunaga
2025-04-16  8:14 ` [PATCH 19/19] MAINTAINERS: Update MAINTAINERS file for wasm-related files Kohei Tokunaga
2025-04-16  9:34   ` Philippe Mathieu-Daudé
2025-04-17  9:40     ` Kohei Tokunaga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_90aqNE74sonn8O@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=danielhb413@gmail.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=erdnaxe@crans.org \
    --cc=francisco.iglesias@amd.com \
    --cc=hreitz@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=ktokunaga.mail@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=ma.mandourr@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=pisa@cmp.felk.cvut.cz \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=vikram.garhwal@bytedance.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.