Sorry, I thought you wanted to create a nested function.  There is
currently no way to match a nested function.  It is not an intrinsic
limitation, just a matter of development effort.

julia

Then we come to the point I've mentioned in my initial posting: Writing nonfunctional but valid C, in order to write an extension.

In the case of the nested function I would assemble it from:
- a function declaration
- a label
- a block

I use the label, because I think it's not possible for coccinelle to match an 'anonymous' block.

~~~~~~~ nestedfunction.pseudoc ~~~~~~~~~~~
void outer(){
    void inner (); // declaration
    inner: { // a goto label and the beginning of a block
        printf("look Ma, I'm nested\n");
    } // end of the block
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

to

~~~~~~~~~~~ nested.c ~~~~~~~~~~~~
void outer(){
    void inner ();
    inner();
}

void inner () {
    printf("look Ma, I'm nested\n");
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Reply via email to