On Sun, Oct 10, 2010 at 15:27 +0200, Julia Lawall wrote:
> On Sun, 10 Oct 2010, Vasiliy Kulikov wrote:
> 
> > Hi,
> > 
> > Is there any way to define X as _any_ struct, no matter what struct
> > exactly?
> > 
> > @@
> > type T;
> > struct T *a, *b;
> > @@
> 
> The following is intended to work:
> 
> @@
> identifier x;
> struct x *a;
> @@
> 
> *a
> 
> It parses, but I'm not getting any matches, even if the struct has the 
> name x.  I will have to look into it.  I don't think I can do it today, 
> unfortunately.

I've tried to emulate it this way:

@rr@
type T;
identifier a;
expression E;
position pp;
@@

T a...@pp[e];

@r@
type T;
identifier a;
position p != rr.pp;
@@

T a...@p;


@s@
identifier r.a;
@@

* smth with a


But r.a is sometimes an array, not a pointer - if there is anywhere in
the file variable with the same name, but in another scope.  Is there
any way to identify it?  More precisely, I need r.a and s.a to be the
same variable from the same scope.


Thanks,

-- 
Vasiliy
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to