[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/4] xen/scripts: add cppcheck tool to the xen-analysis.py script


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Thu, 1 Dec 2022 15:34:11 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8iAj4c//7OCBa8Em4550oO4QraqAsVaHSmqDzyccX38=; b=VOQ3GNZUb1oas3/mZ+B1E2NkTmf2/XU+ziIRUFMrVCz1FHQMfFCH2YxeoK3Dnrpww8h4M6xMySTQQ5ojhjiRK7wNDXym/GwRAC3ut92DkjdL7qE1wo/XV2oH3czMfA/GRWqar/NUz00xkuHNu1zxcGlBHkeh8ND3wGeG2sKWc3AA3uy+9uj0oHT0hGvfdJATCaFIkgtmJNETiVq/yOvxJUvzaw7oXt1YJxGPNREhhRSHDnVdFm0uG2QDaKu++hNs7Ers4+tQLoMudNwyBmmbXpzbUowFKrtOxLYf8WhktbPTCZ64pLUxTnQWZj5TTfNmiorIN2ggfDt0xThGfqwWcA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z17xzmx3TF5BrlsgaqB5A5kBsEneEcBCzRF/w7Kr0k8j49I25fFUWeD+x/ANnxK4eISraEGYBD85kMqct/u49ow8M9FPnPWii6FTq+YRX+3vG63bxjP0Ww7/VRTlPm/w2pAqFeJxhFo31LtRVUYpzdQkUB/DU6nwZcQozM+0hXQU0t5ckP312ezzs010WyqoeEfQ/0WRscfbeBhFlROijVrWU0yi15LZ3EdsSr13ABWIjofjM/Gd8B04jZi4vCf7vyCBX7FEcaPyW9BrHIex/wOrbkS808sPOZyAKnL99MFQ2VnQL40w52IhYl76hl1dSWeFDLAfVjX8Omq05mylJg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 01 Dec 2022 15:34:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHZAzNLrQ+cdSzeJ02hq/RTLwHjha5WqVKAgAC2sICAAI2ugIABQKAA
  • Thread-topic: [PATCH 2/4] xen/scripts: add cppcheck tool to the xen-analysis.py script

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?

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.