In the following and similar code fragment(s):

struct s {
  int x[10];
};

void f (struct s *sp, int i, int j, int k)
{
  sp->x[i++] = j;
  sp->x[i++] = k;
}

I would like to replace 'sp->x[i++] = j' to 'sp->x[i] = j, i++' and so.
My spatch is:

@@
identifier I1, I2;
expression E;
@@
- I1->x[I2++] = E
+ I1->x[I2] = E, I2++

It doesn't work with the message:

Fatal error: exception Failure("plus: parse error:
 = File "test.cocci", line 6, column 15,  charpos = 72
    around = ',', whole content = + I1->x[I2] = E, I2++
")

Why it is so? Spatch complains about syntax error at ',',
but IIUC C comma operator is syntactically correct here.
Spatch is 1.0.0-rc12.

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

Reply via email to