Skip to contentSkip to conversation

docs/misra: add Rules 8.2, 8.3, 8.14

PATCH In review Stefano Stabellini 3 participants 5 messages Jun 21, 2023 – Jun 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/misra: add Rules 8.2, 8.3, 8.14

From: Stefano Stabellini <[email protected]>

---
 docs/misra/rules.rst | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
docs/misra/rules.rst +16 -0
index 11b9c42b70..9caf43968c 100644
@@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
      - Types shall be explicitly specified
      -
 
+   * - `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
+     -
+
+   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
+     - Required
+     - All declarations of an object or function shall use the same
+       names and type qualifiers
+     -
+
    * - `Rule 8.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_04.c>`_
      - Required
      - A compatible declaration shall be visible when an object or
@@ -248,6 +259,11 @@ maintainers if you want to suggest a change.
        enumeration constant shall be unique
      -
 
+   * - `Rule 8.14 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_14.c>`_
+     - Required
+     - The restrict type qualifier shall not be used
+     -
+
    * - `Rule 9.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_01.c>`_
      - Mandatory
      - The value of an object with automatic storage duration shall not
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Stefano Stabellini
docs/misra/rules.rst +0 -0
@@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
      - Types shall be explicitly specified
      -
 

docs/misra/rules.rst maintainers if you want to suggest a change. · line 225

Quoted 10 lines
docs/misra/rules.rst +10 -0
+   * - `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
+     -
+
+   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
+     - Required
+     - All declarations of an object or function shall use the same
+       names and type qualifiers
+     -

I think we want to deal with uses of const when not qualifying a pointed-to
type: One approach is to simply say we don't use const like this (and the few uses there are should then go away). The other, if we deem this a valuable feature, would be to make a project-wide exception for this case, as having such const in declarations is meaningless and hence at the risk of being confusing or hampering readability.

Jan

#2 lore raw
Quoted 16 lines · Jan Beulich
Quoted 15 lines · Stefano Stabellini
docs/misra/rules.rst +9 -0
@@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
      - Types shall be explicitly specified
      -
 
+   * - `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
+     -
+
+   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
+     - Required
+     - All declarations of an object or function shall use the same
+       names and type qualifiers
Quoted 8 lines

docs/misra/rules.rst maintainers if you want to suggest a change. · line 225

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

I think we want to deal with uses of const when not qualifying a pointed-to
type: One approach is to simply say we don't use const like this (and the few uses there are should then go away). The other, if we deem this a valuable feature, would be to make a project-wide exception for this case, as having such const in declarations is meaningless and hence at the risk of being confusing or hampering readability.

I think they should go away (the first option you wrote).

If you are OK with it, I could add a note here, such as:

"The rule also applies to differences in const-ness."

#3 lore raw
Quoted 26 lines · Stefano Stabellini
Quoted 16 lines · Jan Beulich
Quoted 15 lines · Stefano Stabellini
docs/misra/rules.rst +9 -0
@@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
      - Types shall be explicitly specified
      -
 
+   * - `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
+     -
+
+   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
+     - Required
+     - All declarations of an object or function shall use the same
+       names and type qualifiers
Quoted 8 lines

docs/misra/rules.rst maintainers if you want to suggest a change. · line 225

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

I think we want to deal with uses of const when not qualifying a pointed-to
type: One approach is to simply say we don't use const like this (and the few uses there are should then go away). The other, if we deem this a valuable feature, would be to make a project-wide exception for this case, as having such const in declarations is meaningless and hence at the risk of being confusing or hampering readability.

Quoted 5 lines

I think they should go away (the first option you wrote).

If you are OK with it, I could add a note here, such as:

"The rule also applies to differences in const-ness."

I don't think that's necessary. A remark would be necessary if we meant to make a particular exception. I'm not sure whether we would record the agreed upon course of action here (i.e. as you say, drop such const).

Jan

Reviewed-by on v1 1/1
#4 lore raw
In reply to Stefano Stabellini

Hi Stefano,

Quoted 5 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

Cheers
Bertrand

Quoted 41 lines

---
docs/misra/rules.rst | 16 ++++++++++++++++

1 file changed, 16 insertions(+)
docs/misra/rules.rst +16 -0
index 11b9c42b70..9caf43968c 100644
@@ -213,6 +213,17 @@ maintainers if you want to suggest a change.
     - Types shall be explicitly specified
     -
 
+   * - `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
+     -
+
+   * - `Rule 8.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_03.c>`_
+     - Required
+     - All declarations of an object or function shall use the same
+       names and type qualifiers
+     -
+
   * - `Rule 8.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_04.c>`_
     - Required
     - A compatible declaration shall be visible when an object or
@@ -248,6 +259,11 @@ maintainers if you want to suggest a change.
       enumeration constant shall be unique
     -
 
+   * - `Rule 8.14 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_14.c>`_
+     - Required
+     - The restrict type qualifier shall not be used
+     -
+
   * - `Rule 9.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_01.c>`_
     - Mandatory
     - The value of an object with automatic storage duration shall not
Signature · 1 line
2.25.1