From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMBp0-0005KS-HB for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:46:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMBoz-0006Xx-FF for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:46:30 -0500 Date: Thu, 21 Jan 2016 10:46:16 +0100 From: Kevin Wolf Message-ID: <20160121094616.GA4490@noname.redhat.com> References: <1453219845-30939-1-git-send-email-eblake@redhat.com> <1453219845-30939-16-git-send-email-eblake@redhat.com> <874me8m6h0.fsf@blackfin.pond.sub.org> <569FF411.3080005@redhat.com> <87twm7mgta.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87twm7mgta.fsf@blackfin.pond.sub.org> 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: Markus Armbruster Cc: Paolo Bonzini , Eduardo Habkost , "open list:nvme" , "Michael S. Tsirkin" , Jason Wang , qemu-devel@nongnu.org, Alexander Graf , Keith Busch , Gonglei , "open list:sPAPR" , Gerd Hoffmann , Igor Mammedov , marcandre.lureau@redhat.com, Jiri Slaby , David Gibson , John Snow , Andreas =?iso-8859-1?Q?F=E4rber?= , Richard Henderson Am 21.01.2016 um 10:18 hat Markus Armbruster geschrieben: > Eric Blake writes: > > On 01/20/2016 11:49 AM, Markus Armbruster wrote: > >> Eric Blake writes: > >> > >> However, the actual match is looser! For instance, it also matches > >> > >> void foo(int *pi, unsigned *pu, void *vp, const char *cp, double **dpp) > >> { > >> } > > > > Uggh. My intent was to match exactly 'Object *' and 'Visitor *' as the > > first two types, where 'int *' and 'unsigned *' are NOT matches. But I > > don't know Coccinelle well enough to make that blatantly obvious (is my > > declaration of 'type Object' not correct?). > > 'type Object' makes 'Object' a metavariable matching any C type. I can't say anything on this one, because I've never used 'type'. You may or may not be right. However... > >> 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? > > > > Is 'typedef' better than 'type' for constraining the type of the first > > two arguments? > > Matches any C typedef name. Less wrong, but still wrong :) ...I'm pretty sure that this is wrong and 'typedef' only declares that a specific type exists as a typedef. > > Or does Coccinelle do literal matches on anything you > > don't pre-declare, as in: > > Yes, but... > > > @ rule1 @ > > identifier fn; > > 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) { ... } > > ... when I try that, spatch throws a parse error. Because you need to declare the typedef. :-) I had a similar problem and asked Julia about it at KVM Forum, so I'm pretty sure that it's right. Kevin