From: "Arsen Arsenović" <aarsenovic@baylibre.com>
To: cocci@inria.fr
Subject: [cocci] GNU-style function calls
Date: Mon, 06 Jul 2026 19:50:24 +0200 [thread overview]
Message-ID: <86h5mc6m8v.fsf@baylibre.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]
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++=14 test.cc
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: test.cc
diff =
--- test.cc
+++ /tmp/cocci-output-157607-636042-test.cc
@@ -1,5 +1,5 @@
void
thing ()
{
- foo (a, b);
+ foo(b, a);
}
/tmp$
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.
--
Arsen Arsenović
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 430 bytes --]
next reply other threads:[~2026-07-06 17:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 17:50 Arsen Arsenović [this message]
2026-07-06 18:26 ` [cocci] GNU-style function calls Julia Lawall
2026-07-06 18:35 ` Arsen Arsenović
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86h5mc6m8v.fsf@baylibre.com \
--to=aarsenovic@baylibre.com \
--cc=cocci@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.