summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coccinelle/const-strlen.disabled (renamed from coccinelle/const-strlen.cocci)0
-rw-r--r--coccinelle/dup-fcntl.cocci4
-rw-r--r--coccinelle/flags-set.cocci19
-rw-r--r--coccinelle/isempty.cocci72
-rw-r--r--coccinelle/synthetic-errno.cocci6
5 files changed, 46 insertions, 55 deletions
diff --git a/coccinelle/const-strlen.cocci b/coccinelle/const-strlen.disabled
index 30a6e5a88e..30a6e5a88e 100644
--- a/coccinelle/const-strlen.cocci
+++ b/coccinelle/const-strlen.disabled
diff --git a/coccinelle/dup-fcntl.cocci b/coccinelle/dup-fcntl.cocci
index ef13564282..8b133b3a24 100644
--- a/coccinelle/dup-fcntl.cocci
+++ b/coccinelle/dup-fcntl.cocci
@@ -1,5 +1,7 @@
@@
+/* We want to stick with dup() in test-fd-util.c */
+position p : script:python() { p[0].file != "src/test/test-fd-util.c" };
expression fd;
@@
-- dup(fd)
+- dup@p(fd)
+ fcntl(fd, F_DUPFD, 3)
diff --git a/coccinelle/flags-set.cocci b/coccinelle/flags-set.cocci
index 1a70717e76..73966b02e5 100644
--- a/coccinelle/flags-set.cocci
+++ b/coccinelle/flags-set.cocci
@@ -1,15 +1,16 @@
@@
+/* Disable this transformation for the securebits-util.h, as it makes
+ * the expression there confusing. */
+position p : script:python() { p[0].file != "src/shared/securebits-util.h" };
expression x, y;
@@
-- ((x) & (y)) == (y)
+(
+- ((x@p) & (y)) == (y)
+ FLAGS_SET(x, y)
-@@
-expression x, y;
-@@
-- (x & (y)) == (y)
+|
+- (x@p & (y)) == (y)
+ FLAGS_SET(x, y)
-@@
-expression x, y;
-@@
-- ((x) & y) == y
+|
+- ((x@p) & y) == y
+ FLAGS_SET(x, y)
+)
diff --git a/coccinelle/isempty.cocci b/coccinelle/isempty.cocci
index d8d5275889..e0a9f07ca6 100644
--- a/coccinelle/isempty.cocci
+++ b/coccinelle/isempty.cocci
@@ -1,60 +1,42 @@
@@
+/* Disable this transformation for the test-string-util.c */
+position p : script:python() { p[0].file != "src/test/test-string-util.c" };
expression s;
@@
-- strv_length(s) == 0
+(
+- strv_length@p(s) == 0
+ strv_isempty(s)
-@@
-expression s;
-@@
-- strv_length(s) <= 0
+|
+- strv_length@p(s) <= 0
+ strv_isempty(s)
-@@
-expression s;
-@@
-- strv_length(s) > 0
+|
+- strv_length@p(s) > 0
+ !strv_isempty(s)
-@@
-expression s;
-@@
-- strv_length(s) != 0
+|
+- strv_length@p(s) != 0
+ !strv_isempty(s)
-@@
-expression s;
-@@
-- strlen(s) == 0
+|
+- strlen@p(s) == 0
+ isempty(s)
-@@
-expression s;
-@@
-- strlen(s) <= 0
+|
+- strlen@p(s) <= 0
+ isempty(s)
-@@
-expression s;
-@@
-- strlen(s) > 0
+|
+- strlen@p(s) > 0
+ !isempty(s)
-@@
-expression s;
-@@
-- strlen(s) != 0
+|
+- strlen@p(s) != 0
+ !isempty(s)
-@@
-expression s;
-@@
-- strlen_ptr(s) == 0
+|
+- strlen_ptr@p(s) == 0
+ isempty(s)
-@@
-expression s;
-@@
-- strlen_ptr(s) <= 0
+|
+- strlen_ptr@p(s) <= 0
+ isempty(s)
-@@
-expression s;
-@@
-- strlen_ptr(s) > 0
+|
+- strlen_ptr@p(s) > 0
+ !isempty(s)
-@@
-expression s;
-@@
-- strlen_ptr(s) != 0
+|
+- strlen_ptr@p(s) != 0
+ !isempty(s)
+)
diff --git a/coccinelle/synthetic-errno.cocci b/coccinelle/synthetic-errno.cocci
index 645bfc945f..3ddb69cb4c 100644
--- a/coccinelle/synthetic-errno.cocci
+++ b/coccinelle/synthetic-errno.cocci
@@ -2,9 +2,15 @@
expression e;
expression list args;
@@
+(
+/* Ignore one specific case in src/shared/bootspec.c where we want to stick
+ * with the log_debug() + return pattern */
+log_debug("Found no default boot entry :(");
+|
- log_debug(args);
- return -e;
+ return log_debug_errno(SYNTHETIC_ERRNO(e), args);
+)
@@
expression e;
expression list args;