2022-06-08 14:57:36 -07:00
|
|
|
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
DIR="src/bin"
|
|
|
|
COCCI_FILES="
|
|
|
|
andconst.cocci
|
|
|
|
badzero.cocci
|
|
|
|
continue.cocci
|
|
|
|
free_stack.cocci
|
|
|
|
mutex.cocci
|
|
|
|
notand.cocci
|
|
|
|
notnull.cocci
|
|
|
|
null_ref.cocci
|
|
|
|
unused.cocci
|
|
|
|
use_after_iter.cocci
|
2022-06-19 12:41:03 -07:00
|
|
|
div_round_up.cocci
|
2022-06-08 14:57:36 -07:00
|
|
|
"
|
|
|
|
|
|
|
|
HAS_ERROR=0
|
|
|
|
for f in $COCCI_FILES; do
|
2022-06-19 12:41:03 -07:00
|
|
|
OPTIONS=""
|
|
|
|
if [ "$COCCI_FILES" = "div_round_up" ]; then
|
|
|
|
OPTIONS="--defined DIV_ROUND_UP"
|
|
|
|
fi
|
|
|
|
CMD="spatch --timeout 200 --very-quiet --cocci-file scripts/coccinelle/$f --include-headers --dir $DIR $OPTIONS"
|
|
|
|
OUT=$($CMD)
|
|
|
|
echo "$CMD"
|
|
|
|
if [ -n "$OUT" ]; then
|
|
|
|
echo "$OUT"
|
|
|
|
HAS_ERROR=1
|
|
|
|
fi
|
2022-06-08 14:57:36 -07:00
|
|
|
done
|
|
|
|
exit $HAS_ERROR
|