From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJWiN-00026m-LS for qemu-devel@nongnu.org; Fri, 28 Feb 2014 18:19:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJWiH-0002Ex-2W for qemu-devel@nongnu.org; Fri, 28 Feb 2014 18:19:35 -0500 Received: from mail-pd0-x236.google.com ([2607:f8b0:400e:c02::236]:36157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJWiG-0002Ed-RO for qemu-devel@nongnu.org; Fri, 28 Feb 2014 18:19:28 -0500 Received: by mail-pd0-f182.google.com with SMTP id g10so1341765pdj.13 for ; Fri, 28 Feb 2014 15:19:27 -0800 (PST) Message-ID: <5311196F.5030608@gmail.com> Date: Sat, 01 Mar 2014 07:19:11 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1393499376-4374-1-git-send-email-wenchaoqemu@gmail.com> <1393499376-4374-5-git-send-email-wenchaoqemu@gmail.com> <530F902B.3010609@redhat.com> In-Reply-To: <530F902B.3010609@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V8 04/10] qapi script: check correctness of union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com, Wenchao Xia 于 2014/2/28 3:21, Eric Blake 写道: > On 02/27/2014 04:09 AM, Wenchao Xia wrote: >> From: Wenchao Xia >> >> Signed-off-by: Wenchao Xia >> Signed-off-by: Wenchao Xia > Double-S-o-B. I've also noticed that I'm getting undeliverable mail > rejections from your linux.vnet.ibm.com address: > > TCVM.MEGACENTER.DE.IBM.COM unable to deliver following mail to recipient(s): > > TCVM.MEGACENTER.DE.IBM.COM received negative reply: > 550 5.1.1: Recipient address rejected: User > unknown in local recipient table > I am using wenchaoqemu@gmail.com now, yep I should fix the SoB problem. >> --- >> scripts/qapi.py | 106 +++++++++++++++++++- >> tests/Makefile | 4 +- >> diff --git a/scripts/qapi.py b/scripts/qapi.py >> index 1954292..cea346f 100644 >> --- a/scripts/qapi.py >> +++ b/scripts/qapi.py >> @@ -50,6 +50,15 @@ class QAPISchemaError(Exception): >> def __str__(self): >> return "%s:%s:%s: %s" % (self.fp.name, self.line, self.col, self.msg) >> >> +class QAPIExprError(Exception): >> + def __init__(self, expr_info, msg): >> + self.fp = expr_info['fp'] >> + self.line = expr_info['line'] >> + self.msg = msg >> + >> + def __str__(self): >> + return "%s:%s: %s" % (self.fp.name, self.line, self.msg) >> + >> class QAPISchema: >> >> def __init__(self, fp): >> @@ -64,7 +73,10 @@ class QAPISchema: >> self.accept() >> >> while self.tok != None: >> - self.exprs.append(self.get_expr(False)) >> + expr_info = {'fp': fp, 'line': self.line} >> + expr_elem = {'expr': self.get_expr(False), >> + 'info': expr_info} >> + self.exprs.append(expr_elem) > Should these two hunks be part of 3/10? Or at least as a separate > patch? Or at least mentioned in the commit message? > Patch 3/10 only remember line number in class QAPISchema, as well as its member "cursor". The above code add line info in exprs, and if they are moved to last patch, the caller code should also go, which is a main part of patch. I'd like to improve the commit messages instead. >> @@ -162,6 +174,89 @@ class QAPISchema: >> raise QAPISchemaError(self, 'Expected "{", "[" or string') >> return expr >> >> +def find_base_fields(base): >> + base_struct_define = find_struct(base) >> + if not base_struct_define: >> + return None >> + return base_struct_define['data'] >> + >> +# Return the discriminator enum define if discrminator is specified as an > s/discrminator/discriminator/ > >