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@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Maria Celeste Cesario authored and Jan Beulich committed 2023-12-11 11:27:07 +01:00
1 parent 807321b6f3
commit 519c7a1d58
2 files changed
+12

No files matched your search

@@ -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.
#
+6
View File
@@ -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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.