diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2019-04-29 16:12:41 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2019-04-30 09:39:13 +0200 |
commit | ccd52940d06fc6ba06f44f7ea64f056529c0beb0 (patch) | |
tree | a324ee07cab511e52a921b13c564465fe22b4881 /coccinelle/isempty.cocci | |
parent | coccinelle: exclude JsonVariant* from the IN_SET transformation (diff) | |
download | systemd-ccd52940d06fc6ba06f44f7ea64f056529c0beb0.tar.xz systemd-ccd52940d06fc6ba06f44f7ea64f056529c0beb0.zip |
coccinelle: further restrict certain transformations
Some transformations generate results we don't want to keep, so
let's disable such transformations for specific files.
Also, disable const-strlen.cocci everywhere, as the STRLEN macro has a
pretty limited scope, so the transformation generates false positives in
most cases.
Diffstat (limited to 'coccinelle/isempty.cocci')
-rw-r--r-- | coccinelle/isempty.cocci | 72 |
1 files changed, 27 insertions, 45 deletions
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) +) |