From: Peter Maydell <peter.maydell@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Eric Blake <eblake@redhat.com>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PULL 8/9] qapi: introduce forwarding visitor
Date: Mon, 9 Aug 2021 11:40:04 +0100 [thread overview]
Message-ID: <CAFEAcA9eNFoZ5p8A1hneJ7kZ=9HOSjFMxR_9C1tuMA20sFhDZw@mail.gmail.com> (raw)
In-Reply-To: <20210724085453.16791-9-pbonzini@redhat.com>
On Sat, 24 Jul 2021 at 10:00, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> This new adaptor visitor takes a single field of the adaptee, and exposes it
> with a different name.
>
> This will be used for QOM alias properties. Alias targets can of course
> have a different name than the alias property itself (e.g. a machine's
> pflash0 might be an alias of a property named 'drive'). When the target's
> getter or setter invokes the visitor, it will use a different name than
> what the caller expects, and the visitor will not be able to find it
> (or will consume erroneously).
>
> The solution is for alias getters and setters to wrap the incoming
> visitor, and forward the sole field that the target is expecting while
> renaming it appropriately.
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Hi; Coverity complains here (CID 1459068) that the call to
visit_optional() is ignoring its return value (which we check
in 983 out of the other 989 callsites).
> +static void forward_field_optional(Visitor *v, const char *name, bool *present)
> +{
> + ForwardFieldVisitor *ffv = to_ffv(v);
> +
> + if (!forward_field_translate_name(ffv, &name, NULL)) {
> + *present = false;
> + return;
> + }
> + visit_optional(ffv->target, name, present);
> +}
Is it right, or is this its "looks like this is returning an error
indication" heuristic misfiring again ?
My guess is the latter and it's caused by a mismatch
between the prototype of visit_optional() (returns a
status both by setting *present and in its return value)
and the Visitor::optional method (returns a status only
by setting *present, return void). I guess ideally we'd
standardize on whether these things were intended to return
a value or not.
thanks
-- PMM
next prev parent reply other threads:[~2021-08-09 10:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-24 8:54 [PULL 0/9] Misc QEMU patches for 6.0-rc Paolo Bonzini
2021-07-24 8:54 ` [PULL 1/9] meson: fix dependencies for modinfo #2 Paolo Bonzini
2021-07-24 8:54 ` [PULL 2/9] target/i386: Added consistency checks for CR3 Paolo Bonzini
2021-07-24 8:54 ` [PULL 3/9] i386: do not call cpudef-only models functions for max, host, base Paolo Bonzini
2021-07-24 8:54 ` [PULL 4/9] MAINTAINERS: Replace Eduardo as "Host Memory Backends" maintainer Paolo Bonzini
2021-07-24 8:54 ` [PULL 5/9] MAINTAINERS: Add Peter Xu and myself as co-maintainer of "Memory API" Paolo Bonzini
2021-07-24 8:54 ` [PULL 6/9] MAINTAINERS: Add memory_mapping.h and memory_mapping.c to " Paolo Bonzini
2021-07-24 8:54 ` [PULL 7/9] gitlab: only let pages be published from default branch Paolo Bonzini
2021-07-24 8:54 ` [PULL 8/9] qapi: introduce forwarding visitor Paolo Bonzini
2021-08-09 10:40 ` Peter Maydell [this message]
2021-08-30 15:36 ` Peter Maydell
2021-08-31 12:43 ` Paolo Bonzini
2021-09-22 17:00 ` Peter Maydell
2021-09-25 12:11 ` Paolo Bonzini
2021-07-24 8:54 ` [PULL 9/9] qom: use correct field name when getting/setting alias properties Paolo Bonzini
2021-07-24 13:25 ` [PULL 0/9] Misc QEMU patches for 6.0-rc Peter Maydell
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='CAFEAcA9eNFoZ5p8A1hneJ7kZ=9HOSjFMxR_9C1tuMA20sFhDZw@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=eblake@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).