diff mbox series

docs/misra: add rule 11.9

Message ID 20230927010538.1778201-1-sstabellini@kernel.org (mailing list archive)
State New, archived
Headers show
Series docs/misra: add rule 11.9 | expand

Commit Message

Stefano Stabellini Sept. 27, 2023, 1:05 a.m. UTC
From: Stefano Stabellini <stefano.stabellini@amd.com>

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

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
Rule 13.1 also discussed but it is already in docs/misra/rules.rst
---
 docs/misra/rules.rst | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jan Beulich Sept. 27, 2023, 6:49 a.m. UTC | #1
On 27.09.2023 03:05, Stefano Stabellini wrote:
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -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:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Bertrand Marquis Sept. 27, 2023, 8:16 a.m. UTC | #2
Hi Stefano,

> On 27 Sep 2023, at 03:05, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Following up from the MISRA C group discussion, add Rule 11.9 to
> docs/misra/rules.rst.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

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

With that done:
Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> Rule 13.1 also discussed but it is already in docs/misra/rules.rst
> ---
> docs/misra/rules.rst | 5 +++++
> 1 file changed, 5 insertions(+)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 8e7d17d242..28dc3a4d66 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -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
> -- 
> 2.25.1
>
Stefano Stabellini Sept. 28, 2023, 12:22 a.m. UTC | #3
Hi Henry, since we are doing doc changes, would you also agree on this
one?


On Wed, 27 Sep 2023, Bertrand Marquis wrote:
> Hi Stefano,
> 
> > On 27 Sep 2023, at 03:05, Stefano Stabellini <sstabellini@kernel.org> wrote:
> > 
> > From: Stefano Stabellini <stefano.stabellini@amd.com>
> > 
> > Following up from the MISRA C group discussion, add Rule 11.9 to
> > docs/misra/rules.rst.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> I agree with Jan on dropping the "integer" word here.
> 
> With that done:
> Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
> 
> Cheers
> Bertrand
> 
> > ---
> > Rule 13.1 also discussed but it is already in docs/misra/rules.rst
> > ---
> > docs/misra/rules.rst | 5 +++++
> > 1 file changed, 5 insertions(+)
> > 
> > diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> > index 8e7d17d242..28dc3a4d66 100644
> > --- a/docs/misra/rules.rst
> > +++ b/docs/misra/rules.rst
> > @@ -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
> > -- 
> > 2.25.1
> > 
> 
>
Henry Wang Sept. 28, 2023, 12:33 a.m. UTC | #4
Hi Stefano,

> On Sep 28, 2023, at 08:22, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> 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


> 
> On Wed, 27 Sep 2023, Bertrand Marquis wrote:
>> Hi Stefano,
>> 
>>> On 27 Sep 2023, at 03:05, Stefano Stabellini <sstabellini@kernel.org> wrote:
>>> 
>>> From: Stefano Stabellini <stefano.stabellini@amd.com>
>>> 
>>> Following up from the MISRA C group discussion, add Rule 11.9 to
>>> docs/misra/rules.rst.
>>> 
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
>> 
>> I agree with Jan on dropping the "integer" word here.
>> 
>> With that done:
>> Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
>> 
>> Cheers
>> Bertrand
>> 
>>> ---
>>> Rule 13.1 also discussed but it is already in docs/misra/rules.rst
>>> ---
>>> docs/misra/rules.rst | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>> 
>>> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
>>> index 8e7d17d242..28dc3a4d66 100644
>>> --- a/docs/misra/rules.rst
>>> +++ b/docs/misra/rules.rst
>>> @@ -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
>>> -- 
>>> 2.25.1
>>> 
>> 
>> 
>
diff mbox series

Patch

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 8e7d17d242..28dc3a4d66 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -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