From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz7et-0002Rz-OG for qemu-devel@nongnu.org; Wed, 18 Nov 2015 13:40:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz7eq-0006lH-Ht for qemu-devel@nongnu.org; Wed, 18 Nov 2015 13:40:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz7eq-0006l1-Be for qemu-devel@nongnu.org; Wed, 18 Nov 2015 13:40:40 -0500 From: Markus Armbruster References: <1447836791-369-1-git-send-email-eblake@redhat.com> <1447836791-369-31-git-send-email-eblake@redhat.com> Date: Wed, 18 Nov 2015 19:40:37 +0100 In-Reply-To: <1447836791-369-31-git-send-email-eblake@redhat.com> (Eric Blake's message of "Wed, 18 Nov 2015 01:53:05 -0700") Message-ID: <87bnarjgm2.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v12 30/36] qapi: Convert QType into qapi builtin enum type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Michael Roth , qemu-devel@nongnu.org, Luiz Capitulino Eric Blake writes: > What's more meta than using qapi to define qapi? :) > > Convert QType into a full-fledged[*] builtin qapi enum type, so > that a subsequent patch can then use it as the discriminator > type of qapi alternate types. Fortunately, the judicious use of > 'prefix' in the qapi definition avoids churn to the spelling of > the enum constants. > > To avoid circular definitions, we have to flip the order of > inclusion between "qobject.h" vs. "qapi-types.h". Back in commit > 28770e0, we had the latter include the former, so that we could > use 'QObject *' for our implementation of 'any'. But that usage > also works with only a forward declaration, whereas the > definition of QObject requires QType to be a complete type. I figure putting the typedef in include/qemu/typedefs.h would be simpler. Didn't think of it when I reviewed v11. > > [*] The type has to be builtin, rather than declared in > qapi/common.json, because we want to use it for alternates even > when common.json is not included. But since it is the first > builtin enum type, we have to add special cases to qapi-types > and qapi-visit to only emit definitions once, even when two > qapi files are being compiled into the same binary (the way we > already handled builtin list types like 'intList'). We may > need to revisit how multiple qapi files share common types, > but that's a project for another day. > > Signed-off-by: Eric Blake Patch looks sane.