summaryrefslogtreecommitdiff
path: root/coccinelle/flags-set.cocci
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2019-04-29 16:12:41 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2019-04-30 09:39:13 +0200
commitccd52940d06fc6ba06f44f7ea64f056529c0beb0 (patch)
treea324ee07cab511e52a921b13c564465fe22b4881 /coccinelle/flags-set.cocci
parent1f7247903751a79caadc7999f1f5c0ed1d08c24d (diff)
downloadsystemd-ccd52940d06fc6ba06f44f7ea64f056529c0beb0.tar.gz
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/flags-set.cocci')
-rw-r--r--coccinelle/flags-set.cocci19
1 files changed, 10 insertions, 9 deletions
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)
+)