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

Re: [PATCH] build: correct cppcheck-misra make rule


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 9 Sep 2022 15:16:47 +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=NAl+f5st5eun8xlveCvD5yisKbUcWG5fVqAhKmjBIxo=; b=RNtFdD7cpkww8jCrzFC67GkyOyv8imhMZIZnhgGCe7CnYjAMg9farq1CTp+TxSuq0/VLeTb+eO6MP5KGUhd2AcIyG5qQ4MW3OeLcNKy5v5APKVym7cTUFE9UQN2pmieT/s77s/MAb5pZTlBC1ipKpE5JsCSjPxIsHlElu6noPZZYwdRUItaJXK6CoUodXpQSwSHITDmnqNAAViuwroj82FwkQ6f6JVL8FVRyuWMm3G/pg1rAcF6zKc3Ptg+WT7c+wXMizoDEd8VrHXbMfJ1k7Zik+vlZD0w5ZTRCXLqxdKoNC2gVN7S1qg2T8ql5SlbJoEFPW65ZiCQKSvxpJYCo2w==
  • 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=NAl+f5st5eun8xlveCvD5yisKbUcWG5fVqAhKmjBIxo=; b=df74GvBV1a2BBPUNo/kWtQVc2IXpKWZcIUNpffORde+xXKo0WVifLsvUEIXk9hycgrfhYK5yOi5DubNKVM9jduYO6hG6IllcWfY889iIUYlngIJoJh5hKjT8UOPpwTjEjBGaOHY4Y5sjVoclc7HO0AxaCG0QRB8BWyn3XS1+hSjfnDuQtUvCwfMMPrQvavIloOD3Q+2S9xSbbgIzhOgYjFt6n2N8wN1l2RNU7nmNBugUkpMs4ZmHO9Gbzg41VZB9/+tpIR8J1rGO/kbpEmzY+c9lmmP4CASxbjXjHSEAH8fzLjQ82St/5dFk5jiD8X/byN8GNfDeEWZIp5lm7wt7og==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=a/+8TaFMSgaYX8+PkJ4+sSxRa0ZzcpZCCvJpX99jZ4D8YAJdd42yREHHEGJFEJ9QfIzo/JgKFmSzQNnmZAWwOYBgA0eONpXxWXhNyHZatGv8hdrw9qXd6wtrdjM3O1urqoLoBoZPsu0U0SpGTiHWsi9ftV3PwP2+e9ohrpMlrburawydfBc3JdWFrXfMOxOqdKLlPm8dm0dA3eoumPZJRGcDZndSstMMBQW7IdcZO5k024axE1q4/l8oOK/BNIX7XcrtIc97gtwCsnjEwYCNsDKUk7POL3eC6hi8ey4pOvombGIIhgLrF5wWt5C294NzS/KW/+DF0hIPgmo3CRjLUw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i4/HG59mo3c7gM011IIWn9nEC2G2r3qLY53q8fi6MjcXWzPSBHLAfkMfFiY0Niuw//qInbmZCsGF5KcsBwdHrfC6WRK2dX9GdA/PjfkmDr8iUSu5GRB7hNd2JTGQj3er6WbB+FbIbd6pR4MWLEXDHJORL0SUTZa+Qo/HzLH8psT9eQYa2QKOKNK/l3VI82/URVoLNSkb0k8+sNQSwHjxZ4IizQSDSfw8Q6GREj1Tjap35pu3lfkW23PH2jkwmMB+1Ei53Rc1rfbMuGleyr+wFpXNwN/eLKoTvdN6EBGaYWLxWFYwoxkVQ8LxPx5AYvjsgZ9QJwDRvPX2UC8OcxCMWw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Fri, 09 Sep 2022 15:17:25 +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: AQHYxFHaJwlnNsxgQECM5kPu4Ki3xq3XHaOAgAAJ7oCAAA4kAA==
  • Thread-topic: [PATCH] build: correct cppcheck-misra make rule

Hi Jan,

> On 9 Sep 2022, at 15:26, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 09.09.2022 15:50, Bertrand Marquis wrote:
>>> On 9 Sep 2022, at 14:41, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>> 
>>> It has been bothering me for a while that I made a bad suggestion during
>> 
>> This is not a sentence for a commit message.
> 
> How else should I express the motivation for the change?

I would say, start with “cppcheck-misra.json depend on …” and remove everything 
before.

Being bothered is not really something interesting to read in the git log.

> 
>>> review: Having cppcheck-misra.json depend on cppcheck-misra.txt does not
>>> properly address the multiple targets problem. If cppcheck-misra.json
>>> is deleted from the build tree but cppcheck-misra.txt is still there,
>>> nothing will re-generate cppcheck-misra.json.
>>> 
>>> With GNU make 4.3 or newer we could use the &: grouped target separator,
>>> but since we support older make as well we need to use some other
>>> mechanism. Convert the rule to a pattern one (with "cppcheck"
>>> arbitrarily chosen as the stem), thus making known to make that both
>>> files are created by a single command invocation. Since, as a result,
>>> the JSON file is now "intermediate" from make's perspective, prevent it
>>> being deleted again by making it a prereq of .PRECIOUS.
>>> 
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>> ---
>>> I've not been able to spot where / how cppcheck-misra.txt is used. If
>>> it's indeed unused, a perhaps better alternative would be to convert the
>>> original rule to specify cppcheck-misra.json as (the only) target. One
>>> might then even consider using "-o /dev/null" instead of producing an
>>> unused *.txt file.
>> 
>> Txt file is used by cppcheck to give a text description of the rule.
>> If you look inside the json content you will see it mentioned.
> 
> Oh, that's properly hidden then.

This is how cppcheck needs it and why I added a comment but it might needs 
improving.

> 
>>> --- a/xen/Makefile
>>> +++ b/xen/Makefile
>>> @@ -746,11 +746,9 @@ cppcheck-version:
>>> # documentation file. Also generate a json file with the right arguments for
>>> # cppcheck in json format including the list of rules to ignore.
>>> #
>>> -cppcheck-misra.txt: $(XEN_ROOT)/docs/misra/rules.rst 
>>> $(srctree)/tools/convert_misra_doc.py
>>> -   $(Q)$(PYTHON) $(srctree)/tools/convert_misra_doc.py -i $< -o $@ -j 
>>> $(@:.txt=.json)
>>> -
>>> -# convert_misra_doc is generating both files.
>>> -cppcheck-misra.json: cppcheck-misra.txt
>>> +.PRECIOUS: %-misra.json
>>> +%-misra.txt %-misra.json: $(XEN_ROOT)/docs/misra/rules.rst 
>>> $(srctree)/tools/convert_misra_doc.py
>>> +   $(Q)$(PYTHON) $(srctree)/tools/convert_misra_doc.py -i $< -o 
>>> $*-misra.txt -j $*-misra.json
>> 
>> As far as I know, this is not saying to make that both files are generated 
>> by this rule,
>> but that this rule can generate both files so nothing is telling make here 
>> that calling
>> it once is enough I think.
> 
> As said in the description - it specifically has this effect. We're
> using this elsewhere already, see e.g. tools/libs/light/Makefile
> generating three headers and a C file all in one go. Iirc this is
> also explicitly described in make documentation (and contrasted to
> the different behavior for non-pattern rules).

Then I think the comment suggested by Anthony makes sense to add.

Cheers
Bertrand

> 
> Jan


 


Rackspace

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