On Mon, 28 Feb 2011, Derek M Jones wrote:

> Jesper, Julia,
> 
> > > static char *hex(char digest[16], char buff[33])
> ...
> 
> > > +++
> > >
> >> @ grab_sizeof @
> > > type T;
> > > function f;
> > > identifier x, buff;
> 
> constant bound_1, bound_2;
> 
> >> @@
> > >
> > > static char *f(T x[16], char buff[33])
> 
> This could be generalised to:
> 
> static char *f(T x[bound_1], char buff[bound_2])
> 
> > I'll look into the array problem.  But I'm not sure why you want to match
> > an array.  sizeof does the right thing on arrays.  You want to match the
> > pointer case.  You could try just:
> 
> It is a surprisingly common developer mistake to forget that array
> parameters are implicitly converted to a pointer.

Indeed (I forgot :)

> > @@
> > expression *x;
> > @@
> >
> > * sizeof(x)
> 
> I suspect that this has a different kind of representation in
> Coccinelle.

Yes, good point.  I will look into the pointer parameter problem.

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

Reply via email to