summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/empty-if.cocci47
-rw-r--r--coccinelle/errno.cocci42
-rw-r--r--coccinelle/while-true.cocci12
3 files changed, 78 insertions, 23 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
+- }
)
diff --git a/coccinelle/errno.cocci b/coccinelle/errno.cocci
index 073d905141..45f2b6e9d5 100644
--- a/coccinelle/errno.cocci
+++ b/coccinelle/errno.cocci
@@ -1,42 +1,48 @@
@@
identifier r;
-expression t, e;
+expression e;
@@
- r = -e;
-- log_error_errno(e, t);
-+ r = log_error_errno(e, t);
+- log_error_errno(e,
++ r = log_error_errno(e,
+ ...);
@@
identifier r;
-expression t, e;
+expression e;
@@
-- log_error_errno(e, t);
+- log_error_errno(e,
++ r = log_error_errno(e,
+ ...);
- r = -e;
-+ r = log_error_errno(e, t);
@@
identifier r;
-expression t, e;
+expression e;
@@
-- r = log_error_errno(e, t);
+- r = log_error_errno(e,
++ return log_error_errno(e,
+ ...);
- return r;
-+ return log_error_errno(e, t);
@@
identifier r;
-expression t, e;
+expression e;
@@
- r = -e;
-- log_warning_errno(e, t);
-+ r = log_warning_errno(e, t);
+- log_warning_errno(e,
++ r = log_warning_errno(e,
+ ...);
@@
identifier r;
-expression t, e;
+expression e;
@@
-- log_warning_errno(e, t);
+- log_warning_errno(e,
++ r = log_warning_errno(e,
+ ...);
- r = -e;
-+ r = log_warning_errno(e, t);
@@
identifier r;
-expression t, e;
+expression e;
@@
-- r = log_warning_errno(e, t);
+- r = log_warning_errno(e,
++ return log_warning_errno(e,
+ ...);
- return r;
-+ return log_warning_errno(e, t);
diff --git a/coccinelle/while-true.cocci b/coccinelle/while-true.cocci
new file mode 100644
index 0000000000..c23fb11f22
--- /dev/null
+++ b/coccinelle/while-true.cocci
@@ -0,0 +1,12 @@
+@@
+statement s;
+@@
+- while (true)
++ for (;;)
+s
+@@
+statement s;
+@@
+- while (1)
++ for (;;)
+s