From patchwork Mon Sep 7 10:16:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 515084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8BB36140281 for ; Mon, 7 Sep 2015 20:36:14 +1000 (AEST) Received: from localhost ([::1]:55434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYtUY-0002Gc-Kd for incoming@patchwork.ozlabs.org; Mon, 07 Sep 2015 06:17:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYtTn-0001TJ-5H for qemu-devel@nongnu.org; Mon, 07 Sep 2015 06:16:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYtTm-0000MX-1U for qemu-devel@nongnu.org; Mon, 07 Sep 2015 06:16:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYtTl-0000Ln-TX for qemu-devel@nongnu.org; Mon, 07 Sep 2015 06:16:49 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 7719A83F37; Mon, 7 Sep 2015 10:16:49 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t87AGlcQ024448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 7 Sep 2015 06:16:48 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3B2AA303E3DC; Mon, 7 Sep 2015 12:16:44 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 7 Sep 2015 12:16:17 +0200 Message-Id: <1441621003-2434-7-git-send-email-armbru@redhat.com> In-Reply-To: <1441621003-2434-1-git-send-email-armbru@redhat.com> References: <1441621003-2434-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH RFC v5 06/32] qapi: Split up some typedefs to ease review X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org One of the next patches will among other things generate a separate typedef for some struct types, i.e. typedef struct FOO FOO; struct FOO { ... }; instead of typedef struct FOO { ... } FOO; To make the generated files easier to diff, anticipate the change. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrange --- scripts/qapi-types.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index d162ca2..124a788 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -15,13 +15,15 @@ from qapi import * def generate_fwd_builtin(name): return mcgen(''' -typedef struct %(name)sList { +typedef struct %(name)sList %(name)sList; + +struct %(name)sList { union { %(type)s value; uint64_t padding; }; struct %(name)sList *next; -} %(name)sList; +}; ''', type=c_type(name), name=name) @@ -31,26 +33,30 @@ def generate_fwd_struct(name): typedef struct %(name)s %(name)s; -typedef struct %(name)sList { +typedef struct %(name)sList %(name)sList; + +struct %(name)sList { union { %(name)s *value; uint64_t padding; }; struct %(name)sList *next; -} %(name)sList; +}; ''', name=c_name(name)) def generate_fwd_enum_struct(name): return mcgen(''' -typedef struct %(name)sList { +typedef struct %(name)sList %(name)sList; + +struct %(name)sList { union { %(name)s value; uint64_t padding; }; struct %(name)sList *next; -} %(name)sList; +}; ''', name=c_name(name))