All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <jglisse@redhat.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Changing function pointer typedef
Date: Fri, 8 Mar 2019 14:11:53 -0500	[thread overview]
Message-ID: <20190308191152.GD5618@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1903081956350.2518@hadrien>

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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply	other threads:[~2019-03-08 19:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08 18:19 [Cocci] Changing function pointer typedef Jerome Glisse
2019-03-08 18:57 ` Julia Lawall
2019-03-08 19:11   ` Jerome Glisse [this message]
2019-03-08 19:23     ` Julia Lawall
2019-03-08 19:32       ` Jerome Glisse
2019-03-17 18:43         ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190308191152.GD5618@redhat.com \
    --to=jglisse@redhat.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.