From patchwork Wed Nov 4 06:20:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 539719 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 0270F1402D0 for ; Wed, 4 Nov 2015 17:25:23 +1100 (AEDT) Received: from localhost ([::1]:52838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtrVY-0003lN-IB for incoming@patchwork.ozlabs.org; Wed, 04 Nov 2015 01:25:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtrRN-00043F-TX for qemu-devel@nongnu.org; Wed, 04 Nov 2015 01:21:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtrRM-0006An-AM for qemu-devel@nongnu.org; Wed, 04 Nov 2015 01:21:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtrRM-00069u-0w for qemu-devel@nongnu.org; Wed, 04 Nov 2015 01:21:00 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 8E056AB1; Wed, 4 Nov 2015 06:20:59 +0000 (UTC) Received: from red.redhat.com (ovpn-113-189.phx2.redhat.com [10.3.113.189]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA46KqVb022634; Wed, 4 Nov 2015 01:20:59 -0500 From: Eric Blake To: qemu-devel@nongnu.org Date: Tue, 3 Nov 2015 23:20:36 -0700 Message-Id: <1446618049-13596-15-git-send-email-eblake@redhat.com> In-Reply-To: <1446618049-13596-1-git-send-email-eblake@redhat.com> References: <1446618049-13596-1-git-send-email-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: armbru@redhat.com, Michael Roth Subject: [Qemu-devel] [PATCH v9 14/27] qapi: Fix up commit 7618b91's clash sanity checking change 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 From: Markus Armbruster This hunk @@ -964,6 +965,7 @@ class QAPISchemaObjectType(QAPISchemaType): members = [] seen = {} for m in members: + assert c_name(m.name) not in seen seen[m.name] = m for m in self.local_members: m.check(schema, members, seen) is plainly broken. Asserting the members inherited from base don't clash is somewhat redundant, because self.base.check() just checked that. But it doesn't hurt. The idea to use c_name(m.name) instead of m.name for collision checking is sound, because we need to catch clashes between the m.name and between the c_name(m.name), and when two m.name clash, then their c_name() also clash. However, using c_name(m.name) instead of m.name in one of several places doesn't work. See the very next line. Keep the assertion, but drop the c_name() for now. A future commit will bring it back. Signed-off-by: Markus Armbruster Message-Id: <1446559499-26984-4-git-send-email-armbru@redhat.com> [change TAB to space] Signed-off-by: Eric Blake --- v9: new patch --- scripts/qapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 145dbfe..c910715 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -987,7 +987,7 @@ class QAPISchemaObjectType(QAPISchemaType): members = [] seen = {} for m in members: - assert c_name(m.name) not in seen + assert m.name not in seen seen[m.name] = m for m in self.local_members: m.check(schema, members, seen)