get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/812320/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 812320,
    "url": "http://patchwork.ozlabs.org/api/patches/812320/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911110623.24981-8-marcandre.lureau@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170911110623.24981-8-marcandre.lureau@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-11T11:05:40",
    "name": "[v3,07/50] qapi: add 'ifcond' to visitor methods",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7f84e24defa250919336618af6f38cf93fb157b2",
    "submitter": {
        "id": 66774,
        "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api",
        "name": "Marc-André Lureau",
        "email": "marcandre.lureau@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911110623.24981-8-marcandre.lureau@redhat.com/mbox/",
    "series": [
        {
            "id": 2480,
            "url": "http://patchwork.ozlabs.org/api/series/2480/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2480",
            "date": "2017-09-11T11:05:33",
            "name": "Hi,",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/2480/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812320/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812320/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=marcandre.lureau@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrQJY2j8Zz9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 21:13:01 +1000 (AEST)",
            "from localhost ([::1]:56765 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drMeB-0001Um-8b\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 07:12:59 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:42719)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drMYD-00050Q-LI\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 07:06:52 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drMYB-00067T-Hz\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 07:06:49 -0400",
            "from mx1.redhat.com ([209.132.183.28]:38672)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <marcandre.lureau@redhat.com>)\n\tid 1drMYB-000674-98\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 07:06:47 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 68A09C0D8D58;\n\tMon, 11 Sep 2017 11:06:46 +0000 (UTC)",
            "from localhost (ovpn-112-47.ams2.redhat.com [10.36.112.47])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id C09075F915;\n\tMon, 11 Sep 2017 11:06:43 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 68A09C0D8D58",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Mon, 11 Sep 2017 13:05:40 +0200",
        "Message-Id": "<20170911110623.24981-8-marcandre.lureau@redhat.com>",
        "In-Reply-To": "<20170911110623.24981-1-marcandre.lureau@redhat.com>",
        "References": "<20170911110623.24981-1-marcandre.lureau@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tMon, 11 Sep 2017 11:06:46 +0000 (UTC)",
        "Content-Transfer-Encoding": "quoted-printable",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH v3 07/50] qapi: add 'ifcond' to visitor methods",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\tarmbru@redhat.com, Michael Roth <mdroth@linux.vnet.ibm.com>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "Modify the test visitor to check correct passing of values.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n scripts/qapi.py                        | 31 +++++++++++++++++--------------\n scripts/qapi-commands.py               |  2 +-\n scripts/qapi-event.py                  |  2 +-\n scripts/qapi-introspect.py             | 12 ++++++------\n scripts/qapi-types.py                  |  8 ++++----\n scripts/qapi-visit.py                  |  8 ++++----\n scripts/qapi2texi.py                   | 10 +++++-----\n tests/qapi-schema/qapi-schema-test.out |  9 +++++++++\n tests/qapi-schema/test-qapi.py         | 21 ++++++++++++++++-----\n 9 files changed, 63 insertions(+), 40 deletions(-)",
    "diff": "diff --git a/scripts/qapi.py b/scripts/qapi.py\nindex 0f55caa18d..f2b5a7e131 100644\n--- a/scripts/qapi.py\n+++ b/scripts/qapi.py\n@@ -1039,26 +1039,26 @@ class QAPISchemaVisitor(object):\n     def visit_builtin_type(self, name, info, json_type):\n         pass\n \n-    def visit_enum_type(self, name, info, values, prefix):\n+    def visit_enum_type(self, name, info, ifcond, values, prefix):\n         pass\n \n-    def visit_array_type(self, name, info, element_type):\n+    def visit_array_type(self, name, info, ifcond, element_type):\n         pass\n \n-    def visit_object_type(self, name, info, base, members, variants):\n+    def visit_object_type(self, name, info, ifcond, base, members, variants):\n         pass\n \n-    def visit_object_type_flat(self, name, info, members, variants):\n+    def visit_object_type_flat(self, name, info, ifcond, members, variants):\n         pass\n \n-    def visit_alternate_type(self, name, info, variants):\n+    def visit_alternate_type(self, name, info, ifcond, variants):\n         pass\n \n-    def visit_command(self, name, info, arg_type, ret_type,\n+    def visit_command(self, name, info, ifcond, arg_type, ret_type,\n                       gen, success_response, boxed):\n         pass\n \n-    def visit_event(self, name, info, arg_type, boxed):\n+    def visit_event(self, name, info, ifcond, arg_type, boxed):\n         pass\n \n \n@@ -1157,7 +1157,7 @@ class QAPISchemaEnumType(QAPISchemaType):\n         return 'string'\n \n     def visit(self, visitor):\n-        visitor.visit_enum_type(self.name, self.info,\n+        visitor.visit_enum_type(self.name, self.info, self.ifcond,\n                                 self.member_names(), self.prefix)\n \n \n@@ -1189,7 +1189,8 @@ class QAPISchemaArrayType(QAPISchemaType):\n         return 'array of ' + elt_doc_type\n \n     def visit(self, visitor):\n-        visitor.visit_array_type(self.name, self.info, self.element_type)\n+        visitor.visit_array_type(self.name, self.info, self.ifcond,\n+                                 self.element_type)\n \n \n class QAPISchemaObjectType(QAPISchemaType):\n@@ -1270,9 +1271,9 @@ class QAPISchemaObjectType(QAPISchemaType):\n         return 'object'\n \n     def visit(self, visitor):\n-        visitor.visit_object_type(self.name, self.info,\n+        visitor.visit_object_type(self.name, self.info, self.ifcond,\n                                   self.base, self.local_members, self.variants)\n-        visitor.visit_object_type_flat(self.name, self.info,\n+        visitor.visit_object_type_flat(self.name, self.info, self.ifcond,\n                                        self.members, self.variants)\n \n \n@@ -1416,7 +1417,8 @@ class QAPISchemaAlternateType(QAPISchemaType):\n         return 'value'\n \n     def visit(self, visitor):\n-        visitor.visit_alternate_type(self.name, self.info, self.variants)\n+        visitor.visit_alternate_type(self.name, self.info, self.ifcond,\n+                                     self.variants)\n \n     def is_empty(self):\n         return False\n@@ -1456,7 +1458,7 @@ class QAPISchemaCommand(QAPISchemaEntity):\n             assert isinstance(self.ret_type, QAPISchemaType)\n \n     def visit(self, visitor):\n-        visitor.visit_command(self.name, self.info,\n+        visitor.visit_command(self.name, self.info, self.ifcond,\n                               self.arg_type, self.ret_type,\n                               self.gen, self.success_response, self.boxed)\n \n@@ -1486,7 +1488,8 @@ class QAPISchemaEvent(QAPISchemaEntity):\n             raise QAPISemError(self.info, \"Use of 'boxed' requires 'data'\")\n \n     def visit(self, visitor):\n-        visitor.visit_event(self.name, self.info, self.arg_type, self.boxed)\n+        visitor.visit_event(self.name, self.info, self.ifcond,\n+                            self.arg_type, self.boxed)\n \n \n class QAPISchema(object):\ndiff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py\nindex 974d0a4a80..669aef1eb7 100644\n--- a/scripts/qapi-commands.py\n+++ b/scripts/qapi-commands.py\n@@ -240,7 +240,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):\n         self._regy = None\n         self._visited_ret_types = None\n \n-    def visit_command(self, name, info, arg_type, ret_type,\n+    def visit_command(self, name, info, ifcond, arg_type, ret_type,\n                       gen, success_response, boxed):\n         if not gen:\n             return\ndiff --git a/scripts/qapi-event.py b/scripts/qapi-event.py\nindex 07b4b70199..dda496e824 100644\n--- a/scripts/qapi-event.py\n+++ b/scripts/qapi-event.py\n@@ -163,7 +163,7 @@ class QAPISchemaGenEventVisitor(QAPISchemaVisitor):\n         self.defn += gen_enum_lookup(event_enum_name, self._event_names)\n         self._event_names = None\n \n-    def visit_event(self, name, info, arg_type, boxed):\n+    def visit_event(self, name, info, ifcond, arg_type, boxed):\n         self.decl += gen_event_send_decl(name, arg_type, boxed)\n         self.defn += gen_event_send(name, arg_type, boxed)\n         self._event_names.append(name)\ndiff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py\nindex 0002bc1a68..56c1f9d548 100644\n--- a/scripts/qapi-introspect.py\n+++ b/scripts/qapi-introspect.py\n@@ -142,26 +142,26 @@ const QLitObject %(c_name)s = %(c_string)s;\n     def visit_builtin_type(self, name, info, json_type):\n         self._gen_qlit(name, 'builtin', {'json-type': json_type})\n \n-    def visit_enum_type(self, name, info, values, prefix):\n+    def visit_enum_type(self, name, info, ifcond, values, prefix):\n         self._gen_qlit(name, 'enum', {'values': values})\n \n-    def visit_array_type(self, name, info, element_type):\n+    def visit_array_type(self, name, info, ifcond, element_type):\n         element = self._use_type(element_type)\n         self._gen_qlit('[' + element + ']', 'array', {'element-type': element})\n \n-    def visit_object_type_flat(self, name, info, members, variants):\n+    def visit_object_type_flat(self, name, info, ifcond, members, variants):\n         obj = {'members': [self._gen_member(m) for m in members]}\n         if variants:\n             obj.update(self._gen_variants(variants.tag_member.name,\n                                           variants.variants))\n         self._gen_qlit(name, 'object', obj)\n \n-    def visit_alternate_type(self, name, info, variants):\n+    def visit_alternate_type(self, name, info, ifcond, variants):\n         self._gen_qlit(name, 'alternate',\n                        {'members': [{'type': self._use_type(m.type)}\n                                     for m in variants.variants]})\n \n-    def visit_command(self, name, info, arg_type, ret_type,\n+    def visit_command(self, name, info, ifcond, arg_type, ret_type,\n                       gen, success_response, boxed):\n         arg_type = arg_type or self._schema.the_empty_object_type\n         ret_type = ret_type or self._schema.the_empty_object_type\n@@ -169,7 +169,7 @@ const QLitObject %(c_name)s = %(c_string)s;\n                        {'arg-type': self._use_type(arg_type),\n                         'ret-type': self._use_type(ret_type)})\n \n-    def visit_event(self, name, info, arg_type, boxed):\n+    def visit_event(self, name, info, ifcond, arg_type, boxed):\n         arg_type = arg_type or self._schema.the_empty_object_type\n         self._gen_qlit(name, 'event', {'arg-type': self._use_type(arg_type)})\n \ndiff --git a/scripts/qapi-types.py b/scripts/qapi-types.py\nindex 7e3051dbb9..915786c463 100644\n--- a/scripts/qapi-types.py\n+++ b/scripts/qapi-types.py\n@@ -195,7 +195,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):\n         self.decl += gen_type_cleanup_decl(name)\n         self.defn += gen_type_cleanup(name)\n \n-    def visit_enum_type(self, name, info, values, prefix):\n+    def visit_enum_type(self, name, info, ifcond, values, prefix):\n         # Special case for our lone builtin enum type\n         # TODO use something cleaner than existence of info\n         if not info:\n@@ -206,7 +206,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):\n             self._fwdecl += gen_enum(name, values, prefix)\n             self.defn += gen_enum_lookup(name, values, prefix)\n \n-    def visit_array_type(self, name, info, element_type):\n+    def visit_array_type(self, name, info, ifcond, element_type):\n         if isinstance(element_type, QAPISchemaBuiltinType):\n             self._btin += gen_fwd_object_or_array(name)\n             self._btin += gen_array(name, element_type)\n@@ -218,7 +218,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):\n             self.decl += gen_array(name, element_type)\n             self._gen_type_cleanup(name)\n \n-    def visit_object_type(self, name, info, base, members, variants):\n+    def visit_object_type(self, name, info, ifcond, base, members, variants):\n         # Nothing to do for the special empty builtin\n         if name == 'q_empty':\n             return\n@@ -232,7 +232,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):\n             # implicit types won't be directly allocated/freed\n             self._gen_type_cleanup(name)\n \n-    def visit_alternate_type(self, name, info, variants):\n+    def visit_alternate_type(self, name, info, ifcond, variants):\n         self._fwdecl += gen_fwd_object_or_array(name)\n         self.decl += gen_object(name, None, [variants.tag_member], variants)\n         self._gen_type_cleanup(name)\ndiff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py\nindex 7e1cfc13f0..aceea2a9f9 100644\n--- a/scripts/qapi-visit.py\n+++ b/scripts/qapi-visit.py\n@@ -282,7 +282,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):\n         self.decl = self._btin + self.decl\n         self._btin = None\n \n-    def visit_enum_type(self, name, info, values, prefix):\n+    def visit_enum_type(self, name, info, ifcond, values, prefix):\n         # Special case for our lone builtin enum type\n         # TODO use something cleaner than existence of info\n         if not info:\n@@ -293,7 +293,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):\n             self.decl += gen_visit_decl(name, scalar=True)\n             self.defn += gen_visit_enum(name)\n \n-    def visit_array_type(self, name, info, element_type):\n+    def visit_array_type(self, name, info, ifcond, element_type):\n         decl = gen_visit_decl(name)\n         defn = gen_visit_list(name, element_type)\n         if isinstance(element_type, QAPISchemaBuiltinType):\n@@ -304,7 +304,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):\n             self.decl += decl\n             self.defn += defn\n \n-    def visit_object_type(self, name, info, base, members, variants):\n+    def visit_object_type(self, name, info, ifcond, base, members, variants):\n         # Nothing to do for the special empty builtin\n         if name == 'q_empty':\n             return\n@@ -317,7 +317,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):\n             self.decl += gen_visit_decl(name)\n             self.defn += gen_visit_object(name, base, members, variants)\n \n-    def visit_alternate_type(self, name, info, variants):\n+    def visit_alternate_type(self, name, info, ifcond, variants):\n         self.decl += gen_visit_decl(name)\n         self.defn += gen_visit_alternate(name, variants)\n \ndiff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py\nindex 73cfb01727..cf63cb0006 100755\n--- a/scripts/qapi2texi.py\n+++ b/scripts/qapi2texi.py\n@@ -207,7 +207,7 @@ class QAPISchemaGenDocVisitor(qapi.QAPISchemaVisitor):\n     def visit_begin(self, schema):\n         self.out = ''\n \n-    def visit_enum_type(self, name, info, values, prefix):\n+    def visit_enum_type(self, name, info, ifcond, values, prefix):\n         doc = self.cur_doc\n         if self.out:\n             self.out += '\\n'\n@@ -216,7 +216,7 @@ class QAPISchemaGenDocVisitor(qapi.QAPISchemaVisitor):\n                              body=texi_entity(doc, 'Values',\n                                               member_func=texi_enum_value))\n \n-    def visit_object_type(self, name, info, base, members, variants):\n+    def visit_object_type(self, name, info, ifcond, base, members, variants):\n         doc = self.cur_doc\n         if base and base.is_implicit():\n             base = None\n@@ -226,7 +226,7 @@ class QAPISchemaGenDocVisitor(qapi.QAPISchemaVisitor):\n                              name=doc.symbol,\n                              body=texi_entity(doc, 'Members', base, variants))\n \n-    def visit_alternate_type(self, name, info, variants):\n+    def visit_alternate_type(self, name, info, ifcond, variants):\n         doc = self.cur_doc\n         if self.out:\n             self.out += '\\n'\n@@ -234,7 +234,7 @@ class QAPISchemaGenDocVisitor(qapi.QAPISchemaVisitor):\n                              name=doc.symbol,\n                              body=texi_entity(doc, 'Members'))\n \n-    def visit_command(self, name, info, arg_type, ret_type,\n+    def visit_command(self, name, info, ifcond, arg_type, ret_type,\n                       gen, success_response, boxed):\n         doc = self.cur_doc\n         if self.out:\n@@ -249,7 +249,7 @@ class QAPISchemaGenDocVisitor(qapi.QAPISchemaVisitor):\n                             name=doc.symbol,\n                             body=body)\n \n-    def visit_event(self, name, info, arg_type, boxed):\n+    def visit_event(self, name, info, ifcond, arg_type, boxed):\n         doc = self.cur_doc\n         if self.out:\n             self.out += '\\n'\ndiff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out\nindex 7fbaea19bc..fc5fd25f1b 100644\n--- a/tests/qapi-schema/qapi-schema-test.out\n+++ b/tests/qapi-schema/qapi-schema-test.out\n@@ -56,18 +56,25 @@ alternate TestIfAlternate\n     tag type\n     case foo: int\n     case bar: TestStruct\n+    if defined(TEST_IF_ALT) && defined(TEST_IF_STRUCT)\n command TestIfCmd q_obj_TestIfCmd-arg -> None\n    gen=True success_response=True boxed=False\n+    if defined(TEST_IF_CMD) && defined(TEST_IF_STRUCT)\n enum TestIfEnum ['foo', 'bar']\n+    if defined(TEST_IF_ENUM)\n event TestIfEvent q_obj_TestIfEvent-arg\n    boxed=False\n+    if defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT)\n object TestIfStruct\n     member foo: int optional=False\n+    if defined(TEST_IF_STRUCT)\n object TestIfUnion\n     member type: TestIfUnionKind optional=False\n     tag type\n     case foo: q_obj_TestStruct-wrapper\n+    if defined(TEST_IF_UNION) && defined(TEST_IF_STRUCT)\n enum TestIfUnionKind ['foo']\n+    if defined(TEST_IF_UNION) && defined(TEST_IF_STRUCT)\n object TestStruct\n     member integer: int optional=False\n     member boolean: bool optional=False\n@@ -190,8 +197,10 @@ object q_obj_EVENT_D-arg\n     member enum3: EnumOne optional=True\n object q_obj_TestIfCmd-arg\n     member foo: TestIfStruct optional=False\n+    if defined(TEST_IF_CMD) && defined(TEST_IF_STRUCT)\n object q_obj_TestIfEvent-arg\n     member foo: TestIfStruct optional=False\n+    if defined(TEST_IF_EVT) && defined(TEST_IF_STRUCT)\n object q_obj_TestStruct-wrapper\n     member data: TestStruct optional=False\n object q_obj_UserDefFlatUnion2-base\ndiff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py\nindex c7724d3437..8627f978af 100644\n--- a/tests/qapi-schema/test-qapi.py\n+++ b/tests/qapi-schema/test-qapi.py\n@@ -17,12 +17,13 @@ import sys\n \n \n class QAPISchemaTestVisitor(QAPISchemaVisitor):\n-    def visit_enum_type(self, name, info, values, prefix):\n+    def visit_enum_type(self, name, info, ifcond, values, prefix):\n         print 'enum %s %s' % (name, values)\n         if prefix:\n             print '    prefix %s' % prefix\n+        self._print_if(ifcond)\n \n-    def visit_object_type(self, name, info, base, members, variants):\n+    def visit_object_type(self, name, info, ifcond, base, members, variants):\n         print 'object %s' % name\n         if base:\n             print '    base %s' % base.name\n@@ -30,21 +31,25 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):\n             print '    member %s: %s optional=%s' % \\\n                 (m.name, m.type.name, m.optional)\n         self._print_variants(variants)\n+        self._print_if(ifcond)\n \n-    def visit_alternate_type(self, name, info, variants):\n+    def visit_alternate_type(self, name, info, ifcond, variants):\n         print 'alternate %s' % name\n         self._print_variants(variants)\n+        self._print_if(ifcond)\n \n-    def visit_command(self, name, info, arg_type, ret_type,\n+    def visit_command(self, name, info, ifcond, arg_type, ret_type,\n                       gen, success_response, boxed):\n         print 'command %s %s -> %s' % \\\n             (name, arg_type and arg_type.name, ret_type and ret_type.name)\n         print '   gen=%s success_response=%s boxed=%s' % \\\n             (gen, success_response, boxed)\n+        self._print_if(ifcond)\n \n-    def visit_event(self, name, info, arg_type, boxed):\n+    def visit_event(self, name, info, ifcond, arg_type, boxed):\n         print 'event %s %s' % (name, arg_type and arg_type.name)\n         print '   boxed=%s' % boxed\n+        self._print_if(ifcond)\n \n     @staticmethod\n     def _print_variants(variants):\n@@ -53,6 +58,12 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):\n             for v in variants.variants:\n                 print '    case %s: %s' % (v.name, v.type.name)\n \n+    @staticmethod\n+    def _print_if(ifcond):\n+        if ifcond:\n+            print '    if %s' % ifcond\n+\n+\n schema = QAPISchema(sys.argv[1])\n schema.visit(QAPISchemaTestVisitor())\n \n",
    "prefixes": [
        "v3",
        "07/50"
    ]
}