From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v4 04/10] qapi: Emit implicit structs in generated C
Date: Tue, 8 Mar 2016 22:42:43 -0700 [thread overview]
Message-ID: <56DFB7D3.5090503@redhat.com> (raw)
In-Reply-To: <878u1s3hy7.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 2600 bytes --]
On 03/08/2016 12:09 PM, Markus Armbruster wrote:
>
>> I think what would sway me over the fence is looking at some of our
>> constructs: for example, qapi-types.py has gen_object() which it now
>> calls recursively. When called directly from visit_object_type(), we
>> have all the pieces; when called from visit_alternate_type(), we have to
>> create a 1-element members array; and when called recursively, we have
>> to manually explode base into the four pieces.
>
> What could be improved if we changed visit_object_type() to take a
> QAPISchemaObjectType instead of name, info, base, members, variants?
>
> I believe we'd leave gen_object() unchanged to keep
> visit_alternate_type() simple.
>
> Here's a different one: we could drop visit_object_type_flat().
Indeed. But I'd rather get v5 of this series out sooner rather than
later, so I'll save the change for a later day.
>>>
>>> Uh, these are "always reserved for use as identifiers with file scope"
>>> (C99 7.1.3). I'm afraid we need to use the q_ prefix.
Seems doable. We already reserved q_ for ourselves (commit 9fb081e0), so
far using it mainly by c_name. There's still the risk that c_name adds
q_ onto something ticklish which then clashes with our use of q_ on an
implicit type for something else; except that we haven't declared 'obj'
as ticklish.
> I feel awful generating >100KiB of code that gets included pretty much
> every time we compile anything. Perhaps the proper fix for that is to
> find out *why* we include qapi-types.h so much, then figure out how to
> include it much, much less.
>
> Here's a guilty one: error.h. I believe it includes qapi-types.h just
> for QapiErrorClass. I guess it's only in the QAPI schema to have
> QapiErrorClass_lookup[] generated. I'd gladly maintain those nine(!)
> lines of code manually if it helps me drop >100KiB of useless code from
> many (most?) compiles.
Commit 13f59ae predates my work on qapi, but I think you're right that
error.h including qapi-types.h is a big offender and appears to do so
solely for ErrorClass. But how about as a followup series, so that v5
gets out the door sooner.
>
> Another one are builtin QAPI types. A few headers want them. We could
> put them into a separate header instead of generating them into
> qapi-types.h. Could also enable getting rid of the ugly "spew builtins
> into every header, but guard them with #ifdeffery" trick.
In that same series.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-03-09 5:42 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 16:16 [Qemu-devel] [PATCH v4 00/10] easier unboxed visits/qapi implicit types Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 01/10] qapi: Assert in places where variants are not handled Eric Blake
2016-03-08 10:12 ` Markus Armbruster
2016-03-08 15:49 ` Eric Blake
2016-03-08 17:46 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 02/10] qapi: Fix command with named empty argument type Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 03/10] qapi: Make c_type() more OO-like Eric Blake
2016-03-08 10:54 ` Markus Armbruster
2016-03-08 15:50 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 04/10] qapi: Emit implicit structs in generated C Eric Blake
2016-03-08 14:24 ` Markus Armbruster
2016-03-08 16:03 ` Eric Blake
2016-03-08 19:09 ` Markus Armbruster
2016-03-09 5:42 ` Eric Blake [this message]
2016-03-09 7:23 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 05/10] qapi: Utilize implicit struct visits Eric Blake
2016-03-08 15:10 ` Markus Armbruster
2016-03-08 16:11 ` Eric Blake
2016-03-08 18:09 ` Markus Armbruster
2016-03-08 18:28 ` Eric Blake
2016-03-08 19:21 ` Markus Armbruster
2016-03-09 23:28 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 06/10] qapi-commands: Inline single-use helpers of gen_marshal() Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case simple union wrappers Eric Blake
2016-03-08 15:59 ` Markus Armbruster
2016-03-08 16:16 ` Eric Blake
2016-03-08 18:10 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 08/10] qapi: Allow anonymous base for flat union Eric Blake
2016-03-08 16:23 ` Markus Armbruster
2016-03-08 16:29 ` Eric Blake
2016-03-08 18:14 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 09/10] qapi: Use anonymous bases in QMP flat unions Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 10/10] qapi: Populate info['name'] for each entity Eric Blake
2016-03-08 16:46 ` Markus Armbruster
2016-03-08 16:59 ` Eric Blake
2016-03-08 19:14 ` 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=56DFB7D3.5090503@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=mdroth@linux.vnet.ibm.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).