Re: [cocci] GNU-style function calls
Julia Lawall <[email protected]> Mon, 6 Jul 2026 14:26:46 -0400
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
There is a =E2=80=94simple-spacing argument where it should preserve the spa= cing you put in the semantic patch. Sent from my iPhone > On 6 Jul 2026, at 13:50, Arsen Arsenovi=C4=87 <[email protected]> wr= ote: >=20 > =EF=BB=BFHi! >=20 > I work on GCC, meaning we use GNU-style function calls, where the > call operator is preceded by a whitespace, like so: >=20 > foo (a, b); >=20 > I've had decent luck with applying Cocci to the codebase, but if Cocci > rewrites a call, it removes the whitespace preceding the call operator: >=20 > /tmp$ cat test.cc > void > thing () > { > foo (a, b); > } > /tmp$ cat test.cocci > @@ > expression x, y; > @@ >=20 > - foo (x, y); > + foo (y, x); > /tmp$ spatch --sp-file test.cocci --c++=3D14 test.cc > init_defs_builtins: /usr/lib64/coccinelle/standard.h > HANDLING: test.cc > diff =3D > --- test.cc > +++ /tmp/cocci-output-157607-636042-test.cc > @@ -1,5 +1,5 @@ > void > thing () > { > - foo (a, b); > + foo(b, a); > } > /tmp$ >=20 > This isn't too much of a problem; I go back and modify the function > calls manually, but it would be nice if Cocci handled it. >=20 > Is it possible to keep the spaces in line with the code style w/ Cocci? >=20 > Thanks in advance! Have a lovely day. > -- > Arsen Arsenovi=C4=87 > <signature.asc>