From: der.herr@hofr.at (Nicholas Mc Guire)
To: cocci@systeme.lip6.fr
Subject: [Cocci] simple scanner question
Date: Fri, 27 Dec 2013 11:37:58 +0100 [thread overview]
Message-ID: <20131227103758.GA11874@opentech.at> (raw)
In-Reply-To: <alpine.DEB.2.02.1312271118070.1979@localhost6.localdomain6>
On Fri, 27 Dec 2013, Julia Lawall wrote:
> > @assign@
> > expression s,var;
> > position p1,p2,p3;
> > statement S1;
> > identifier func,member;
> > @@
> >
> > ...func at p1(...){
>
> You don't need the ... before func. I guess you were worried about the
> return type, visibility modifiers, etc. You can just omit them.
>
> > ...
> > var = s->member at p2;
>
> Here there should be no semicolon. The semicolon means that the pattern
> should be a complete statement. In your code, the assignment is part of:
>
> struct transaction *t = ec->curr;
>
looks like that ; was my problem !
> so there is more to the complete statement than the assignment.
>
> > ...
> > spin_lock_irqsave at p3(s->lock,...);
>
> The example code is:
>
> spin_lock_irqsave(&ec->lock, flags);
>
> It looks like what is to the left of the -> is just an expression, but it
> is not due to the relative priority of & and ->. That is, it is not
>
> (&ec) -> lock
>
> it is:
>
> &(ec -> lock)
>
> So you need the & in your pattern. If there are cases where the structure
> really contains a pointer to a lock, then you might want to put
>
> \(&s->lock\|s->lock\)
>
> in place of s->lock.
>
> Then it should be OK :)
>
thanks for the clarification - up and running.
thx!
hofrat
prev parent reply other threads:[~2013-12-27 10:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 9:46 [Cocci] simple scanner question Nicholas Mc Guire
2013-12-27 10:22 ` Julia Lawall
2013-12-27 10:37 ` Nicholas Mc Guire [this message]
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=20131227103758.GA11874@opentech.at \
--to=der.herr@hofr.at \
--cc=cocci@systeme.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.