From: Markus Armbruster <armbru@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH] qapi: Make some ObjectTypes depend on the build settings
Date: Wed, 29 Sep 2021 13:41:15 +0200 [thread overview]
Message-ID: <875yujzk10.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <0ddcdd25-55d9-f782-2bc3-a11d7078b337@redhat.com> (Thomas Huth's message of "Wed, 29 Sep 2021 08:17:57 +0200")
Thomas Huth <thuth@redhat.com> writes:
> On 28/09/2021 19.39, Philippe Mathieu-Daudé wrote:
>> I quickly opened qapi/qom.json and spotted another one:
>> --- a/qapi/qom.json
>> +++ b/qapi/qom.json
>> @@ -870,3 +870,4 @@
>> 'tls-cipher-suites': 'TlsCredsProperties',
>> - 'x-remote-object': 'RemoteObjectProperties'
>> + 'x-remote-object': { 'type': 'RemoteObjectProperties',
>> + 'if': 'CONFIG_MULTIPROCESS' },
>> } }
>
> No, CONFIG_MULTIPROCESS is in config-poison.h (it's target specific),
> so that won't work here. We can only use the CONFIG switches from
> config-host.h here.
Target-specific conditions are available in qapi/*-target.json only.
The generated qapi-*-target.h are only usable from target-specific
code.
Moving stuff to qapi/*-target.json may necessitate compiling much more
code per target. Care is advised.
>> While your change is correct, this isn't maintainable long term.
>> Not sure how we could improve that :/ But having to handle similar
>> information in 3 different places (configure, meson.build, qapi json)
>> is error prone. Thoughts?
>
> The current situation is just that bad since we didn't have these
> 'if:' statements in the past. For future code, I think we just have to
> be more careful during code review...
In my opinion, use of CONFIG_FOO in QAPI schemata is no worse than using
them in C type definitions.
In both cases, we have a choice: compile out stuff this build doesn't
need with compile-time conditionals, or leave it in unused.
In C, we sometimes have to compile out stuff, say when it depends on
headers we don't have.
In QAPI, we sometimes want to compile out stuff to make introspection
more useful. This can be a killer argument.
> (and for configure vs. meson.build the answer is clear: Move more
> stuff from the configure script into meson.build, so that configure
> finally is only a stupid simple wrapper script)
>
> Thomas
next prev parent reply other threads:[~2021-09-29 11:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 16:02 [PATCH] qapi: Make some ObjectTypes depend on the build settings Thomas Huth
2021-09-28 17:39 ` Philippe Mathieu-Daudé
2021-09-29 6:17 ` Thomas Huth
2021-09-29 11:41 ` Markus Armbruster [this message]
2021-10-05 6:49 ` Thomas Huth
2021-10-05 8:24 ` Markus Armbruster
2021-10-08 12:01 ` Markus Armbruster
2021-10-08 17:13 ` Paolo Bonzini
2021-10-09 12:51 ` 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=875yujzk10.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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.