All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Fancellu <Luca.Fancellu@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Bertrand Marquis <Bertrand.Marquis@arm.com>,
	Wei Chen <Wei.Chen@arm.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Wei Liu <wl@xen.org>
Subject: Re: [PATCH 2/4] xen/scripts: add cppcheck tool to the xen-analysis.py script
Date: Thu, 1 Dec 2022 15:34:11 +0000	[thread overview]
Message-ID: <A3204E48-FF22-4275-961C-690F57A8AAEE@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2211301145132.4039@ubuntu-linux-20-04-desktop>

Hi Stefano,

>>> 
>>> 
>>>> +            sm_tool_args="n"
>>>> +            ;;
>>>> +        --cppcheck-cmd=*)
>>>> +            CPPCHECK_TOOL="$(eval echo "${OPTION#*=}")"
>>>> +            sm_tool_args="y"
>>>> +            ;;
>>>> +        --cppcheck-html)
>>>> +            CPPCHECK_HTML="y"
>>>> +            sm_tool_args="n"
>>>> +            ;;
>>>> +        --cppcheck-plat=*)
>>>> +            CPPCHECK_PLAT_PATH="$(eval echo "${OPTION#*=}")"
>>>> +            sm_tool_args="n"
>>>> +            ;;
>>>> +        --ignore-path=*)
>>>> +            IGNORE_PATH_LIST="${IGNORE_PATH_LIST} $(eval echo "${OPTION#*=}")"
>>>> +            sm_tool_args="n"
>>>> +            ;;
>>>> +        --)
>>>> +            forward_to_cc="y"
>>>> +            sm_tool_args="n"
>>>> +            ;;
>>>> +        *)
>>>> +            if [ "${sm_tool_args}" = "y" ]; then
>>>> +                CPPCHECK_TOOL_ARGS="${CPPCHECK_TOOL_ARGS} ${OPTION}"
>>>> +            else
>>>> +                echo "Invalid option ${OPTION}"
>>>> +                exit 1
>>> 
>>> It doesn't look like sm_tool_args is really needed? It is only set to
>>> 'y' in the case of --cppcheck-cmd, and in that case we also set
>>> CPPCHECK_TOOL. CPPCHECK_TOOL is the variable used below. Am I missing
>>> something?
>> 
>> We use sm_tool_args to fill CPPCHECK_TOOL_ARGS, basically it’s a state machine where
>> when we find --cppcheck-cmd=<xxx> we expect that every other space separated arguments
>> passed afterwards are the args for cppcheck, so we append to CPPCHECK_TOOL_ARGS
>> until we find an argument that is supposed to be only for this script.
> 
> That seems a bit unnecessary: if the user wants to pass arguments to
> cppcheck, the user would do --cppcheck-cmd="cppcheck arg1 arg2" with ""
> quotes. Doing that should make --cppcheck-cmd="cppcheck arg1 arg2" be
> seen as a single argument from this script point of view. CPPCHECK_TOOL
> would end up being set to "cppcheck arg1 arg2" which is what we want
> anyway? And if we need to distinguish between the cppcheck binary and
> its argument we could use "cut" to extract "cppcheck", "arg1", and
> "arg2" from CPPCHECK_TOOL.  Would that work?
> 

I gave a try for the quotes, the problem is that we need to have quotes in CC=“...”, so adding
quotes also to --cppcheck-cmd= which is inside CC=“...” is preventing the Makefile to work,
I tried escaping etc but I didn’t manage to have it working, so would you agree on keeping it
like that?

  parent reply	other threads:[~2022-12-01 15:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 14:10 [PATCH 0/4] Static analyser finding deviation Luca Fancellu
2022-11-28 14:10 ` [PATCH 1/4] xen/scripts: add xen-analysis.py for coverity and eclair analysis Luca Fancellu
2022-11-29  1:39   ` Stefano Stabellini
2022-11-28 14:10 ` [PATCH 2/4] xen/scripts: add cppcheck tool to the xen-analysis.py script Luca Fancellu
2022-11-28 15:19   ` Jan Beulich
2022-11-28 15:37     ` Luca Fancellu
2022-11-29  9:42       ` Jan Beulich
2022-11-29  9:49         ` Luca Fancellu
2022-11-30  1:05   ` Stefano Stabellini
2022-11-30 11:59     ` Luca Fancellu
2022-11-30 20:26       ` Stefano Stabellini
2022-12-01  8:33         ` Jan Beulich
2022-12-01 11:18           ` Luca Fancellu
2022-12-01 11:20             ` Jan Beulich
2022-12-01 15:15               ` Stefano Stabellini
2022-12-01 15:34         ` Luca Fancellu [this message]
2022-12-01 20:23           ` Stefano Stabellini
2022-12-02 13:09             ` Luca Fancellu
2022-12-03  0:41               ` Stefano Stabellini
2022-11-28 14:10 ` [PATCH 3/4] tools/misra: fix skipped rule numbers Luca Fancellu
2022-11-29 23:51   ` Stefano Stabellini
2022-11-30  8:53     ` Luca Fancellu
2022-11-30 23:34       ` Stefano Stabellini
2022-12-01 11:27         ` Luca Fancellu
2022-12-01 15:16           ` Stefano Stabellini
2022-11-28 14:10 ` [PATCH 4/4] xen: Justify linker script defined symbols in include/xen/kernel.h Luca Fancellu
2022-11-28 15:19   ` Jan Beulich
2022-11-29  1:55   ` Stefano Stabellini
2022-11-29  1:55 ` [PATCH 0/4] Static analyser finding deviation Stefano Stabellini
2022-11-29  9:46   ` Luca Fancellu
2022-11-29 13:02     ` Luca Fancellu

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=A3204E48-FF22-4275-961C-690F57A8AAEE@arm.com \
    --to=luca.fancellu@arm.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Wei.Chen@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.