From b1c84ab41a80e08512e61f8fce740227aebc3f9e Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Fri, 8 Sep 2023 13:27:23 -0700 Subject: [PATCH] docs/misra: add 14.3 Add 14.3, with project-wide deviations. Also take the opportunity to clarify that parameters of function pointer types are expected to have names (Rule 8.2). Signed-off-by: Stefano Stabellini Acked-by: Jan Beulich Acked-by: Bertrand Marquis Release-acked-by: Henry Wang --- docs/misra/rules.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index 8e7d17d242..67c9195ed8 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -234,7 +234,8 @@ maintainers if you want to suggest a change. * - `Rule 8.2 `_ - Required - Function types shall be in prototype form with named parameters - - + - Clarification: both function and function pointers types shall + have named parameters. * - `Rule 8.3 `_ - Required @@ -395,6 +396,18 @@ maintainers if you want to suggest a change. - A loop counter shall not have essentially floating type - + * - `Rule 14.3 `_ + - Required + - Controlling expressions shall not be invariant + - Due to the extensive usage of IS_ENABLED, sizeof compile-time + checks, and other constructs that are detected as errors by MISRA + C scanners, managing the configuration of a MISRA C scanner for + this rule would be unmanageable. Thus, this rule is adopted with + a project-wide deviation on if, ?:, switch(sizeof(...)), and + switch(offsetof(...)) statements. + + while(0) and while(1) and alike are allowed. + * - `Rule 16.7 `_ - Required - A switch-expression shall not have essentially Boolean type