On 24/08/2023 12:46, Julien Grall wrote:
On 23/08/2023 23:39, Stefano Stabellini wrote:
---
docs/misra/rules.rst | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 8f0e4d3f25..4f33ed4ba6 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -106,7 +106,18 @@ maintainers if you want to suggest a change.
* - `Rule 2.1
<https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_01_1.c>`_
- Required
- A project shall not contain unreachable code
- -
+ - The following are allowed:
+ - Invariantly constant conditions, e.g.
if(IS_ENABLED(CONFIG_HVM)) { S; }
+ - Switch with a controlling value statically determined not to
+ match one or more case statements
+ - Functions that are intended to be referenced only from
+ assembly code (e.g. 'do_trap_fiq')
+ - Deliberate unreachability caused by certain macros/functions,
+ e.g. BUG, assert_failed, panic, etc. See safe.json.
... someone reading this and then reading safe.json will wonder why none
are present.
The list would then only contain the one(s) currently added in
safe.json. But there should be no expectation that the examples will
grow everytime one is added in safe.json.
I forgot to mention that the rest of the exceptions look good to me. So
if you prefer, if you could remove this exception and commit the rest.
Cheers,
--
Julien Grall