Skip to contentSkip to conversation

docs/misra: add Rule 9.3

PATCH In review Stefano Stabellini 3 participants 4 messages Jul 11, 2023 – Jul 12, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/misra: add Rule 9.3

From: Stefano Stabellini <[email protected]>

Specify that {} is allowed for zero-initialization.

---
 docs/misra/rules.rst | 5 +++++
 1 file changed, 5 insertions(+)
docs/misra/rules.rst +5 -0
index 72aa986bce..29a777938a 100644
@@ -284,6 +284,11 @@ maintainers if you want to suggest a change.
        braces
      -
 
+   * - `Rule 9.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_03.c>`_
+     - Required
+     - Arrays shall not be partially initialized
+     - {} is also allowed to specify explicit zero-initialization
+
    * - `Rule 9.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_04.c>`_
      - Required
      - An element of an object shall not be initialized more than once
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

Specify that {} is allowed for zero-initialization.

Quoted 9 lines

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

1 file changed, 5 insertions(+)
docs/misra/rules.rst +0 -0
index 72aa986bce..29a777938a 100644

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

Quoted 7 lines
docs/misra/rules.rst +4 -0
@@ -284,6 +284,11 @@ maintainers if you want to suggest a change.
       braces
     -
 
+   * - `Rule 9.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_03.c>`_
+     - Required
+     - Arrays shall not be partially initialized
+     - {} is also allowed to specify explicit zero-initialization

Not related to this patch, but how is the coding style for this? Is it {} without spaces or { } with one space? It’s not specified in the coding style

Quoted 8 lines
docs/misra/rules.rst +1 -0
+
   * - `Rule 9.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_04.c>`_
     - Required
     - An element of an object shall not be initialized more than once
Signature · 1 line
2.25.1
Acked-by
#2 lore raw
Quoted 9 lines · Luca Fancellu
Quoted 7 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

Specify that {} is allowed for zero-initialization.

Quoted 6 lines
Quoted 6 lines
docs/misra/rules.rst +0 -0
@@ -284,6 +284,11 @@ maintainers if you want to suggest a change.
       braces
     -
 
Quoted 7 lines

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

Quoted 4 lines
docs/misra/rules.rst +4 -0
+   * - `Rule 9.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_03.c>`_
+     - Required
+     - Arrays shall not be partially initialized
+     - {} is also allowed to specify explicit zero-initialization

Not related to this patch, but how is the coding style for this? Is it {} without spaces or { } with one space? It’s not specified in the coding style

In the absence of anything written down, I'm inclined to infer both forms are acceptable.

Jan

#3 lore raw
Quoted 31 lines · Jan Beulich
Quoted 9 lines · Luca Fancellu
Quoted 7 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

Specify that {} is allowed for zero-initialization.

Quoted 6 lines
Quoted 6 lines
docs/misra/rules.rst +0 -0
@@ -284,6 +284,11 @@ maintainers if you want to suggest a change.
      braces
    -
 
Quoted 7 lines

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

Quoted 4 lines
docs/misra/rules.rst +4 -0
+   * - `Rule 9.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_09_03.c>`_
+     - Required
+     - Arrays shall not be partially initialized
+     - {} is also allowed to specify explicit zero-initialization

Not related to this patch, but how is the coding style for this? Is it {} without spaces or { } with one space? It’s not specified in the coding style

Quoted 2 lines

In the absence of anything written down, I'm inclined to infer both forms are acceptable.

:) I see, that’s what I was worried, anyway you are right!
I have a WIP for clang format that would generate some discussion, but at least I hope it will clarify many of these small things that make our codebase less uniform, making us write down some rules

Quoted 2 lines

Jan