[PATCH] docs/misra: add rule 11.9

Stefano Stabellini posted 1 patch 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230927010538.1778201-1-sstabellini@kernel.org
docs/misra/rules.rst | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] docs/misra: add rule 11.9
Posted by Stefano Stabellini 7 months ago
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(+)

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
Re: [PATCH] docs/misra: add rule 11.9
Posted by Bertrand Marquis 7 months ago
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
> 
Re: [PATCH] docs/misra: add rule 11.9
Posted by Stefano Stabellini 7 months ago
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
> > 
> 
>
Re: [PATCH] docs/misra: add rule 11.9
Posted by Henry Wang 7 months ago
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
>>> 
>> 
>> 
> 
Re: [PATCH] docs/misra: add rule 11.9
Posted by Jan Beulich 7 months ago
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