Received: from eggs.gnu.org ([2001:4830:134:3::10]:55347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgUhW-0000ns-0q for qemu-devel@nongnu.org; Mon, 28 Sep 2015 05:26:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgUhS-0001C8-1d for qemu-devel@nongnu.org; Mon, 28 Sep 2015 05:26:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgUhR-0001C3-S4 for qemu-devel@nongnu.org; Mon, 28 Sep 2015 05:26:21 -0400 From: Markus Armbruster References: <1442872682-6523-1-git-send-email-eblake@redhat.com> <1442872682-6523-6-git-send-email-eblake@redhat.com> <87a8sbga01.fsf@blackfin.pond.sub.org> <56041E2A.1070509@redhat.com> <87612zbx2h.fsf@blackfin.pond.sub.org> <5605CB76.3090009@redhat.com> Date: Mon, 28 Sep 2015 11:26:19 +0200 In-Reply-To: <5605CB76.3090009@redhat.com> (Eric Blake's message of "Fri, 25 Sep 2015 16:32:22 -0600") Message-ID: <87r3liki84.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v5 05/46] qapi: Test use of 'number' within alternates List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: marcandre.lureau@redhat.com, DirtY.iCE.hu@gmail.com, Michael Roth , ehabkost@redhat.com, qemu-devel@nongnu.org Eric Blake writes: > On 09/24/2015 10:29 AM, Markus Armbruster wrote: > >>>>> + >>>>> + /* FIXME: Order of alternate should not affect semantics */ >>>> >>>> Inhowfar does it affect semantics? Or asked differently: what exactly >>>> is wrong with this test now? >>>> >>>>> + v = visitor_input_test_init(data, "42"); >>>>> + visit_type_AltThree(v, &three, NULL, &error_abort); >>>>> + g_assert_cmpint(three->kind, ==, ALT_THREE_KIND_N); >>>>> + g_assert_cmpfloat(three->n, ==, 42); >>>>> + qapi_free_AltThree(three); >>>>> + one = NULL; >>> >>> >>> AltTwo and AltThree are ostensibly the same struct (two branches, one >>> for 'str' and one for 'number', just in a different order), but they >>> parsed differently (AltTwo failed, AltThree succeeded). The bug is >>> fixed later when the order of the branch declaration no longer impacts >>> the result of the parse. >> >> Then nothing is wrong with this test case, and the FIXME doesn't belong >> here. > > Actually, the test for AltThree succeeds only by accident. There are two > bugs at play; when I fix the first bug (order shouldn't matter: AltTwo > and AltThree should parse identically), then the second bug is finally > exposed (integers aren't being parsed as numbers, in either AltTwo or > AltThree). But I can certainly rework the FIXMEs both here and on the > first fix (19/46) to make it more obvious what the second fix (20/46) is > good for. Yes, please. I find the FIXME quoted above confusing, because it makes me look for problems exposed by this test when there are none.