Skip to contentSkip to conversation

xen/misra: add rules 1.4 and 2.1

PATCH Superseded Stefano Stabellini 3 participants 5 messages Jun 14, 2023 – Jun 15, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/misra: add rules 1.4 and 2.1

From: Stefano Stabellini <[email protected]>

---
 docs/misra/rules.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
docs/misra/rules.rst +11 -0
index 41a727ca98..4179e49ac2 100644
@@ -90,6 +90,17 @@ existing codebase are work-in-progress.
        behaviour
      -
 
+   * - Rule 1.4
+     - Required
+     - Emergent language features shall not be used
+     - Emergent language features, such as C11 features, should not be
+       confused with similar compiler extensions, which we use.
+
+   * - `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
+     -
+
    * - `Rule 2.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_06.c>`_
      - Advisory
      - A function should not contain unused label declarations
Signature · 1 line
2.25.1
#1 lore raw

docs/misra/rules.rst existing codebase are work-in-progress. · line 97

Quoted 11 lines · Stefano Stabellini
docs/misra/rules.rst +5 -0
@@ -90,6 +90,17 @@ existing codebase are work-in-progress.
        behaviour
      -
 
+   * - Rule 1.4
+     - Required
+     - Emergent language features shall not be used
+     - Emergent language features, such as C11 features, should not be
+       confused with similar compiler extensions, which we use.

The plans to possibly use _Generic, as mentioned during the discussion, are (I think) making this the first case where we accept a rule with the expectation to later break (deviate) it. I don't think I'm aware of provisions in this regard, so by accepting the rule in the form you suggest may well lead to people later pointing here and say "no" to any attempt to use _Generic. IOW I think it wants clarifying in the text at the top of the file that there is flexibility to change in how far we mean to comply to already accepted rules.

Jan

#2 lore raw
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Stefano Stabellini
docs/misra/rules.rst +0 -0
@@ -90,6 +90,17 @@ existing codebase are work-in-progress.
        behaviour
      -
 
Quoted 14 lines

docs/misra/rules.rst existing codebase are work-in-progress. · line 97

Quoted 5 lines
docs/misra/rules.rst +5 -0
+   * - Rule 1.4
+     - Required
+     - Emergent language features shall not be used
+     - Emergent language features, such as C11 features, should not be
+       confused with similar compiler extensions, which we use.

The plans to possibly use _Generic, as mentioned during the discussion, are (I think) making this the first case where we accept a rule with the expectation to later break (deviate) it. I don't think I'm aware of provisions in this regard, so by accepting the rule in the form you suggest may well lead to people later pointing here and say "no" to any attempt to use _Generic. IOW I think it wants clarifying in the text at the top of the file that there is flexibility to change in how far we mean to comply to already accepted rules.

I'll do both things:
- expand the comment in the Notes section of 1.4
- also add a comment at the top of the file

#3 lore raw
In reply to Stefano Stabellini

Hi Stefano,

Quoted 15 lines · Stefano Stabellini

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

From: Stefano Stabellini <[email protected]>

---
 docs/misra/rules.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
docs/misra/rules.rst +0 -0
index 41a727ca98..4179e49ac2 100644

docs/misra/rules.rst existing codebase are work-in-progress. · line 93

Quoted 4 lines
docs/misra/rules.rst +1 -0
@@ -90,6 +90,17 @@ existing codebase are work-in-progress.
        behaviour
      -
 
+   * - Rule 1.4

Just as for the previous patch:
This is incorrect as it should be surrounded by `` similar to other lines.
Otherwise it will not be taken into account by convert_misra_doc.py which converts this document into cppcheck rule list.

~Michal

#4 lore raw
Quoted 21 lines · Michal Orzel

Hi Stefano,

Quoted 18 lines · Stefano Stabellini

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

From: Stefano Stabellini <[email protected]>

---
 docs/misra/rules.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)
docs/misra/rules.rst +0 -0
index 41a727ca98..4179e49ac2 100644
@@ -90,6 +90,17 @@ existing codebase are work-in-progress.
        behaviour
      -
 
Quoted 4 lines

docs/misra/rules.rst existing codebase are work-in-progress. · line 93

Quoted 1 line
docs/misra/rules.rst +1 -0
+   * - Rule 1.4

Just as for the previous patch:
This is incorrect as it should be surrounded by `` similar to other lines.
Otherwise it will not be taken into account by convert_misra_doc.py which converts this document into cppcheck rule list.

OK. I'll add a link to the base directory like I did in the other patch