try_parse.sh (1246B)
1 #!/bin/sh 2 3 # Echo the name of every argument of this script that is not "perfect" 4 # according to coccinelle's --parse-c. 5 # 6 # If $TOR_COCCI_EXCEPTIONS_FILE is non-empty, skip any files that match the 7 # patterns in the exception file, according to "grep -f" 8 # 9 # If VERBOSE is non-empty, log spatch errors and skipped files. 10 11 top="$(dirname "$0")/../.." 12 13 exitcode=0 14 15 for fn in "$@"; do 16 17 if test "${TOR_COCCI_EXCEPTIONS_FILE}" ; then 18 skip_fn=$(echo "$fn" | grep -f "${TOR_COCCI_EXCEPTIONS_FILE}") 19 if test "${skip_fn}" ; then 20 if test "${VERBOSE}" != ""; then 21 echo "Skipping '${skip_fn}'" 22 fi 23 continue 24 fi 25 fi 26 27 if spatch --macro-file-builtins \ 28 "$top"/scripts/coccinelle/tor-coccinelle.h \ 29 --defined COCCI \ 30 --parse-c "$fn" \ 31 2>/dev/null | grep "perfect = 1" > /dev/null; then 32 : # it's perfect 33 else 34 echo "$fn" 35 if test "${VERBOSE}" != ""; then 36 spatch --macro-file-builtins \ 37 "$top"/scripts/coccinelle/tor-coccinelle.h \ 38 --defined COCCI \ 39 --parse-c "$fn" 40 fi 41 exitcode=1 42 fi 43 44 done 45 46 exit "$exitcode"