[XEN PATCH] automation/eclair: add deviation of MISRA C:2012 Rule 14.4

Federico Serafini posted 1 patch 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/899a456dc9fcd9ceb55efdfb95e71d0abd997700.1713961291.git.federico.serafini@bugseng.com
There is a newer version of this series
automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
docs/misra/deviations.rst                        | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
[XEN PATCH] automation/eclair: add deviation of MISRA C:2012 Rule 14.4
Posted by Federico Serafini 1 week, 4 days ago
Update ECLAIR configuration to take into account the deviations
agreed during MISRA meetings.

Amend an existing entry of Rule 14.4 in deviations.rst:
it is not a project-wide deviation.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
 docs/misra/deviations.rst                        | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index d21f112a9b..f1a29389fd 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -349,6 +349,10 @@ therefore have the same behavior of a boolean"
 -config=MC3R1.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
 -doc_end
 
+-doc_begin="A controlling expression of 'if' and iteration statements having integer, character or pointer type has a semantics that is well-known to all Xen developers."
+-config=MC3R1.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
+-doc_end
+
 #
 # Series 16.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index ed0c1e8ed0..a9d9cca04d 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -294,7 +294,13 @@ Deviations related to MISRA C:2012 Rules:
      - The XEN team relies on the fact that the enum is_dying has the
        constant with assigned value 0 act as false and the other ones as true,
        therefore have the same behavior of a boolean.
-     - Project-wide deviation; tagged as `deliberate` for ECLAIR.
+     - Tagged as `deliberate` for ECLAIR.
+
+   * - R14.4
+     - A controlling expression of 'if' and iteration statements having
+       integer, character or pointer type has a semantics that is well-known to
+       all Xen developers.
+     - Tagged as `deliberate` for ECLAIR.
 
    * - R16.2
      - Complying with the Rule would entail a lot of code duplication in the
-- 
2.34.1
Re: [XEN PATCH] automation/eclair: add deviation of MISRA C:2012 Rule 14.4
Posted by Jan Beulich 1 week, 4 days ago
On 24.04.2024 14:23, Federico Serafini wrote:
> Update ECLAIR configuration to take into account the deviations
> agreed during MISRA meetings.
> 
> Amend an existing entry of Rule 14.4 in deviations.rst:
> it is not a project-wide deviation.

Who / how is it not? ->is_dying is a globally visible struct field.

> --- a/docs/misra/deviations.rst
> +++ b/docs/misra/deviations.rst
> @@ -294,7 +294,13 @@ Deviations related to MISRA C:2012 Rules:
>       - The XEN team relies on the fact that the enum is_dying has the
>         constant with assigned value 0 act as false and the other ones as true,
>         therefore have the same behavior of a boolean.
> -     - Project-wide deviation; tagged as `deliberate` for ECLAIR.
> +     - Tagged as `deliberate` for ECLAIR.
> +
> +   * - R14.4
> +     - A controlling expression of 'if' and iteration statements having
> +       integer, character or pointer type has a semantics that is well-known to
> +       all Xen developers.
> +     - Tagged as `deliberate` for ECLAIR.

I'm inclined to suggest that this more generic deviation be inserted ahead
of the more specific ->is_dying one.

Jan
Re: [XEN PATCH] automation/eclair: add deviation of MISRA C:2012 Rule 14.4
Posted by Federico Serafini 5 days, 11 hours ago
On 24/04/24 14:38, Jan Beulich wrote:
> On 24.04.2024 14:23, Federico Serafini wrote:
>> Update ECLAIR configuration to take into account the deviations
>> agreed during MISRA meetings.
>>
>> Amend an existing entry of Rule 14.4 in deviations.rst:
>> it is not a project-wide deviation.
> 
> Who / how is it not? ->is_dying is a globally visible struct field.

Given a project and a guideline, we use the term "project-wide
deviation" when all violations of the given guideline are deviated.

> 
>> --- a/docs/misra/deviations.rst
>> +++ b/docs/misra/deviations.rst
>> @@ -294,7 +294,13 @@ Deviations related to MISRA C:2012 Rules:
>>        - The XEN team relies on the fact that the enum is_dying has the
>>          constant with assigned value 0 act as false and the other ones as true,
>>          therefore have the same behavior of a boolean.
>> -     - Project-wide deviation; tagged as `deliberate` for ECLAIR.
>> +     - Tagged as `deliberate` for ECLAIR.
>> +
>> +   * - R14.4
>> +     - A controlling expression of 'if' and iteration statements having
>> +       integer, character or pointer type has a semantics that is well-known to
>> +       all Xen developers.
>> +     - Tagged as `deliberate` for ECLAIR.
> 
> I'm inclined to suggest that this more generic deviation be inserted ahead
> of the more specific ->is_dying one.

Ok.

-- 
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)