On Thu, 4 Nov 2010, Vasiliy Kulikov wrote:

> Hi,
> 
> Is there any way to search for C99 array definition with non-constant
> size?
> 
> int x = 2;
> ...
> int y[x];

I'm not sure what you are asking here.  I tried the following, and it 
worked fine:

@@
identifier x,y;
expression E;
@@

int x = E;
...
int
*y[x]
;

The only problem is that for code like the following:

int main () {
  int x = 2;
  int a[3], y[x], b[9];
  return;
}

Coccinelle complains about "More that one variable in decl. Have to split 
to transform."  In this case, I don't see why there should be a problem 
with it, because I have put the * on just the declared variable itself.  I 
can look into whether the problem can be fixed.  However, it should work 
find if you put a position variable on the declaration that is undesirable 
and then print out the position.

Or did you mean to look for something else?

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

Reply via email to