summaryrefslogtreecommitdiff
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2019-10-23 15:37:20 +1000
committerteor <teor@torproject.org>2019-10-24 11:40:51 +1000
commit9a96068a0be44bc94ae771225abde3ad8698a800 (patch)
tree6a2f9f4c59d8420512fe75391be45274eebe2a90 /scripts/coccinelle
parenta03c0394a3f6885cd10f1c1d7e93834b39ab8fde (diff)
downloadtor-9a96068a0be44bc94ae771225abde3ad8698a800.tar.gz
tor-9a96068a0be44bc94ae771225abde3ad8698a800.zip
scripts/cocci: Add an exceptions file to try_parse.sh
Set $TOR_COCCI_EXCEPTIONS_FILE to the name of an exceptions file, containing a list of filename patterns matched by 'grep -f'. Part of 31919.
Diffstat (limited to 'scripts/coccinelle')
-rwxr-xr-xscripts/coccinelle/try_parse.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/coccinelle/try_parse.sh b/scripts/coccinelle/try_parse.sh
index 0f91e31702..6cdd968a0b 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,6 +14,16 @@ exitcode=0
for fn in "$@"; do
+ 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 \
-I "$top" -I "$top"/src -I "$top"/ext --defined COCCI \
--parse-c "$fn" \