All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] Adding a newline after a variable definition
@ 2021-06-23  8:38 Fuad Tabba
  2021-06-23  8:54 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Fuad Tabba @ 2021-06-23  8:38 UTC (permalink / raw)
  To: cocci

Hi,

I have a semantic patch that inserts a new variable definition into a
function. I would like it if that variable definition is the only one
in the function, then it should add a new line to separate the
definition from following statements (Linux code formatting style).

I thought that doing this in two steps might be easier, i.e., add the
definition, then check and add a newline if a statement follows:

@@
identifier x;
identifier func;
statement S;
@@
func(...)
 {
struct kvm_cpu_context *x = ...;
+ newline;
S
...
 }

The above works as expected, and it adds "newline;" after the
definition of x. The thing is, is it possible to add an actual new
line, as opposed to a non-whitespace string? I tried just using a +
but that didn't work.

Thanks!
/fuad
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, other threads:[~2021-06-23  9:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23  8:38 [Cocci] Adding a newline after a variable definition Fuad Tabba
2021-06-23  8:54 ` Julia Lawall
2021-06-23  9:03   ` Fuad Tabba

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.