From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [RFC PATCH] qapi: Incorrect attempt to fix building with MC146818RTC=n
Date: Tue, 21 Jan 2020 21:44:01 +0100 [thread overview]
Message-ID: <CABgObfaPrbbx6Bw0Cj14evAvA_TSUo-+iOCkBzEBfPVn6qDLBg@mail.gmail.com> (raw)
In-Reply-To: <87lfq0c2jq.fsf@dusky.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 2760 bytes --]
Il mar 21 gen 2020, 15:22 Markus Armbruster <armbru@redhat.com> ha scritto:
> > To see it a different way, these are the "C bindings" to QMP, just that
> > the implementation is an in-process call rather than RPC. If the QAPI
> > code generator was also able to generate Python bindings and the like,
> > they would have to be the same for all QEMU binaries, wouldn't they?
>
> Ommitting the kind of #if we've been discussing is relatively harmless
> but what about this one, in qapi-types-block-core.h:
>
> typedef enum BlockdevDriver {
> BLOCKDEV_DRIVER_BLKDEBUG,
> [...]
> #if defined(CONFIG_REPLICATION)
> BLOCKDEV_DRIVER_REPLICATION,
> #endif /* defined(CONFIG_REPLICATION) */
> [...]
> BLOCKDEV_DRIVER__MAX,
> } BlockdevDriver;
>
Well, I don't think this should be conditional at all. Introspection is a
tool to detect unsupported features, not working features. KVM will be
present in introspection data even if /dev/kvm doesn't exist on your
machine or you don't have permission to access it. I would restrict very
much #if usage in QAPI to the very minimum necessary.
Paolo
> If I omit it in the header, I then have to omit it in
> qapi-types-block-core.c's
>
> const QEnumLookup BlockdevDriver_lookup = {
> .array = (const char *const[]) {
> [BLOCKDEV_DRIVER_BLKDEBUG] = "blkdebug",
> [...]
> #if defined(CONFIG_REPLICATION)
> [BLOCKDEV_DRIVER_REPLICATION] = "replication",
> #endif /* defined(CONFIG_REPLICATION) */
> [...]
> },
> .size = BLOCKDEV_DRIVER__MAX
> };
>
> and God knows what else. But I must not omit it in qapi-introspect.c's
>
> QLIT_QDICT(((QLitDictEntry[]) {
> { "meta-type", QLIT_QSTR("enum"), },
> { "name", QLIT_QSTR("245"), },
> { "values", QLIT_QLIST(((QLitObject[]) {
> QLIT_QSTR("blkdebug"),
> [...]
> #if defined(CONFIG_REPLICATION)
> QLIT_QSTR("replication"),
> #endif /* defined(CONFIG_REPLICATION) */
> [...]
> {}
> })), },
> {}
> })),
>
> because that would defeat introspection.
>
> I smell a swamp.
>
> I'd rather not complicate the generator to support not including a
> header I feel we *should* include. #ifdef CONFIG_FOO can occur not just
> in QAPI-generated code, and neglecting to include the relevant header
> can cause *nasty* problems not just in QAPI-generated code. Like
> inconsistent struct definitions in separate compilation units. Been
> there, debugged that, wasn't fun, do not want to go there again.
>
>
[-- Attachment #2: Type: text/html, Size: 3756 bytes --]
next prev parent reply other threads:[~2020-01-21 20:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-31 18:49 [RFC PATCH] qapi: Incorrect attempt to fix building with MC146818RTC=n Philippe Mathieu-Daudé
2020-01-07 10:34 ` Paolo Bonzini
2020-01-13 14:01 ` Markus Armbruster
2020-01-18 20:47 ` Paolo Bonzini
2020-01-21 5:49 ` Markus Armbruster
2020-01-21 8:16 ` Paolo Bonzini
2020-01-21 14:22 ` Markus Armbruster
2020-01-21 14:48 ` Philippe Mathieu-Daudé
2020-01-21 20:44 ` Paolo Bonzini [this message]
2020-01-22 5:41 ` Markus Armbruster
2020-01-22 14:30 ` Paolo Bonzini
2020-01-23 8:21 ` Markus Armbruster
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=CABgObfaPrbbx6Bw0Cj14evAvA_TSUo-+iOCkBzEBfPVn6qDLBg@mail.gmail.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=philmd@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).