From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Coccinelle question
Date: Mon, 29 Apr 2013 10:52:04 +0800 (SGT) [thread overview]
Message-ID: <alpine.DEB.2.02.1304291042250.2000@hadrien> (raw)
In-Reply-To: <CABjMXxrnhf54txKeu1G742YUqGGFP3j+xrCk340eBswQHrkRwA@mail.gmail.com>
On Wed, 24 Apr 2013, Majid Java wrote:
> Hello,
>
> last night i saw your website and projects from google search im really
> interested in what Coccinelle doing as i understand its kind of open source
> c parser library that follow in source code for variables and trace all
> source and headers for it,Right?
Specific points are that it follows the control-flow graph, via the ...
operator, it lets you match against metavariables that accumulate
properties from other matches, so you can make generic specifications, and
it is (mostly) aware of type information.
> now i have some questions:
> Are you take care of Variable Scopes when you are searching the source code?
Only somewhat. Within a given rule, links to where C variables are bound
are taken into account. But when a metavariable is inherited from one
rule to the next, all of this information is dropped. This is in part
because Coccinelle supports transformation as well as matching, and you
could transform the variable declaration itself. For example, you could
decide that you don't like variables being declared in the branches of an
if statement, and move the declarations up to top level. The same
variables are still attached to the same binder, but by the way Coccinelle
is constructed (added code is not really interpreted) it would be hard to
detect this.
This may seem like a bug, but in practice, at least on Linux code, it can
be more of a feature. Linux code often uses the same variable name for
the same conceptual quantity throughout a file, so it can be a way to find
all of the treatment of a particular value even when in the given file
there is no explicit interprocedural control-flow from one function using
the value to another. Of course the result is not safe, but someone
looking at the result may have enough expertise to know that the right
thing is being done.
If you have further questions please feel free to write back. If you join
the mailing list, you will get a faster response.
Thank you for your interest in Coccinelle.
julia
next prev parent reply other threads:[~2013-04-29 2:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 10:03 [Cocci] Coccinelle question Majid Java
2013-04-29 2:52 ` Julia Lawall [this message]
[not found] <83363fd9-a6b1-28be-e0a7-168f205cb551@student.ethz.ch>
[not found] ` <9c5ba524fec340a9c6ea8809e93ee0e8@lip6.fr>
2019-05-08 14:42 ` Nicolas Koenig
2019-05-09 7:13 ` 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=alpine.DEB.2.02.1304291042250.2000@hadrien \
--to=julia.lawall@lip6.fr \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox