summaryrefslogtreecommitdiff
path: root/coccinelle/empty-if.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'coccinelle/empty-if.cocci')
-rw-r--r--coccinelle/empty-if.cocci56
1 files changed, 56 insertions, 0 deletions
diff --git a/coccinelle/empty-if.cocci b/coccinelle/empty-if.cocci
new file mode 100644
index 0000000000..026c461ee6
--- /dev/null
+++ b/coccinelle/empty-if.cocci
@@ -0,0 +1,56 @@
+@@
+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
+- }
+)