[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] build: Fix make warning if there is no cppcheck
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- Date: Fri, 20 May 2022 14:17:07 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- 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=2; 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=JL/h8O39hNxLgzq2BYm/aokZ2NmRdG+eHs8Z8CChyDA=; b=OE76wAqDzRtdPutYfi7n2wpvI0v5xcDwhMyT152YvS7wqQbpWIDnrduhwJU8TNkGxsynesvEKp5eQuN5GYS4C3dVGz9JgaxO7euO1lyQmPRl8qn/nZu/HfCb2ZCLAeQ5Evsifv+Y0vdYmw67SqjPnMsk2Hw3eg0YDFzbBCC8PB+WkgIougaHArVYCMPqnEmO+1VS8Kd6ZEm9gcGbv1pzAls2TatVDt3UU1ylzIfcudTgTGzFgpjDIg2XNV1DVvEvDqcdsmPAg2/7hH1i3ATJkPrIAgzznJmxfPOX3JKNwBQcmFirG9tk93AjHk1bFT+3crjOTLJblfaD76lLjFU3CQ==
- 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=JL/h8O39hNxLgzq2BYm/aokZ2NmRdG+eHs8Z8CChyDA=; b=NG2f5ufFLRJyKITiH/0aTuFKrLiTESCvKDoR8vZBTEbE/9OKOWLu3vSdnoWW9tlSMO6+vN1NMetULUhZHJUcrkrDfp0oSn1la9XuoPaBX9YbLCntyJP0Ab97CKEx95W6y+QpoLaxtShpvy3lEG5IpCn4U6L6IbZB0fG3cU7KRAuWi0T9yMdp9BnTIDT8OahVre0KznI2AFfu0HU5UBHqX6JIkIM0isObgUi9KwOwuQP/TLcWnyEPQgkA6CrNli6f/5YCQ1Ut8mXSoY+01wLoRvQMFKoxjCitrN2tzf+hEe8t6uAARbDcUz30hVdjzQmX9YJdDSt2hv9XB6YIcgw8Eg==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ML/lOGgPyoLM4pw9dMgDg1IuUOQ+JmfG5CMb7z7FZfPJIa8Kwmv7/E4ROfr2BqY+0PJ/JwCIetPEeW93CUVv7FNTAI9cJwu9k5BoCzIPKNSws4YzVCZAf3pGexTLnio2K/aVQP/i1/YOtyRqi8GYbgDDP7iZxFGbYnDZJXRYxB1v3oZeUbrtab+jJFfE7zx7r5+07+NVe/wGuYcthrkLjTUqjVKkfnDH/jijm9DTWwWzRt+bnpV3rJgDl2evCCdSuU8FiNb6n6VD0QPnpfddfUeoR4Y6AuWIj+oWBN560lGSPtDSrDg+AXP1/HAfe/aoktAIqztbzfDamZ+1tV0w+A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=anrQmUYaAHDAWmuoiI1FWc9mFku7JOs2EPQr6736v/LhZcFHZMKPJcAfzB4/AhJywq79etNAhpEp3dBhsiUn/WplvxbEp26L3bXcREnA0TWOOctpBeyYb4dR3hSevG4hqsl6V/y4Ggk6lIm/z/7YnNxtV6vCshdoCdbtRL/JJktu5+YBQx1Mxib/TqNlUE1BSk5qtzXCzCHf3e+9NxtddonJ+K7gAl7obToQvLvpYqqQ8BvNO4unL+DUbVbhONdcTNirqLUQCoDLmjL+Jy4cXE1i3Im4A/IWqTtqA3+xqmZEvBA3jfVzXNmFYc43Q17AI5LO+CYB3lPjYs3UcvVvMw==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Fri, 20 May 2022 14:17:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHYbEM7+m9qlHUq+EuzILzbZuQ4Yq0nuAgAgAAJCoCAAAlKAIAABa2A
- Thread-topic: [PATCH v2] build: Fix make warning if there is no cppcheck
Hi Jan,
> On 20 May 2022, at 14:56, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 20.05.2022 15:23, Bertrand Marquis wrote:
>>> On 20 May 2022, at 13:51, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>> On 20.05.2022 14:14, Bertrand Marquis wrote:
>>>> --- a/xen/Makefile
>>>> +++ b/xen/Makefile
>>>> @@ -694,12 +694,14 @@ $(objtree)/%.c.cppcheck: $(srctree)/%.c
>>>> $(objtree)/include/generated/autoconf.h
>>>> $(call if_changed,cppcheck_xml)
>>>>
>>>> cppcheck-version:
>>>> -ifeq ($(shell which $(CPPCHECK)),)
>>>> - $(error Cannot find cppcheck executable: $(CPPCHECK))
>>>> -endif
>>>> -ifeq ($(shell $(CPPCHECK) --version | awk '{print ($$2 < 2.7)}'),1)
>>>> - $(error Please upgrade your cppcheck to version 2.7 or greater)
>>>> -endif
>>>> + @if ! which $(CPPCHECK) > /dev/null 2>&1; then \
>>>> + echo "Cannot find cppcheck executable: $(CPPCHECK)"; \
>>>> + exit 1; \
>>>> + fi
>>>> + @if [ "$$($(CPPCHECK) --version | awk '{print ($$2 < 2.7)}')" -eq 1 ];
>>>> then \
>>>> + echo "Please upgrade your cppcheck to version 2.7 or greater"; \
>>>> + exit 1; \
>>>> + fi
>>>>
>>>> # Put this in generated headers this way it is cleaned by include/Makefile
>>>> $(objtree)/include/generated/compiler-def.h:
>>>
>>> Fine with me, even if - as said on v1 - I would have preferred $(if ...).
>>
>> Could you explain why and what you mean exactly ?
>
> I generally think that make scripts should resort to shell language
> only if things cannot reasonably be expressed in make language.
Agree hence my first implementation.
>
>> I thought the code would be more complex and less clear using if and I
>> do not see how it would solve the issue with which being called.
>
> The problem to deal with was to move the shell invocation from
> makefile parsing time to rule execution time. Hence I don't see
> why
>
> cppcheck-version:
> $(if $(shell which ...),,$(error ...))
>
> wouldn't deal with the problem equally well. But I guess I may
> not be understanding your question / concern.
There are always thousands of ways to achieve the same and here this is only a
matter of taste.
I must admit that I did not think of using that solution this way.
If you prefer this I have nothing against it and I will ack a patch changing to
this.
>
>>> One question though: Wouldn't it better be $(Q) instead of the two plain
>>> @? Preferably with that adjustment (which I guess can be made while
>>> committing):
>>
>> I thought of it but who would be interested in actually seeing those
>> commands which are not “building” anything.
>
> You never know what's relevant to see when hunting down some
> obscure build system issue.
>
Feel free to replace @ by $(Q) in my patch on commit.
Cheers
Bertrand
> Jan
>
|