On Thu, 4 Nov 2010, Michael Stefaniuc wrote:

> Julia Lawall wrote:
> > On Thu, 4 Nov 2010, Michael Stefaniuc wrote:
> > 
> >> Hello,
> >>
> >> the SmPL code
> >> @@ @@
> >> + lock();
> >>   bar( ... );
> >> + unlock();
> >>
> >> applied to
> >> void foo(void)
> >> {
> >>     bar(a,
> >>         b);
> >> }
> >>
> >> will produce following diff
> >> +    lock();
> >>      bar(a,
> >>          b);
> >> +        unlock();
> >>
> >> The indentation level of the code inserted after the multi-line function
> >> call matches that of the last argument and not that of the function
> >> identifier. I have tested this with versions 0.2.3 and 0.2.4rc5.
> > 
> > Thanks for the report.  I'm not surprised that it does this, but I'm not 
> > sure that I can easily fix it either.  It just has a stream of tokens when 
> > it is doing the unparsing, not a parse tree.  It is also thrown off when 
> > you add a statement after a conditional where the branch is indented.  
> > That case is indeed probably harder, because there is a complete statement 
> > on the line before.
> > 
> > Anyway, I will look into the function call case.
> Thanks but don't worry too much about this as it isn't a real problem.
> In most cases the diff needs to be edited anyway to fix the "every
> argument on a separate line" style.

You could try the option -smpl_spacing.  Then the spacing will try to 
follow what is expressed in the semantic patch.  I'm not sure how 
successful it will be thoug.  I think it was mainly intended for issues 
within a line, eg whether to put a space after "if" or after a comma.

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

Reply via email to