docs/misra: add 14.3
PATCH v2 1/1 docs/misra: add 14.3
From: Stefano Stabellini <[email protected]>
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).
---
v2:
- remove 14.4
- better wording for the 8.2 clarification
- add while(0) and while(1) to 14.3
- add ?: to the deviation
- remove list of statements the rule applies to
--- docs/misra/rules.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
docs/misra/rules.rst +13 -1
@@ -234,7 +234,8 @@ maintainers if you want to suggest a change. * - `Rule 8.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_02.c>`_ - 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 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_ - Required
@@ -332,6 +333,17 @@ maintainers if you want to suggest a change. - A loop counter shall not have essentially floating type - + * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_ + - 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 and ?: statements. + + while(0) and while(1) are allowed. + * - `Rule 16.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_ - Required - A switch-expression shall not have essentially Boolean type
Signature · 1 line
2.25.1
docs/misra/rules.rst maintainers if you want to suggest a change. · line 343
Quoted 12 lines · Stefano Stabellini
docs/misra/rules.rst +8
-0@@ -332,6 +333,17 @@ maintainers if you want to suggest a change. - A loop counter shall not have essentially floating type - + * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_ + - 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 and ?: statements.
As before - switch(sizeof(...)) and alike also wants deviating, imo.
docs/misra/rules.rst maintainers if you want to suggest a change. · line 345
Quoted 1 line
docs/misra/rules.rst +1
-0+ while(0) and while(1) are allowed.
... and alike ... (to also cover e.g. while(true)).
Jan
Quoted 5 lines · Jan Beulich
Quoted 4 lines · Stefano Stabellini
docs/misra/rules.rst +0
-0@@ -332,6 +333,17 @@ maintainers if you want to suggest a change. - A loop counter shall not have essentially floating type -
Quoted 10 lines
docs/misra/rules.rst maintainers if you want to suggest a change. · line 343
Quoted 8 lines
docs/misra/rules.rst +8
-0+ * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_ + - 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 and ?: statements.As before - switch(sizeof(...)) and alike also wants deviating, imo.
I added the switch, but without the words "and alike" because it is not clear in this context what it would allow.
Quoted 3 lines
docs/misra/rules.rst maintainers if you want to suggest a change. · line 345
Quoted 1 line
docs/misra/rules.rst +1
-0+ while(0) and while(1) are allowed.... and alike ... (to also cover e.g. while(true)).
Here the words "and alike" are clearer so I added them
Quoted 17 lines · Stefano Stabellini
Quoted 5 lines · Jan Beulich
Quoted 4 lines · Stefano Stabellini
docs/misra/rules.rst +0
-0@@ -332,6 +333,17 @@ maintainers if you want to suggest a change. - A loop counter shall not have essentially floating type -Quoted 10 lines
docs/misra/rules.rst maintainers if you want to suggest a change. · line 343
Quoted 8 lines
docs/misra/rules.rst +8
-0+ * - `Rule 14.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_03.c>`_ + - 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 and ?: statements.As before - switch(sizeof(...)) and alike also wants deviating, imo.
Quoted 2 lines
I added the switch, but without the words "and alike" because it is not clear in this context what it would allow.
Well, what I mean here are expressions involving sizeof() (or e.g also offsetof()).
Jan