Please see test.c and test.cocci (files attached)
I am using version rc4. I get

spatch -sp_file test.cocci test.c -o testNew.c
init_defs_builtins: /opt/tools/coccinelle/share/coccinelle/standard.h
Fatal error: exception Failure("incompatible minus and plus code starting on
lines 6 and 6")


Thanks
Ajay

On Fri, Aug 19, 2011 at 3:52 AM, Julia Lawall <[email protected]> wrote:

> 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
>
long getfoo()
{
  int offs = 0;
  long it;
  it = func1();
  return it;
}

Attachment: test.cocci
Description: Binary data

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

Reply via email to