From: Wei Liu Subject: Re: [PATCH 2/3] libxl_types.idl: use empty Struct for invalid domain type Date: Thu, 10 Apr 2014 16:04:47 +0100 Message-ID: <20140410150447.GH5690@zion.uk.xensource.com> References: <1397133791-19885-1-git-send-email-wei.liu2@citrix.com> <1397133791-19885-3-git-send-email-wei.liu2@citrix.com> <1397133915.9862.162.camel@kazak.uk.xensource.com> <20140410130026.GE5690@zion.uk.xensource.com> <1397139886.9862.178.camel@kazak.uk.xensource.com> <20140410144158.GF5690@zion.uk.xensource.com> <1397141402.9862.192.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1397141402.9862.192.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: ian.jackson@eu.citrix.com, Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, Apr 10, 2014 at 03:50:02PM +0100, Ian Campbell wrote: > > > > > > And if it did could we not detect the use of None with an explicit check > > > > gentypes does that already. The result is not generating anything. > > So make it generate something? That's just a map_open/map_close isn't > it? > So if a keyed-union field is of type None: diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 1a3b91c..bfb95e2 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -220,6 +220,13 @@ def libxl_C_type_gen_json(ty, v, indent = " ", parent = None): s += "case %s:\n" % f.enumname if f.type is not None: s += libxl_C_type_gen_json(f.type, fexpr, indent + " ", nparent) + else: + s += " yajl_gen_map_open(hand);\n" + s += " if (s != yajl_gen_status_ok)\n" + s += " goto out;\n" + s += " yajl_gen_map_close(hand);\n" + s += " if (s != yajl_gen_status_ok)\n" + s += " goto out;\n" s += " break;\n" s += "}\n" elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None):