diff mbox series

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

Message ID 899a456dc9fcd9ceb55efdfb95e71d0abd997700.1713961291.git.federico.serafini@bugseng.com (mailing list archive)
State Superseded
Headers show
Series [XEN] automation/eclair: add deviation of MISRA C:2012 Rule 14.4 | expand

Commit Message

Federico Serafini April 24, 2024, 12:23 p.m. UTC
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(-)

Comments

Jan Beulich April 24, 2024, 12:38 p.m. UTC | #1
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
Federico Serafini April 30, 2024, 7:13 a.m. UTC | #2
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.
diff mbox series

Patch

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