Received: from eggs.gnu.org ([2001:4830:134:3::10]:38053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb4ig-00066k-2M for qemu-devel@nongnu.org; Thu, 26 Mar 2015 06:08:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yb4ib-0007iT-Ty for qemu-devel@nongnu.org; Thu, 26 Mar 2015 06:08:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb4ib-0007i0-Nj for qemu-devel@nongnu.org; Thu, 26 Mar 2015 06:08:53 -0400 From: Markus Armbruster References: <1427227433-5030-1-git-send-email-eblake@redhat.com> <1427227433-5030-6-git-send-email-eblake@redhat.com> Date: Thu, 26 Mar 2015 11:08:49 +0100 In-Reply-To: <1427227433-5030-6-git-send-email-eblake@redhat.com> (Eric Blake's message of "Tue, 24 Mar 2015 14:03:30 -0600") Message-ID: <874mp86pfy.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v5 05/28] qapi: Better error messages for bad enums List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, lcapitulino@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wenchaoqemu@gmail.com Eric Blake writes: > The previous commit demonstrated that the generator had several > flaws with less-than-perfect enums: > - an enum that listed the same string twice (or two variant > strings that map to the same C enumerator) ended up generating > an invalid C enum > - because the generator adds a _MAX terminator to each enum, > the use of an enum member 'max' can also cause this clash > - if an enum omits 'data', the generator left a python stack > trace rather than a graceful message > - an enum that used a non-array 'data' was silently accepted by > the parser > - an enum that used non-string members in the 'data' member > was silently accepted by the parser > > Add check_enum to cover these situations, and update testcases > to match. While valid .json files won't trigger any of these > cases, we might as well be nicer to developers that make a typo > while trying to add new QAPI code. > > Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster