summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2020-04-21 20:23:33 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2020-04-21 23:21:04 +0200
commite4ff03935c800b91e6919afef7515f318f9f697c (patch)
tree00cb680dfb86a4768ff8e02c65ebbf0abb3e0381 /coccinelle
parent33b58dfb41a0c0db8110f1fc6dd0fc54e0d9cd4a (diff)
downloadsystemd-e4ff03935c800b91e6919afef7515f318f9f697c.tar.gz
tree-wide: formatting tweaks reported by Coccinelle
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/strempty.cocci16
1 files changed, 14 insertions, 2 deletions
diff --git a/coccinelle/strempty.cocci b/coccinelle/strempty.cocci
index 7901da3652..0868184c5d 100644
--- a/coccinelle/strempty.cocci
+++ b/coccinelle/strempty.cocci
@@ -1,6 +1,18 @@
@@
-/* Avoid running this transformation on the strempty function itself */
-position p : script:python() { p[0].current_element != "strempty" };
+/* Avoid running this transformation on the strempty function itself and
+ * on the "make_expression" macro in src/libsystemd/sd-bus/bus-convenience.c.
+ * As Coccinelle's Location object doesn't support macro "detection", use
+ * a pretty horrifying combo of specifying a file and a special "something_else"
+ * position element, which is, apparently, the default value of
+ * "current_element" before it's set (according to the source code), thus
+ * matching any "top level" position, including macros. Let's hope we never
+ * introduce a function called "something_else"...
+ */
+position p : script:python() {
+ not (p[0].current_element == "strempty" or
+ (p[0].file == "src/libsystemd/sd-bus/bus-convenience.c" and
+ p[0].current_element == "something_else"))
+};
expression s;
@@
(