Systemd/coccinelle/empty-if.cocci
Lennart Poettering 1f6b411372 tree-wide: update empty-if coccinelle script to cover empty-while and more
Let's also clean up single-line while and for blocks.
2015-09-09 14:59:51 +02:00

57 lines
395 B
Plaintext

@@
expression e, f, g, h, i, j;
statement s, t;
@@
(
if (e) {
(
if (h) s
|
if (h) s else t
|
while (h) s
|
for (h; i; j) s
)
}
|
while (e) {
(
if (h) s
|
if (h) s else t
|
while (h) s
|
for (h; i; j) s
)
}
|
for (e; f; g) {
(
if (h) s
|
if (h) s else t
|
while (h) s
|
for (h; i; j) s
)
}
|
- if (e) {
+ if (e)
s
- }
|
- while (e) {
+ while (e)
s
- }
|
- for (e; f; g) {
+ for (e; f; g)
s
- }
)