cocci.systeme.lip6.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Find expressions of given type
@ 2015-09-14  8:29 Jan Moskyto Matejka
  2015-09-14  9:38 ` [Cocci] Checking lock usage SF Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jan Moskyto Matejka @ 2015-09-14  8:29 UTC (permalink / raw)
  To: cocci

Hello,

I'm trying to match all expressions of a given type. I want to check
whether all accesses to any part of some struct are locked.

In the hypothetical case (which doesn't happen), every access to that
struct would create a local variable of the wanted type and I could then
match it with something like this:

@@
identifier	   i;
@@

...
my_specific_type  *var;
...
var->i
...

Unfortunately, this structure may be also referenced from another
structure, like this:

struct A { int foo; int bar; };
struct B { int foo; struct A *bar };

struct B *b;
...
b->bar->foo;

I would like to write something like:

@@
expression struct A* E;
@@

...
+E
...

and match every occurence of not only variables of the given type, but
also an expression.

I was first trying to find some hint in the doc, found 
expression struct *E;
which is almost what I want but still too broad.

Does there exist some way to
A) achieve the behaviour I want by config
or
B) implement it?

If A, could you please give me a hint?
If B, I wanted to implement it but got totally lost in the code. Could
you please give me a pointer, where to begin? I'd like to contribute the
result then.

Best regards and thanks
MQ

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-14 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14  8:29 [Cocci] Find expressions of given type Jan Moskyto Matejka
2015-09-14  9:38 ` [Cocci] Checking lock usage SF Markus Elfring
2015-09-14 14:16 ` [Cocci] Find expressions of given type Peter Senna Tschudin
2015-09-14 19:46 ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).