On Tue, 5 Apr 2011, Jani Monoses wrote:

> On 04/05/2011 05:57 PM, Jani Monoses wrote:
> > On 04/05/2011 05:14 PM, Jani Monoses wrote:
> > > What is the most straightforward way of commenting out blocks of the
> > > form:
> > >
> > >
> > > startBlock();
> > > operation1();
> > > ...
> > > operationn();
> > > endBlock();
> > >
> > > where startBlock()/endBlock() are the markers by putting them fully
> >
> > Ok, this is what I tried and did not work - I may have created a
> > non-standard patch because of the duplication in - and + areas.
> >
> > @@ @@
> >
> > -one();
> > +#ifdef 0
> > +one();
> >
> > > > > > > Fatal error: exception Failure("1 plus things remaining")
> >
> >
> > However the next one works - to me it looks the same but cleaner, to
> > Coccinelle it may be this is the only correct way to express what I wanted.
> >
> > @@ @@
> >
> > +#ifdef 0
> > one();
> >
> > Jani
> 
> #ifdef should be #if above but the behaviour is the same in both cases.
> 
> +#if 0
> +one();
> -one();
> 
> works as well - I did not realize the - and + bits order mattered.

Normally it doesn't, but #ifdef is not implemented like other things.  It 
is considered to be an arbitrary string that is glued on to the front of 
something.  Somehow your first attempt confuses it.

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

Reply via email to