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

Re: [PATCH] xen: Add MISRA support to cppcheck make rule


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 31 May 2022 15:50:16 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=yhBfe7fJ/6IkP0ufiPQN+ugxwDMuXeorZ0TLifc3u5k=; b=m7Jek54VdzUso/gEX6nUhFJdJHFAQctHx2h4iB8oAinsGVdZCS1i6jMaVAs2uA+Iy24TpD8TO9R5sKYgH4Eg0wRGOSl5PKLXErqrT/UImL0wXTylkFE01n25gE4sK0n471Zt7R1W23HyDW+ktOhwIY/UDMmGgDoJ+I749BvIPPiktkhoA6Asx7xEEw3S436NelaihyacyAAD95lkMxUCExmneCRBZycvBgf9yoQm1NMg31MVfPchMzPWB7TzjQB3MEsCSje89bFqf352o3HPZ0+Ck1o2Mo+qeNuR0fSPGBa7teltQlC0WSw9hdjyScATNi00O9JTv7UGJxLq0Eu+Yw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RwSqmmgRueSIJJLlLrldooPHYmpjCP1Zs1itOmBNnVZpRZIQOMKxDszLk99XI8WlLyb58t9jnOrUEH8hTultinc4UWNPqZT+2m7tRFknRez70gLL30DPzXK/qFrvK+iNEqwpz0PBEHgfA6A6gG5afekDlcnRPjMXFWIUK52mjVdvKEfQ3pYdunkaJ4oQM/Hb0tIR/U0WrymAcEHbqjIYGkRrv7wF8eYmjNgHPXDsYE6ES8tRtoVJ4rk3yrqZVZerM1qk4J8G3DFD4sFlv1gIValoykxad7buLqxI2t3r6Cy1M3g8jnTEMhbLb4mqD+CZMrUMOYMZMDMhMm2yY/RMPw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.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
  • Delivery-date: Tue, 31 May 2022 13:50:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.05.2022 15:30, Bertrand Marquis wrote:
> --- a/.gitignore
> +++ b/.gitignore
> @@ -297,6 +297,8 @@ xen/.banner
>  xen/.config
>  xen/.config.old
>  xen/.xen.elf32
> +xen/cppcheck-misra.txt
> +xen/cppcheck-misra.json
>  xen/xen-cppcheck.xml
>  xen/System.map
>  xen/arch/x86/boot/mkelf32

Please can you obey to sorting here, inserting next to
xen/cppcheck-htmlreport? Seeing that xen/xen-cppcheck.xml was added
here by you at the same time as xen/cppcheck-htmlreport, may I further
ask that you move that line to where it belongs as well?

Additionally I wonder if you couldn't use just one line, specifying
xen/cppcheck-misra.* ; this could then also hold for the _clean rule
addition further down in the patch.

> @@ -703,6 +716,21 @@ cppcheck-version:
>               exit 1; \
>       fi
>  
> +# List of Misra rules to respect is written inside a doc.
> +# In order to have some helpful text in the cppcheck output, generate a text
> +# file containing the rules identifier, classification and text from the Xen
> +# documentation file. Also generate a json file with the right arguments for
> +# cppcheck in json format including the list of rules to ignore

Nit: Missing full stop at the end.

> +# Replace current by goal in the dependency to generate an analysis for all
> +# rules we would like to respect.
> +cppcheck-misra.json cppcheck-misra.txt: $(XEN_ROOT)/docs/misra/rules.rst
> +     $(Q)$(srctree)/tools/convert_misra_doc.py -i $< -o cppcheck-misra.txt \
> +             -j cppcheck-misra.json
> +
> +# Prevent parallel make issues as script is generating both files
> +cppcheck-misra.json: cppcheck-misra.txt

With this dependency the earlier rule should not list multiple targets
(and it generally should not, for not being a pattern rule). If I'm not
mistaken the way you have it the Python script would be invoked twice,
and all you prevent is that it is invoked twice in parallel. And then
please use $@ inside the rule. Additionally, with the script being an
in-tree one, the rule should also have a dependency on that script
(such that the targets would be rebuilt if the script alone changes).

Jan




 


Rackspace

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