mbox series

[0/3] xen-analysis.py: Enable Xen deviation tag at the end of the line

Message ID 20240131110241.3951995-1-luca.fancellu@arm.com (mailing list archive)
Headers show
Series xen-analysis.py: Enable Xen deviation tag at the end of the line | expand

Message

Luca Fancellu Jan. 31, 2024, 11:02 a.m. UTC
This serie is enabling the xen-analysis tool to parse and substitute correctly
a deviation tag put at the end of the line containing a deviation to be deviated.

Before this serie the only way to deviate a violation was to put the tag in the
line above:

/* SAF-<id>-safe deviate the bla bla bla */
<line containing the violation>

But there are places in the code base where using the tag in the line above is
not convinient, for example:

if ( (expression) &&
     ((expression with violation) ||
     (expression) )
{
  [...]
}

In the above example is better to have the suppression comment at the end of the
line:

if ( (expression) &&
     ((expression with violation) || /* SAF-<id>-safe deviate the bla bla bla */
     (expression) )
{
  [...]
}

This clearly brings up the question about the code style line length, which in
this case needs to be amended for Xen deviation tags that goes above the limit.

Luca Fancellu (3):
  xen-analysis.py: Use named group for tag regex
  xen-analysis.py: Substitute only the comment instead of the line
  xen-analysis.py: Accept deviation comment at the end of the line

 docs/misra/documenting-violations.rst         | 10 ++++
 xen/scripts/xen_analysis/cppcheck_analysis.py |  4 +-
 xen/scripts/xen_analysis/generic_analysis.py  | 14 +++--
 xen/scripts/xen_analysis/tag_database.py      | 59 ++++++++++++++-----
 xen/scripts/xen_analysis/utils.py             |  2 +-
 5 files changed, 67 insertions(+), 22 deletions(-)

Comments

Stefano Stabellini Feb. 15, 2024, 1:08 a.m. UTC | #1
On Wed, 31 Jan 2024, Luca Fancellu wrote:
> This serie is enabling the xen-analysis tool to parse and substitute correctly
> a deviation tag put at the end of the line containing a deviation to be deviated.
> 
> Before this serie the only way to deviate a violation was to put the tag in the
> line above:
> 
> /* SAF-<id>-safe deviate the bla bla bla */
> <line containing the violation>
> 
> But there are places in the code base where using the tag in the line above is
> not convinient, for example:
> 
> if ( (expression) &&
>      ((expression with violation) ||
>      (expression) )
> {
>   [...]
> }
> 
> In the above example is better to have the suppression comment at the end of the
> line:
> 
> if ( (expression) &&
>      ((expression with violation) || /* SAF-<id>-safe deviate the bla bla bla */
>      (expression) )
> {
>   [...]
> }
> 
> This clearly brings up the question about the code style line length, which in
> this case needs to be amended for Xen deviation tags that goes above the limit.


Hi Luca,

I tested the series in a number of configurations and everything works
as expected. Great!

For the whole series:

Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Julien Grall Feb. 22, 2024, 4:13 p.m. UTC | #2
Hi Stefano,

On 15/02/2024 01:08, Stefano Stabellini wrote:
> On Wed, 31 Jan 2024, Luca Fancellu wrote:
>> This serie is enabling the xen-analysis tool to parse and substitute correctly
>> a deviation tag put at the end of the line containing a deviation to be deviated.
>>
>> Before this serie the only way to deviate a violation was to put the tag in the
>> line above:
>>
>> /* SAF-<id>-safe deviate the bla bla bla */
>> <line containing the violation>
>>
>> But there are places in the code base where using the tag in the line above is
>> not convinient, for example:
>>
>> if ( (expression) &&
>>       ((expression with violation) ||
>>       (expression) )
>> {
>>    [...]
>> }
>>
>> In the above example is better to have the suppression comment at the end of the
>> line:
>>
>> if ( (expression) &&
>>       ((expression with violation) || /* SAF-<id>-safe deviate the bla bla bla */
>>       (expression) )
>> {
>>    [...]
>> }
>>
>> This clearly brings up the question about the code style line length, which in
>> this case needs to be amended for Xen deviation tags that goes above the limit.
> 
> 
> Hi Luca,
> 
> I tested the series in a number of configurations and everything works
> as expected. Great!
> 
> For the whole series:
> 
> Acked-by: Stefano Stabellini <sstabellini@kernel.org>

This is now committed.

Cheers,