Hi On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake <ebl...@redhat.com> 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é Lureau <marcandre.lur...@redhat.com> -- Marc-André Lureau