Hi Stefano,

> On 22 Jun 2022, at 22:52, Stefano Stabellini <sstabell...@kernel.org> wrote:
> 
> On Wed, 22 Jun 2022, Bertrand Marquis wrote:
>> Hi Stefano,
>> 
>>> On 22 Jun 2022, at 01:00, Stefano Stabellini <sstabell...@kernel.org> wrote:
>>> 
>>> On Fri, 10 Jun 2022, Bertrand Marquis wrote:
>>>> cppcheck MISRA addon can be used to check for non compliance to some of
>>>> the MISRA standard rules.
>>>> 
>>>> Add a CPPCHECK_MISRA variable that can be set to "y" using make command
>>>> line to generate a cppcheck report including cppcheck misra checks.
>>>> 
>>>> When MISRA checking is enabled, a file with a text description suitable
>>>> for cppcheck misra addon is generated out of Xen documentation file
>>>> which lists the rules followed by Xen (docs/misra/rules.rst).
>>>> 
>>>> By default MISRA checking is turned off.
>>>> 
>>>> While adding cppcheck-misra files to gitignore, also fix the missing /
>>>> for htmlreport gitignore
>>>> 
>>>> Signed-off-by: Bertrand Marquis <bertrand.marq...@arm.com>
>>> 
>>> Hi Bertrand,
>>> 
>>> I tried this patch and I am a bit confused by the output
>>> cppcheck-misra.txt file that I get (appended.)
>>> 
>>> I can see that there are all the rules from docs/misra/rules.rst as it
>>> should be together with the one line summary, but there are also a bunch
>>> of additional rules not present in docs/misra/rules.rst. Starting from
>>> Rule 1.1 all the way to Rule 21.21. Is the expected?
>> 
>> To make cppcheck happy I need to give a text for all rules so the python 
>> script is generating a dummy sentence for not declared Misra rules to 
>> prevent cppcheck warnings. To make it simpler I just did it for 1 to 22 for 
>> main and sub numbers.
>> 
>> So yes this is expected.
> 
> No problem about the dummy text sentence. My question was why are all
> those additional rules listed?
> 
> If you see below, the first few rules from 2.1 to 20.14 are coming from
> docs/misra/rules.rst. Why are the other rules afterward from 1.1 to
> 21.21 listed and where are they coming from?

Those are dummy entries generated by the python script.

> 
> Is it because all rules need to be listed? And the ones that are enabled
> are marked as "Required"?

If a rule is not listed in the file, cppcheck will give a warning.

> 
> I take we couldn't just avoid listing the other rules (the ones not in
> docs/misra/rules.rst)?

I can but each cppcheck command will output a warning for each rule which has 
no description in the generated file.

Cheers
Bertrand


Reply via email to