]> git.ipfire.org Git - thirdparty/systemd.git/blame - coccinelle/run-coccinelle.sh
coccinelle: ignore function transformations causing recursion
[thirdparty/systemd.git] / coccinelle / run-coccinelle.sh
CommitLineData
2d0bc684
LP
1#!/bin/bash -e
2
12b74c38 3top="$(git rev-parse --show-toplevel)"
31d31f20 4files="$(git ls-files ':/*.[ch]')"
b3fd7b53 5iso_defs="$top/coccinelle/systemd-definitions.iso"
00bfe67f
ZJS
6args=
7
8case "$1" in
cc5549ca
ZJS
9 -i)
10 args="$args --in-place"
11 shift
12 ;;
00bfe67f 13esac
31d31f20 14
3b253ad6 15if ! parallel -h >/dev/null; then
cc5549ca
ZJS
16 echo 'Please install GNU parallel (package "parallel")'
17 exit 1
3b253ad6
ZJS
18fi
19
12b74c38 20for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do
cc5549ca
ZJS
21 echo "--x-- Processing $SCRIPT --x--"
22 TMPFILE=`mktemp`
23 echo "+ spatch --sp-file $SCRIPT $args ..."
24 parallel --halt now,fail=1 --keep-order --noswap --max-args=20 \
b3fd7b53 25 spatch --iso-file $iso_defs --sp-file $SCRIPT $args ::: $files \
cc5549ca
ZJS
26 2>"$TMPFILE" || cat "$TMPFILE"
27 echo -e "--x-- Processed $SCRIPT --x--\n"
2d0bc684 28done