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

[xen master] xen: address violations of MISRA C:2012 Rule 14.4



commit 519c7a1d589cc263f1d0e291f53fd33a9980a239
Author:     Maria Celeste Cesario <maria.celeste.cesario@xxxxxxxxxxx>
AuthorDate: Mon Dec 11 11:27:07 2023 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Dec 11 11:27:07 2023 +0100

    xen: address violations of MISRA C:2012 Rule 14.4
    
    The xen sources contain violations of MISRA C:2012 Rule 14.4 whose
    headline states:
    "The controlling expression of an if statement and the controlling
    expression of an iteration-statement shall have essentially Boolean type".
    
    Struct domain member is_dying is an anonymous enum designed to act as 
boolean.
    Add deviation to mark its uses in controlling expressions as deliberate.
    
    Signed-off-by: Maria Celeste Cesario <maria.celeste.cesario@xxxxxxxxxxx>
    Signed-off-by: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++++++
 docs/misra/deviations.rst                        | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl 
b/automation/eclair_analysis/ECLAIR/deviations.ecl
index b0c79741b5..683f2bbfe8 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -321,6 +321,12 @@ statements are deliberate"
 -config=MC3R1.R14.3,statements={deliberate , "wrapped(any(),node(if_stmt))" }
 -doc_end
 
+-doc_begin="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"
+-config=MC3R1.R14.4,etypes+={deliberate, 
"stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
+-doc_end
+
 #
 # Series 20.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 6e7c4f25b8..eda3c8100c 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -270,6 +270,12 @@ Deviations related to MISRA C:2012 Rules:
        statements are deliberate.
      - Project-wide deviation; tagged as `disapplied` for ECLAIR.
 
+   * - R14.4
+     - 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.
+
    * - R20.7
      - Code violating Rule 20.7 is safe when macro parameters are used:
        (1) as function arguments;
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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