Skip to contentSkip to conversation

docs/misra: add rule 11.9

PATCH In review Stefano Stabellini 4 participants 5 messages Sep 27, 2023 – Sep 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/misra: add rule 11.9

From: Stefano Stabellini <[email protected]>

Following up from the MISRA C group discussion, add Rule 11.9 to docs/misra/rules.rst.

---
Rule 13.1 also discussed but it is already in docs/misra/rules.rst

---
 docs/misra/rules.rst | 5 +++++
 1 file changed, 5 insertions(+)
docs/misra/rules.rst +5 -0
index 8e7d17d242..28dc3a4d66 100644
@@ -373,6 +373,11 @@ maintainers if you want to suggest a change.
      - A cast shall not remove any const or volatile qualification from the type pointed to by a pointer
      -
 
+   * - `Rule 11.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_11_09.c>`_
+     - Required
+     - The macro NULL shall be the only permitted form of integer null pointer constant
+     -
+
    * - `Rule 12.5 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_12_05.c>`_
      - Mandatory
      - The sizeof operator shall not have an operand which is a function
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

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

Quoted 10 lines · Stefano Stabellini
docs/misra/rules.rst +4 -0
@@ -373,6 +373,11 @@ maintainers if you want to suggest a change.
      - A cast shall not remove any const or volatile qualification from the type pointed to by a pointer
      -
 
+   * - `Rule 11.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_11_09.c>`_
+     - Required
+     - The macro NULL shall be the only permitted form of integer null pointer constant
+     -

I think there's a terminology issue, which I'd prefer if we didn't inherit from the Misra spec: NULL is not an integer constant expression. A null pointer constant can be either plain 0 or ((void*)0); the former is an integer constant expression, while the latter is not. Aiui it is the "Amplification" text in the doc which correlates with the use of "integer" in the title; since (as per above) I think the text is wrong in this regard, the use of the word here also is at best misleading. The C99 spec also doesn't know the term "integer null pointer constant"; only "null pointer constant" is specified and used.

With the word dropped despite then not being in sync with the doc:

Jan

Acked-by on v1 1/1
#2 lore raw
In reply to Stefano Stabellini

Hi Stefano,

Quoted 8 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

Following up from the MISRA C group discussion, add Rule 11.9 to docs/misra/rules.rst.

I agree with Jan on dropping the "integer" word here.

With that done:

Cheers
Bertrand

Quoted 25 lines

---
Rule 13.1 also discussed but it is already in docs/misra/rules.rst
---
docs/misra/rules.rst | 5 +++++

1 file changed, 5 insertions(+)
docs/misra/rules.rst +5 -0
index 8e7d17d242..28dc3a4d66 100644
@@ -373,6 +373,11 @@ maintainers if you want to suggest a change.
     - A cast shall not remove any const or volatile qualification from the type pointed to by a pointer
     -
 
+   * - `Rule 11.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_11_09.c>`_
+     - Required
+     - The macro NULL shall be the only permitted form of integer null pointer constant
+     -
+
   * - `Rule 12.5 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_12_05.c>`_
     - Mandatory
     - The sizeof operator shall not have an operand which is a function
Signature · 1 line
2.25.1
#3 lore raw

Hi Henry, since we are doing doc changes, would you also agree on this one?

Quoted 46 lines · Bertrand Marquis

Hi Stefano,

Quoted 8 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

Following up from the MISRA C group discussion, add Rule 11.9 to docs/misra/rules.rst.

I agree with Jan on dropping the "integer" word here.

With that done:

Cheers
Bertrand

Quoted 25 lines

---
Rule 13.1 also discussed but it is already in docs/misra/rules.rst
---
docs/misra/rules.rst | 5 +++++

1 file changed, 5 insertions(+)
docs/misra/rules.rst +5 -0
index 8e7d17d242..28dc3a4d66 100644
@@ -373,6 +373,11 @@ maintainers if you want to suggest a change.
     - A cast shall not remove any const or volatile qualification from the type pointed to by a pointer
     -
 
+   * - `Rule 11.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_11_09.c>`_
+     - Required
+     - The macro NULL shall be the only permitted form of integer null pointer constant
+     -
+
   * - `Rule 12.5 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_12_05.c>`_
     - Mandatory
     - The sizeof operator shall not have an operand which is a function
Signature · 1 line
2.25.1
#4 lore raw

Hi Stefano,

Quoted 5 lines · Stefano Stabellini

Hi Henry, since we are doing doc changes, would you also agree on this one?

Yes, same as the last patch that I just release acked.

Kind regards,
Henry

Quoted 49 lines · Bertrand Marquis
Quoted 46 lines

Hi Stefano,

Quoted 8 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

Following up from the MISRA C group discussion, add Rule 11.9 to docs/misra/rules.rst.

I agree with Jan on dropping the "integer" word here.

With that done:

Cheers
Bertrand

Quoted 25 lines

---
Rule 13.1 also discussed but it is already in docs/misra/rules.rst
---
docs/misra/rules.rst | 5 +++++

1 file changed, 5 insertions(+)
docs/misra/rules.rst +5 -0
index 8e7d17d242..28dc3a4d66 100644
@@ -373,6 +373,11 @@ maintainers if you want to suggest a change.
    - A cast shall not remove any const or volatile qualification from the type pointed to by a pointer
    -
 
+   * - `Rule 11.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_11_09.c>`_
+     - Required
+     - The macro NULL shall be the only permitted form of integer null pointer constant
+     -
+
  * - `Rule 12.5 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_12_05.c>`_
    - Mandatory
    - The sizeof operator shall not have an operand which is a function
Signature · 1 line
2.25.1