> > How to express that in smpl? 
> 
> ... when != S
> {Some statement}
> 
> where S is a statement metavariable.  {Some statement} might also be 
> another statement metavariable if you don't know what kind of statement to 
> expect.  There is probably some more complicated way of dealing with 
> functions that only have declarations and no following statement, but I 
> guess that would be quite rare.

Thanks Julia. That worked, except that it skipped the empty line
after the declarations too, so I ended up with

foo()
{
        int x;
                 <--- empty line
        int y;   <--- my new statement

But I guess that can be manually removed or is there a way to tell this
cocci too?

> 
> I think you could also use
> 
> ... when = D
> 
> where D is a declaration metavariable.

That didn't work, always get a parse error on the when.

I'm not sure "declaration" is the right way to declare a
a declaration meta variable. The grammar mentions "declarer" but that 
didn't work.

declaration D;          
@@
function() {
        ... when = D

        

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

Reply via email to