On Thu, 18 Aug 2011, Ajay Panyala wrote:

> Hello,
> 
> Is it possible to insert an entire function definition (or multiple lines of
> some code) before/after and existing function.
> 
> For example
> 
> @@
> type t;
> @@
> 
> t foo(...) { ... }    --> foo is an existing function
> +t bar(int s){         --> bar is the new function
> + // some code
> +}
> 
> If I just try to insert a single line of code after the existing function
> definition (foo) it works,
> but not otherwise.

Could you send a more precise example?  Because I tried:

@@
type t;
@@

t foo(...) { ...}
+ t bar(int s) {
+  // some code
+ }

and the C file:

int foo() { return 1; }

and it works completely fine for me.

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

Reply via email to