diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2019-04-26 21:42:16 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2019-04-27 15:26:11 +0200 |
commit | b3fd7b53ffcdb3d4ed4adaa42c73762a26cc6df8 (patch) | |
tree | 784e9604fec2904f8eba380dc32d1c5246307572 /coccinelle/run-coccinelle.sh | |
parent | aeafd03a2b3d8cd1e5f91d218196578911330f8e (diff) | |
download | systemd-b3fd7b53ffcdb3d4ed4adaa42c73762a26cc6df8.tar.gz |
coccinelle: add explicit statement isomorphisms
Coccinelle needs a custom isomorphism file with rules (isomorphisms) how
to correctly rewrite conditions with explicit NULL checks (i.e.
if (ptr == NULL)) to their shorter form (i.e. if (!ptr)). Coccinelle
already contains such isomorphisms in its default .iso file, however,
they're in the opposite direction, which results in useless output from
coccinelle/equals-null.cocci.
With this fix, `spatch` should no longer report patches like:
@@ -628,8 +628,9 @@ static int path_deserialize_item(Unit *u
f = path_result_from_string(value);
if (f < 0)
log_unit_debug(u, "Failed to parse result value: %s", value);
- else if (f != PATH_SUCCESS)
- p->result = f;
+ else {if (f != PATH_SUCCESS)
+ p->result = f;
+ }
} else
log_unit_debug(u, "Unknown serialization key: %s", key);
Diffstat (limited to 'coccinelle/run-coccinelle.sh')
-rwxr-xr-x | coccinelle/run-coccinelle.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/coccinelle/run-coccinelle.sh b/coccinelle/run-coccinelle.sh index 520de0ac42..4d882112e6 100755 --- a/coccinelle/run-coccinelle.sh +++ b/coccinelle/run-coccinelle.sh @@ -2,6 +2,7 @@ top="$(git rev-parse --show-toplevel)" files="$(git ls-files ':/*.[ch]')" +iso_defs="$top/coccinelle/systemd-definitions.iso" args= case "$1" in @@ -21,7 +22,7 @@ for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do TMPFILE=`mktemp` echo "+ spatch --sp-file $SCRIPT $args ..." parallel --halt now,fail=1 --keep-order --noswap --max-args=20 \ - spatch --sp-file $SCRIPT $args ::: $files \ + spatch --iso-file $iso_defs --sp-file $SCRIPT $args ::: $files \ 2>"$TMPFILE" || cat "$TMPFILE" echo -e "--x-- Processed $SCRIPT --x--\n" done |