All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] GNU-style function calls
@ 2026-07-06 17:50 Arsen Arsenović
  2026-07-06 18:26 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Arsen Arsenović @ 2026-07-06 17:50 UTC (permalink / raw)
  To: cocci

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-06 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 17:50 [cocci] GNU-style function calls Arsen Arsenović
2026-07-06 18:26 ` Julia Lawall
2026-07-06 18:35   ` Arsen Arsenović

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.