On Fri, Mar 08, 2019 at 07:57:08PM +0100, Julia Lawall wrote:
> 
> 
> On Fri, 8 Mar 2019, Jerome Glisse wrote:
> 
> > Coccinelle seems to have issue with function pointer. For instance
> > if i want to add a new argument to a function pointer typdef i need
> > to replace the whole typedef as one line. For instance:
> >
> > test.c:
> > typedef int (*filler_t)(void *, struct page *);
> >
> > test.spatch:
> > @@
> > type T1, T2;
> > @@
> > -typedef int (*filler_t)(T1, T2);
> > +typedef int (*filler_t)(T1, struct address_space *, T2);
> >
> > Anything else will not work and also if the function pointer typedef
> > spread accross multiple line then the above does not work, in fact
> > i have not found a work around for that case.
> >
> > I am missing some syntax that make this work with coccinelle ?
> 
> Thanks for the report.  Is the error you got something like:
> 
> error in collection of - tokens: line 4 less than line 6
> 
> I will have to look into it.

With:
@@
type T1, T2;
@@
typedef int (*filler_t)(T1,
+struct address_space *,
T2);

I get:
error in collection of - tokens: line 4 less than line 6

The error message depends on the semantic patch i tried several
variation hopping to find some syntax that would work but failed
so far.


In case of multiline typdef:
minus: parse error: 
  File "typedef-func.spatch", line 6, column 0, charpos = 101
  around = '',
  whole content = 

test.c:
typedef int (*filler_t)(void *,
    struct page *);

test.spatch
@@
type T1, T2;
@@
-typedef int (*filler_t)(T1,
+typedef int (*filler_t)(T1, struct address_space *,
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to