Markus Armbruster <arm...@redhat.com> writes:

> Eric Blake <ebl...@redhat.com> writes:
[...]
>> That says we have a bug in our QAPI generator - the type
>> SocketAddressList should be auto-generated at the point where it is
>> needed in migration.json. Markus, any ideas why we are not properly
>> auto-generating an array type when the only use of that array comes from
>> a different module than where the original type was declared?
>
> With the DummyStruct, we generate SocketAddressList stuff into
> qapi-{types,visit}-sockets.[ch].
>
> Without it, we it ends up in qapi-{types,visit}-block-core.[ch].  How
> come?
>
> We create non-builtin array types on demand, i.e. on first use, by
> calling ._make_array_type().
>
> Like any other non-builtin type, an array type takes an info tuple
> describing where it's defined.  We pass it the info of whatever
> triggered its creation.  That's not as silly as it may sound; it can be
> viewed as a definition.
>
> However, it falls apart when we use the info to set the type's module,
> in ._def_entity().  The module dicates where the generated code goes.
> The array type's module becomes whatever module uses it first.  It
> should be its element type's module instead.
>
> Needs fixing.
>
> If you don't want to wait for the fix, commit the DummyStruct
> work-around with a big fat FIXME comment.

Proposed fix:
Subject: [PATCH 0/7] qapi: Code generation fixes
Message-Id: <20190301154051.23317-1-arm...@redhat.com>

Reply via email to