There is actually no problem with bool.  Just put typedef bool; in the
metavariable list of the first rule in which bool appears.

Got it. Thanks.
- Ajay

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

> On Fri, 19 Aug 2011, Ajay Panyala wrote:
>
> > Sorry. That was a typo. I created test.cocci in a hurry to send it to
> you.
> > What I was actually trying to do is something like this
> >
> > @@
> > type t;
> > @@
> >
> > t getfoo() {
> > ...
> > }
> > +//SEDREP bool localfunc( int *lo, int *hi, int *map)
> > +{
> > + int np = foo(lo, hi, map);
> > + return np;
> > +}
> >
> > where the function returns bool. Since bool is not in C
> > I comment out the declaration part and later run it through SED
> > to remove the //SEDREP part.
> >
> > I think commenting out the declaration part is causing the problem.
>
> Sure.  It considers the whole line to be a comment, and thus you are
> adding a block of code in a position where only function and variable
> declarations are allowed.  Coccinelle expects both the matched code and
> the added code to be valid C.
>
> There is actually no problem with bool.  Just put typedef bool; in the
> metavariable list of the first rule in which bool appears.
>
> julia
>
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to