summaryrefslogtreecommitdiff
path: root/scripts/coccinelle/try_parse.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coccinelle/try_parse.sh')
-rwxr-xr-xscripts/coccinelle/try_parse.sh25
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/coccinelle/try_parse.sh b/scripts/coccinelle/try_parse.sh
index 0f91e31702..a90e51b4aa 100755
--- a/scripts/coccinelle/try_parse.sh
+++ b/scripts/coccinelle/try_parse.sh
@@ -2,6 +2,11 @@
# Echo the name of every argument of this script that is not "perfect"
# according to coccinelle's --parse-c.
+#
+# If $TOR_COCCI_EXCEPTIONS_FILE is non-empty, skip any files that match the
+# patterns in the exception file, according to "grep -f"
+#
+# If VERBOSE is non-empty, log spatch errors and skipped files.
top="$(dirname "$0")/../.."
@@ -9,16 +14,28 @@ exitcode=0
for fn in "$@"; do
- if spatch -macro_file_builtins "$top"/scripts/coccinelle/tor-coccinelle.h \
- -I "$top" -I "$top"/src -I "$top"/ext --defined COCCI \
+ if test "${TOR_COCCI_EXCEPTIONS_FILE}" ; then
+ skip_fn=$(echo "$fn" | grep -f "${TOR_COCCI_EXCEPTIONS_FILE}")
+ if test "${skip_fn}" ; then
+ if test "${VERBOSE}" != ""; then
+ echo "Skipping '${skip_fn}'"
+ fi
+ continue
+ fi
+ fi
+
+ if spatch --macro-file-builtins \
+ "$top"/scripts/coccinelle/tor-coccinelle.h \
+ --defined COCCI \
--parse-c "$fn" \
2>/dev/null | grep "perfect = 1" > /dev/null; then
: # it's perfect
else
echo "$fn"
if test "${VERBOSE}" != ""; then
- spatch -macro_file_builtins "$top"/scripts/coccinelle/tor-coccinelle.h \
- -I "$top" -I "$top"/src -I "$top"/ext --defined COCCI \
+ spatch --macro-file-builtins \
+ "$top"/scripts/coccinelle/tor-coccinelle.h \
+ --defined COCCI \
--parse-c "$fn"
fi
exitcode=1