Received: from eggs.gnu.org ([2001:4830:134:3::10]:34403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLxpA-0006fE-R9 for qemu-devel@nongnu.org; Wed, 20 Jan 2016 13:49:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLxp9-0006U4-Vn for qemu-devel@nongnu.org; Wed, 20 Jan 2016 13:49:44 -0500 From: Markus Armbruster References: <1453219845-30939-1-git-send-email-eblake@redhat.com> <1453219845-30939-16-git-send-email-eblake@redhat.com> Date: Wed, 20 Jan 2016 19:49:31 +0100 In-Reply-To: <1453219845-30939-16-git-send-email-eblake@redhat.com> (Eric Blake's message of "Tue, 19 Jan 2016 09:10:23 -0700") Message-ID: <874me8m6h0.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v9 15/37] qom: Swap 'name' next to visitor in ObjectPropertyAccessor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Eduardo Habkost , "open list:nvme" , "Michael S. Tsirkin" , John Snow , Jason Wang , qemu-devel@nongnu.org, Alexander Graf , Keith Busch , marcandre.lureau@redhat.com, Gonglei , "open list:sPAPR" , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Richard Henderson , Jiri Slaby , Andreas =?utf-8?Q?F=C3=A4rber?= , David Gibson Eric Blake writes: > Similar to the previous patch, it's nice to have all functions > in the tree that involve a visitor and a name for conversion to > or from QAPI to consistently stick the 'name' parameter next > to the Visitor parameter. > > Done by manually changing include/qom/object.h and qom/object.c, > then running this Coccinelle script and touching up the fallout > (Coccinelle insisted on adding some trailing whitespace). > > @ rule1 @ > identifier fn; > type Object, Visitor, Error; > identifier obj, v, opaque, name, errp; > @@ > void fn > - (Object *obj, Visitor *v, void *opaque, const char *name, > + (Object *obj, Visitor *v, const char *name, void *opaque, > Error **errp) { ... } I think we want to match void functions with exactly these parameter types. The parameter names don't matter. However, the actual match is looser! For instance, it also matches void foo(int *pi, unsigned *pu, void *vp, const char *cp, double **dpp) { } This could mess up unrelated function. I could double-check it doesn't, but I'd rather have a narrower match instead. Can't give one offhand, though. Ideas? > > @@ > identifier rule1.fn; > expression obj, v, opaque, name, errp; > @@ > fn(obj, v, > - opaque, name, > + name, opaque, > errp) The rule1.fn restricts the match to functions changed by the previous rule. Good. > > Signed-off-by: Eric Blake > Reviewed-by: Marc-Andr=C3=A9 Lureau