[Cocci] Matching function pointer typedef

Jerome Glisse jglisse at redhat.com
Tue May 15 23:26:59 CEST 2018


On Tue, May 15, 2018 at 10:53:36PM +0200, Julia Lawall wrote:
> 
> 
> On Tue, 15 May 2018, Håkon Løvdal wrote:
> 
> > It's been a while since I used coccinelle, but I think to remember that you must
> > (and in any case should) keep the non-changing parts outside of the
> > +/- lines, e.g.
> >
> > @@
> > @@
> >          typedef void (*toto_t)(int a, int b
> > +        , int c
> >          );
> 
> I think that typedefs of function pointers just don't work.  It is looking
> for typedef type name;.  I can try to fix this.
> 

Above does not work either. The error is same roughly spatch complains
that it matches whole content ... I have a workaround, namely abusing
gcc which accept:

typedef void toto_t(int a, int b);

For function pointer typedef and then coccinelle on function declaration
do work. Still it would be nice if coccinelle can understand function
pointer typedef.

Jérôme


More information about the Cocci mailing list