summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSumera Priyadarsini <sylphrenadin@gmail.com>2020-11-25 02:02:12 +0530
committerJulia Lawall <Julia.Lawall@inria.fr>2020-12-24 12:59:43 +0100
commitd8f6e5c6c83737cfdad46077e614885a3db9e809 (patch)
treef067df0e5205251202fc7fae956ac92c971c4f47 /scripts
parentd2ee8447e1bed7def30bab1748c876b8bd4e0876 (diff)
scripts: coccicheck: Correct usage of make coccicheck
The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the error: ./scripts/coccicheck: line 65: -1: shift count out of range This happens because every time the C variable is specified, the shell arguments need to be "shifted" in order to take only the last argument, which is the C file to test. These shell arguments mostly comprise flags that have been set in the Makefile. However, when coccicheck is specified in the make command as a rule, the number of shell arguments is zero, thus passing the invalid value -1 to the shift command, resulting in an error. Modify coccicheck to print correct usage of make coccicheck so as to avoid the error. Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/coccicheck12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck
index d7f6b7ff130a..65fee63aeadb 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -60,6 +60,18 @@ COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}
if [ "$C" = "1" -o "$C" = "2" ]; then
ONLINE=1
+ if [[ $# -le 0 ]]; then
+ echo ''
+ echo 'Specifying both the variable "C" and rule "coccicheck" in the make
+command results in a shift count error.'
+ echo ''
+ echo 'Try specifying "scripts/coccicheck" as a value for the CHECK variable instead.'
+ echo ''
+ echo 'Example: make C=2 CHECK=scripts/coccicheck drivers/net/ethernet/ethoc.o'
+ echo ''
+ exit 1
+ fi
+
# Take only the last argument, which is the C file to test
shift $(( $# - 1 ))
OPTIONS="$COCCIINCLUDE $1"