diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-03-18 11:59:53 +0100 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-03-18 11:59:53 +0100 |
commit | ca21d59a3fe1f13c852188eae33b7049a7f51b4f (patch) | |
tree | a2a0c191c9ea3906b4ab92fc342ea4b4cce1b928 /coccinelle | |
parent | 57ac6959f53762cf8e1d28289f443ad3572b1e31 (diff) | |
download | systemd-ca21d59a3fe1f13c852188eae33b7049a7f51b4f.tar.gz |
coccinelle: filter out a couple of 'false-positive' transformations
* 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)
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/flags-set.cocci | 3 | ||||
-rwxr-xr-x | coccinelle/run-coccinelle.sh | 1 | ||||
-rw-r--r-- | coccinelle/strjoina.cocci | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/coccinelle/flags-set.cocci b/coccinelle/flags-set.cocci index f6cc8ba68a..22620f1849 100644 --- a/coccinelle/flags-set.cocci +++ b/coccinelle/flags-set.cocci @@ -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) diff --git a/coccinelle/run-coccinelle.sh b/coccinelle/run-coccinelle.sh index 871547a881..d1af412acc 100755 --- a/coccinelle/run-coccinelle.sh +++ b/coccinelle/run-coccinelle.sh @@ -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)" diff --git a/coccinelle/strjoina.cocci b/coccinelle/strjoina.cocci index a6236eb0f9..b209633480 100644 --- a/coccinelle/strjoina.cocci +++ b/coccinelle/strjoina.cocci @@ -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); |