All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] docs/misra: add Rule 7.4 and 9.4
@ 2023-07-10 20:28 Stefano Stabellini
  2023-07-11  9:22 ` Jan Beulich
  2023-07-11  9:26 ` Luca Fancellu
  0 siblings, 2 replies; 4+ messages in thread
From: Stefano Stabellini @ 2023-07-10 20:28 UTC (permalink / raw)
  To: xen-devel
  Cc: jbeulich, andrew.cooper3, roger.pau, julien, sstabellini,
	george.dunlap, bertrand.marquis, Stefano Stabellini

From: Stefano Stabellini <stefano.stabellini@amd.com>

Rule 9.4 is non-controversial and we have no violations.

Rule 7.4 is considered a good idea with the caveat that assigning a
string literal to const void is allowed. I added a note to specify it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
Changes in v2:
- improve rule 7.4 note
---
 docs/misra/rules.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 622f35410c..67ee8c029e 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -203,6 +203,15 @@ maintainers if you want to suggest a change.
      - The lowercase character l shall not be used in a literal suffix
      -
 
+   * - `Rule 7.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_04.c>`_
+     - Required
+     - A string literal shall not be assigned to an object unless the
+       objects type is pointer to const-qualified char
+     - All "character types" are permitted, as long as the string
+       element type and the character type match. (There should be no
+       casts.) Assigning a string literal to any object with type
+       "pointer to const-qualified void" is allowed.
+
    * - `Rule 8.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_01.c>`_
      - Required
      - Types shall be explicitly specified
@@ -275,6 +284,11 @@ maintainers if you want to suggest a change.
        braces
      -
 
+   * - `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
+     -
+
    * - `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
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] docs/misra: add Rule 7.4 and 9.4
  2023-07-10 20:28 [PATCH v2] docs/misra: add Rule 7.4 and 9.4 Stefano Stabellini
@ 2023-07-11  9:22 ` Jan Beulich
  2023-07-11  9:26 ` Luca Fancellu
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2023-07-11  9:22 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: andrew.cooper3, roger.pau, julien, george.dunlap,
	bertrand.marquis, Stefano Stabellini, xen-devel

On 10.07.2023 22:28, Stefano Stabellini wrote:
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Rule 9.4 is non-controversial and we have no violations.
> 
> Rule 7.4 is considered a good idea with the caveat that assigning a
> string literal to const void is allowed. I added a note to specify it.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

Acked-by: Jan Beulich <jbeulich@suse.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] docs/misra: add Rule 7.4 and 9.4
  2023-07-10 20:28 [PATCH v2] docs/misra: add Rule 7.4 and 9.4 Stefano Stabellini
  2023-07-11  9:22 ` Jan Beulich
@ 2023-07-11  9:26 ` Luca Fancellu
  2023-07-11 20:21   ` Stefano Stabellini
  1 sibling, 1 reply; 4+ messages in thread
From: Luca Fancellu @ 2023-07-11  9:26 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Xen-devel, Jan Beulich, andrew.cooper3, roger.pau, julien,
	george.dunlap, Bertrand Marquis, Stefano Stabellini



> On 10 Jul 2023, at 21:28, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Rule 9.4 is non-controversial and we have no violations.
> 
> Rule 7.4 is considered a good idea with the caveat that assigning a
> string literal to const void is allowed. I added a note to specify it.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> ---
> Changes in v2:
> - improve rule 7.4 note
> ---
> docs/misra/rules.rst | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 622f35410c..67ee8c029e 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -203,6 +203,15 @@ maintainers if you want to suggest a change.
>      - The lowercase character l shall not be used in a literal suffix
>      -
> 
> +   * - `Rule 7.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_04.c>`_
> +     - Required
> +     - A string literal shall not be assigned to an object unless the
> +       objects type is pointer to const-qualified char

NIT: Should it be s/objects/object/ ?

> +     - All "character types" are permitted, as long as the string
> +       element type and the character type match. (There should be no
> +       casts.) Assigning a string literal to any object with type
> +       "pointer to const-qualified void" is allowed.
> +
>    * - `Rule 8.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_01.c>`_
>      - Required
>      - Types shall be explicitly specified
> @@ -275,6 +284,11 @@ maintainers if you want to suggest a change.
>        braces
>      -
> 
> +   * - `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
> +     -
> +
>    * - `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
> -- 
> 2.25.1
> 
> 

Apart from that, I’ve used the file with our script to import the rules and it worked.

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] docs/misra: add Rule 7.4 and 9.4
  2023-07-11  9:26 ` Luca Fancellu
@ 2023-07-11 20:21   ` Stefano Stabellini
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Stabellini @ 2023-07-11 20:21 UTC (permalink / raw)
  To: Luca Fancellu
  Cc: Stefano Stabellini, Xen-devel, Jan Beulich, andrew.cooper3,
	roger.pau, julien, george.dunlap, Bertrand Marquis,
	Stefano Stabellini

[-- Attachment #1: Type: text/plain, Size: 2471 bytes --]

On Tue, 11 Jul 2023, Luca Fancellu wrote:
> > On 10 Jul 2023, at 21:28, Stefano Stabellini <sstabellini@kernel.org> wrote:
> > 
> > From: Stefano Stabellini <stefano.stabellini@amd.com>
> > 
> > Rule 9.4 is non-controversial and we have no violations.
> > 
> > Rule 7.4 is considered a good idea with the caveat that assigning a
> > string literal to const void is allowed. I added a note to specify it.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> > ---
> > Changes in v2:
> > - improve rule 7.4 note
> > ---
> > docs/misra/rules.rst | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> > 
> > diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> > index 622f35410c..67ee8c029e 100644
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -203,6 +203,15 @@ maintainers if you want to suggest a change.
> >      - The lowercase character l shall not be used in a literal suffix
> >      -
> > 
> > +   * - `Rule 7.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_04.c>`_
> > +     - Required
> > +     - A string literal shall not be assigned to an object unless the
> > +       objects type is pointer to const-qualified char
> 
> NIT: Should it be s/objects/object/ ?
> 
> > +     - All "character types" are permitted, as long as the string
> > +       element type and the character type match. (There should be no
> > +       casts.) Assigning a string literal to any object with type
> > +       "pointer to const-qualified void" is allowed.
> > +
> >    * - `Rule 8.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_01.c>`_
> >      - Required
> >      - Types shall be explicitly specified
> > @@ -275,6 +284,11 @@ maintainers if you want to suggest a change.
> >        braces
> >      -
> > 
> > +   * - `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
> > +     -
> > +
> >    * - `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
> > -- 
> > 2.25.1
> > 
> > 
> 
> Apart from that, I’ve used the file with our script to import the rules and it worked.
> 
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
 
Thanks! I fixed the typo on commit

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-11 20:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-10 20:28 [PATCH v2] docs/misra: add Rule 7.4 and 9.4 Stefano Stabellini
2023-07-11  9:22 ` Jan Beulich
2023-07-11  9:26 ` Luca Fancellu
2023-07-11 20:21   ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.