Hi,

On Wed, Feb 29, 2012 at 23:19, Cyril Roelandt <[email protected]> wrote:

> This shows two issues :
>
> 1) The closing brace is deleted, and then added again, but is not properly
> indented.  Note that :
>
> if (...)
> {
> + foo();
> ...
> }
>
> produces a beautiful patch. Am I doing something wrong ?

Using statement list instead of "..." does not raise this problem.

>
>
> 2) It does not match the second if statement. Should I look for both :
>
> if (...)
> {
> ...
> }
>
> and
>
> if (...)
>    S
>
> or is there a nice trick that matches both ?
>
>

Matching both works (see below). I know there is support to remove the
braces if the modification
leads to a single statement. However, I don't remember if there is
something in the other way.

@@
statement list SS;
statement S;
@@
(
if (...) {
  SS
+ foo();
}
|
if (...)
- S
+ { S foo(); }
)

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

Reply via email to