diff options
author | teor <teor@torproject.org> | 2019-10-23 22:17:37 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-10-24 14:09:45 +1000 |
commit | 71b8b7ee2ddfa5e2f8d6bf8f754276f512b5fd1c (patch) | |
tree | b9efc7342065cb18192c1edc07e0cd99da404373 /scripts/coccinelle | |
parent | 330717f01845a2fea45b79d914161d6a2a897815 (diff) | |
download | tor-71b8b7ee2ddfa5e2f8d6bf8f754276f512b5fd1c.tar.gz tor-71b8b7ee2ddfa5e2f8d6bf8f754276f512b5fd1c.zip |
scripts/cocci: Check owned src in check_cocci_parse.sh by default
Check the tor-owned sources in an 0.3.5 directory layout, if no
files are provided on the command line.
Part of 31919.
Diffstat (limited to 'scripts/coccinelle')
-rwxr-xr-x | scripts/coccinelle/check_cocci_parse.sh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/scripts/coccinelle/check_cocci_parse.sh b/scripts/coccinelle/check_cocci_parse.sh index a422a99dac..5c27c7bc88 100755 --- a/scripts/coccinelle/check_cocci_parse.sh +++ b/scripts/coccinelle/check_cocci_parse.sh @@ -1,8 +1,11 @@ #!/bin/sh # If we have coccinelle installed, run try_parse.sh on every filename passed -# as an argument. Uses the default coccinelle exceptions file, if -# $TOR_COCCI_EXCEPTIONS_FILE is not set. +# as an argument. If no filenames are supplied, scan a standard Tor 0.3.5 or +# later directory layout. +# +# Uses the default coccinelle exceptions file, or $TOR_COCCI_EXCEPTIONS_FILE, +# if it is set. # # Use TOR_COCCI_EXCEPTIONS_FILE=/dev/null check_cocci_parse.sh to disable # the default exception file. @@ -23,8 +26,21 @@ if ! command -v spatch; then exit "$exitcode" fi -"$try_parse" "$@" -exitcode=$? +if test $# -ge 1 ; then + "$try_parse" "$@" + exitcode=$? +else + # This is the layout in 0.3.5 + "$try_parse" \ + src/lib/*/*.[ch] \ + src/core/*/*.[ch] \ + src/feature/*/*.[ch] \ + src/app/*/*.[ch] \ + src/test/*.[ch] \ + src/test/*/*.[ch] \ + src/tools/*.[ch] + exitcode=$? +fi if test "$exitcode" != 0 ; then echo "Please fix these cocci parsing errors in the above files" |