From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGSHi-0004G5-HV for qemu-devel@nongnu.org; Tue, 05 Jan 2016 09:08:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGSHe-0000zc-Og for qemu-devel@nongnu.org; Tue, 05 Jan 2016 09:08:26 -0500 Received: from mail-ob0-x233.google.com ([2607:f8b0:4003:c01::233]:34119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGSHe-0000zU-LI for qemu-devel@nongnu.org; Tue, 05 Jan 2016 09:08:22 -0500 Received: by mail-ob0-x233.google.com with SMTP id wp13so139510902obc.1 for ; Tue, 05 Jan 2016 06:08:22 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1450717720-9627-3-git-send-email-eblake@redhat.com> References: <1450717720-9627-1-git-send-email-eblake@redhat.com> <1450717720-9627-3-git-send-email-eblake@redhat.com> Date: Tue, 5 Jan 2016 15:08:22 +0100 Message-ID: From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v8 02/35] qapi: Avoid use of misnamed DO_UPCAST() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Michael Roth , QEMU , Markus Armbruster Hi On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake wrote: > The macro DO_UPCAST() is incorrectly named: it converts from a > parent class to a derived class (which is a downcast). Better, > and more consistent with some of the other qapi visitors, is > to use the container_of() macro through a to_FOO() helper. I think DO_UPCAST() is confusing too. I assume you'd rather see it renamed or replaced by to_FOO() helpers appropriately (I wonder if coccinelle would be able to do that ;) > Our current definition of container_of() is weaker than > DO_UPCAST(), in that it does not require the derived class to > have Visitor * as its first member, but this does not hurt our > usage patterns in qapi visitors. Reviewed-by: Marc-Andr=C3=A9 Lureau --=20 Marc-Andr=C3=A9 Lureau