[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 13:50:38 +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=3jDsreU1vBZNuhY/69MbfGIQEY+gr1f4wWOpZ5owf3g=; b=f4Qf9uFn5tSx/FAdtoqB3qWOTGdr44ypcZDh9nU2Wh2S+ST6Dnf3cdrrCklfeZFSeAGBY/TXMs/8yH24ZxLMfWWK+QQcqVATNz2MSkZXbqpMfA7bQp7V9yPM1ymHabBcHO5A9/V7qdFcHEsqV1zRobOUXk08OCXNpw4EvZr7XMCQfMg43MCMgFaKrj/+s+V7J7QvY1luErt3/aTxjK4ju7JbKzuefQHTXo3q2x8Sod/c+j4I553+gQ39UYcejOYjZNV69KcXBjTUP17APoLE01fMBre9oFJ1ZZai8SlzQTZmW0XJV8iFMkYBzC54MOUjjrUIKGoQqmThydBFf5PoEg==
  • 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=3jDsreU1vBZNuhY/69MbfGIQEY+gr1f4wWOpZ5owf3g=; b=enWRkQU3FQ79xeQMFVG84/OvyXKcZ+vrLp/rXpTSWLZLpK5IXhGWHNsLWYifN0G/29V/QRNQaGwhWqgzoL6+/zMRcBslkrH1OzndOqOX3lrgrr4UPtayt1q+uRyJV9d9onHaZCEeMxO9WWOm8hsjp3v8f9nMoizCjuI0vUi4WXZzMN3tTpemxTT+es24r74KVL2+QWunbqFispuqbyaaKSczQV5tR5GlkyRZjgtn+EDWFDtf8xbkyVGy/hXJuBeAC0Exp2ebK9ru/M1RxMD+TdT7MKeyjRNM/OloePxo5G8/WsYMgtcHJOAAofDsjnsmSORTlT0h9HROUK6G9LgTDg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=fc9vGAu4eWGiVcBZlvqzzT2QlVvsl0PpG97aNesJrlt/2iTbDuBPYjMMfi7gB+LwVpaSjD/UleHTbQSa8GblOv+6iu2pyZkNmTowV407wPt80Khb1IDRKSezzftQBhRWGkpyzYIYuVirmfXmQJiNwvA+coRHHiZb028CM008n7q+TEc0x2644L9/CisZIpYGvK0E8ZtQwiP1JdebjvgWv64qMGjWzqksIadUt2n7MJw4sUJ/OpZALK4WirLu23zlCX1OtudLtT8S8MIySpu5jU2mCqsyhbKcfmQj7+c2tlxMnK6tUD8dqWjlRLtMR0n/GLILX6HylGjOqO9SAkoGyw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hdsPMPmuvlIURfcaH/tOL4KJMUdCbvrf/tunSf8CnhWTLD2LzG2TNQALbUTcSjU7hlyeWsf/LXYujVnLHAqDuad+jWhEnHeh5Pt1j98QjMb2x6EHtwOcY4F8829E4wAPpoVGSFmCR70rXbS6IFvuU3HchpeGGupJwDMoW2JWflkI44wrTT+vO7HyGT+X67Uw5LsXlUnPg5GZZLAI33RcesbTTiD5FMeTYRLPgphPNzqSmu9+RBNsZojvMAGIxZgt4zU89hwfnxcu6nG+wmVR+GQsZ+ivw6Sa1oON7Uxud8ZvD7KsiRbAAtKmKU2dlH7nhKpeGFgV2CL6YI3WYE4Kjg==
  • 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 13:51:01 +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: AQHYxFHaJwlnNsxgQECM5kPu4Ki3xq3XHaOA
  • Thread-topic: [PATCH] build: correct cppcheck-misra make rule

Hi Jan,

> 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.

> 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.

> 
> --- 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.

Anyway this should work but the commit message needs some rephrasing and I
cannot test this right now.

Bertrand

> 
> # Put this in generated headers this way it is cleaned by include/Makefile
> $(objtree)/include/generated/compiler-def.h:




 


Rackspace

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