mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-08 21:17:47 +03:00
coccinelle: introduce drop-braces transformation
to drop braces around single-line if statements. Also, prefix it with zz- so it runs as the last one, so it's able to fix stuff tweaked by previous transformations.
This commit is contained in:
parent
7e97526421
commit
44e66de0f2
27
coccinelle/zz-drop-braces.cocci
Normal file
27
coccinelle/zz-drop-braces.cocci
Normal file
@ -0,0 +1,27 @@
|
||||
@@
|
||||
position p : script:python() { p[0].file != "src/journal/lookup3.c" };
|
||||
identifier id;
|
||||
expression e;
|
||||
@@
|
||||
if (...)
|
||||
- {
|
||||
(
|
||||
id@p(...);
|
||||
|
|
||||
e@p;
|
||||
)
|
||||
- }
|
||||
|
||||
@@
|
||||
position p : script:python() { p[0].file != "src/journal/lookup3.c" };
|
||||
identifier id;
|
||||
expression e;
|
||||
@@
|
||||
if (...)
|
||||
- {
|
||||
(
|
||||
return id@p(...);
|
||||
|
|
||||
return e@p;
|
||||
)
|
||||
- }
|
Loading…
Reference in New Issue
Block a user