[cocci] GNU-style function calls
Arsen Arsenović <[email protected]> Mon, 06 Jul 2026 19:50:24 +0200
| Newsgroups | fr.inria.cocci |
|---|---|
| Organization | BayLibre |
| Message-ID | <[email protected]> |
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Hi!
I work on GCC, meaning we use GNU-style function calls, where the
call operator is preceded by a whitespace, like so:
foo (a, b);
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:
/tmp$ cat test.cc
void
thing ()
{
foo (a, b);
}
/tmp$ cat test.cocci
@@
expression x, y;
@@
- 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=20
--- 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.
Is it possible to keep the spaces in line with the code style w/ Cocci?
Thanks in advance! Have a lovely day.
=2D-=20
Arsen Arsenovi=C4=87
--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQEKBAEWCgCyFiEE/uKz0RP8AKMWLWBhUsKUMB6ixJMFAmpL6uAbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGRUUyQjNEMTEzRkMwMEEzMTYyRDYw
NjE1MkMyOTQzMDFFQTJDNDkzGBxhYXJzZW5vdmljQGJheWxpYnJlLmNvbQAKCRBS
wpQwHqLEk6mcAP4xDqx5jutyx6mVie0MppEFU887sRa0wgKGCZy478Ey/AD/T7bS
oKZzh+3MgpvIIWroipMDnBXo3lVFejLG/HBcKAk=
=gBds
-----END PGP SIGNATURE-----
--=-=-=--