From: Julia Lawall <julia.lawall@inria.fr>
To: Sumera Priyadarsini <sylphrenadin@gmail.com>
Cc: Gilles.Muller@lip6.fr, nicolas.palix@imag.fr,
michal.lkml@markovi.net, cocci@systeme.lip6.fr,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts: coccicheck: Correct usage of make coccicheck
Date: Tue, 17 Nov 2020 11:22:34 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2011171121530.4598@hadrien> (raw)
In-Reply-To: <20201111111256.ea5l7slw4cc2fggm@adolin>
On Wed, 11 Nov 2020, Sumera Priyadarsini wrote:
> 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.
With this, one still gets the error from shift. Could you move the test
so that one only gets the error message?
julia
>
> Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
> ---
> scripts/coccicheck | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 209bb0427b43..b990c8a60a94 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -63,6 +63,18 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
>
> # Take only the last argument, which is the C file to test
> shift $(( $# - 1 ))
> + err=$?
> + if [[ $err -ne 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/staging/wfx/hi_t.o'
> + echo ''
> + exit 1
> + fi
> OPTIONS="$COCCIINCLUDE $1"
>
> # No need to parallelize Coccinelle since this mode takes one input file.
> --
> 2.25.1
>
>
prev parent reply other threads:[~2020-11-17 10:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 11:12 Sumera Priyadarsini
2020-11-17 10:22 ` Julia Lawall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2011171121530.4598@hadrien \
--to=julia.lawall@inria.fr \
--cc=Gilles.Muller@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=nicolas.palix@imag.fr \
--cc=sylphrenadin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®