summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-09 14:23:02 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-09 14:59:51 +0200
commit1f6b411372076426c0faf0bb350437fb4d82931f (patch)
tree32a52b3e2bb04731cc857b738e989531a4144516 /coccinelle
parent94c156cd452424ea59931920df2454d9da7cb774 (diff)
tree-wide: update empty-if coccinelle script to cover empty-while and more
Let's also clean up single-line while and for blocks.
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/empty-if.cocci47
1 files changed, 42 insertions, 5 deletions
diff --git a/coccinelle/empty-if.cocci b/coccinelle/empty-if.cocci
index ebd0bfddce..026c461ee6 100644
--- a/coccinelle/empty-if.cocci
+++ b/coccinelle/empty-if.cocci
@@ -1,19 +1,56 @@
@@
-expression e, f;
+expression e, f, g, h, i, j;
statement s, t;
@@
(
if (e) {
-if (f) s
+(
+if (h) s
+|
+if (h) s else t
+|
+while (h) s
+|
+for (h; i; j) s
+)
}
|
-if (e) {
-if (f) s
-else t
+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
+- }
)