]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coccinelle: filter out a couple of 'false-positive' transformations 19036/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 18 Mar 2021 10:59:53 +0000 (11:59 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 18 Mar 2021 10:59:53 +0000 (11:59 +0100)
  * flag-set.cocci: perform the transformation only if the second
    argument is a constant
  * sd-journal/lookup3.c: skip the cocci completely for this file, since
    it's not "ours"
  * strjoina.cocci: skip the transformation on the "test_strjoina" test,
    since it intentionally tests the "incorrect" expression we're trying to
    transform (the same thing was already done in strjoin.cocci)

coccinelle/flags-set.cocci
coccinelle/run-coccinelle.sh
coccinelle/strjoina.cocci

index f6cc8ba68a08aac2ddbb286e58171bf452bd45d5..22620f184903b470ea3bc9645977d556e599ff9d 100644 (file)
@@ -8,7 +8,8 @@ position p : script:python() {
                  p[0].current_element == "log_set_max_level_realm" or
                  p[0].current_element == "unichar_is_valid")
         };
-expression x, y;
+expression x;
+constant y;
 @@
 (
 - ((x@p) & (y)) == (y)
index 871547a881d20c6a0b3dba06d64329976573b7d1..d1af412acce427636e788e75194531a578871de5 100755 (executable)
@@ -7,6 +7,7 @@ EXCLUDED_PATHS=(
     "src/basic/linux/*"
     # Symlinked to test-bus-vtable-cc.cc, which causes issues with the IN_SET macro
     "src/libsystemd/sd-bus/test-bus-vtable.c"
+    "src/libsystemd/sd-journal/lookup3.c"
 )
 
 top="$(git rev-parse --show-toplevel)"
index a6236eb0f9686e26236b405610b281adfe8583ff..b2096334805a61153f6653f34a9cd76312089a79 100644 (file)
@@ -1,6 +1,7 @@
 @@
+position p : script:python() { p[0].current_element != "test_strjoina" };
 expression n, m;
 expression list s;
 @@
-- n = strjoina(m, s, NULL);
+- n = strjoina@p(m, s, NULL);
 + n = strjoina(m, s);