On Sun, 9 Oct 2016, Nikolaus Rath wrote:

> On Oct 08 2016, Julia Lawall <[email protected]> wrote:
> >> > Write separate rules for that.  You would need one case for a local
> >> > variable and one case fora parameter.  You can actually probably just 
> >> > drop
> >> > the rule you have currently.  I would imagine something like the
> >> > following:
> >> >
> >> > @@
> >> > symbol f, se; // avoid unneeded warnings from Coccinelle
> >> > @@
> >> >
> >> > struct fuse_session *
> >> > -f
> >> > +se
> >> >  ;
> >> > <...
> >> > -f
> >> > +se
> >> > ...>
> >> > @@
> >> > identifier fn;
> >> > @@
> >> >
> >> > fn(...,struct fuse_session *f,...) { <...
> >> > -f
> >> > +se
> >> > ...> }
> >> >
> >> > I think that the symbol declaration has effect in the rest of the 
> >> > semantic
> >> > patch, and does not have to be repeated.  If you get warnings for the
> >> > second rule, just copy it down.
> >>
> >> I don't get Coccinelle warnings, but if I just use the two rules as
> >> you gave them, then it looks as if the second one isn't working:
> >>
> >> @@ -584,9 +584,9 @@ static struct fuse_ll_pipe *fuse_ll_get_
> >>
> >>  static void fuse_ll_clear_pipe(struct fuse_session *f)
> >>  {
> >> -  struct fuse_ll_pipe *llp = pthread_getspecific(f->pipe_key);
> >> +  struct fuse_ll_pipe *llp = pthread_getspecific(se->pipe_key);
> >>    if (llp) {
> >> -          pthread_setspecific(f->pipe_key, NULL);
> >> +          pthread_setspecific(se->pipe_key, NULL);
> >>            fuse_ll_pipe_free(llp);
> >>    }
> >>  }
> >>
> >>
> >> Is the problem that "...," does not match nothing, i.e. *f must not be
> >> the first argument of the function?
> >
> > It should match nothing.  What version of Coccinelle do you have?
>
> I used 1.0.0-rc22 (from Debian stable). However, I just downloaded the
> pre-compiled version from http://coccinelle.lip6.fr/download.php and it
> gives the same result.

OK, any rc is quite old.

> In case you want to try yourself: the sources that I'm running this on
> are available at https://github.com/libfuse/libfuse.

Thanks, I'll check on it.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to