Re: [PATCH] docs/misra: rules for mass adoption

2024-06-21 Thread Stefano Stabellini
On Thu, 23 May 2024, Jan Beulich wrote:
> On 23.05.2024 03:26, Stefano Stabellini wrote:
> > @@ -725,12 +787,25 @@ maintainers if you want to suggest a change.
> >   - The Standard Library function system of  shall not be used
> >   -
> >  
> > +   * - `Rule 22.1 
> > `_
> > + - Required
> > + - All resources obtained dynamically by means of Standard Library
> > +   functions shall be explicitly released
> > + -
> > + - Xen doesn't provide, use, or link against a Standard Library 
> > [#xen-stdlib]_
> 
> The empty sub-bullet-point looks stray here.

Good catch, thanks!


> > @@ -748,6 +823,31 @@ maintainers if you want to suggest a change.
> > stream has been closed
> >   -
> >  
> > +   * - `Rule 22.7 
> > `_
> > + - Required
> > + - The macro EOF shall only be compared with the unmodified return
> > +   value from any Standard Library function capable of returning EOF
> > + - Xen doesn't provide, use, or link against a Standard Library 
> > [#xen-stdlib]_
> 
> Shouldn't this remark also be replicated ...
> 
> > +   * - `Rule 22.8 
> > `_
> > + - Required
> > + - The value of errno shall be set to zero prior to a call to an
> > +   errno-setting-function
> > + -
> > +
> > +   * - `Rule 22.9 
> > `_
> > + - Required
> > + - The value of errno shall be tested against zero after calling an
> > +   errno-setting-function
> > + -
> > +
> > +   * - `Rule 22.10 
> > `_
> > + - Required
> > + - The value of errno shall only be tested when the last function to
> > +   be called was an errno-setting-function
> > + -
> 
> ... for all three of these, seeing that errno is something a (standard) 
> library
> would provide? Or alternatively should remarks here say that we simply have no
> errno?

I'll replicate the full message



Re: [PATCH] docs/misra: rules for mass adoption

2024-05-23 Thread Jan Beulich
On 23.05.2024 03:26, Stefano Stabellini wrote:
> @@ -725,12 +787,25 @@ maintainers if you want to suggest a change.
>   - The Standard Library function system of  shall not be used
>   -
>  
> +   * - `Rule 22.1 
> `_
> + - Required
> + - All resources obtained dynamically by means of Standard Library
> +   functions shall be explicitly released
> + -
> + - Xen doesn't provide, use, or link against a Standard Library 
> [#xen-stdlib]_

The empty sub-bullet-point looks stray here.

> @@ -748,6 +823,31 @@ maintainers if you want to suggest a change.
> stream has been closed
>   -
>  
> +   * - `Rule 22.7 
> `_
> + - Required
> + - The macro EOF shall only be compared with the unmodified return
> +   value from any Standard Library function capable of returning EOF
> + - Xen doesn't provide, use, or link against a Standard Library 
> [#xen-stdlib]_

Shouldn't this remark also be replicated ...

> +   * - `Rule 22.8 
> `_
> + - Required
> + - The value of errno shall be set to zero prior to a call to an
> +   errno-setting-function
> + -
> +
> +   * - `Rule 22.9 
> `_
> + - Required
> + - The value of errno shall be tested against zero after calling an
> +   errno-setting-function
> + -
> +
> +   * - `Rule 22.10 
> `_
> + - Required
> + - The value of errno shall only be tested when the last function to
> +   be called was an errno-setting-function
> + -

... for all three of these, seeing that errno is something a (standard) library
would provide? Or alternatively should remarks here say that we simply have no
errno?

Jan



[PATCH] docs/misra: rules for mass adoption

2024-05-22 Thread Stefano Stabellini
This patch adds a bunch of rules to rules.rst that are uncontroversial
and have zero violations in Xen. As such, they have been approved for
adoption.

All the ones that regard the standard library have the link to the
existing footnote in the notes.

Signed-off-by: Stefano Stabellini 

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 80e5e972ad..d67c74a083 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -580,6 +580,11 @@ maintainers if you want to suggest a change.
  - The relational operators > >= < and <= shall not be applied to objects 
of pointer type except where they point into the same object
  -
 
+   * - `Rule 18.8 
`_
+ - Required
+ - Variable-length array types shall not be used
+ -
+
* - `Rule 19.1 
`_
  - Mandatory
  - An object shall not be assigned or copied to an overlapping
@@ -589,11 +594,29 @@ maintainers if you want to suggest a change.
instances where Eclair is unable to verify that the code is valid
in regard to Rule 19.1. Caution reports are not violations.
 
+   * - `Rule 20.2 
`_
+ - Required
+ - The ', " or \ characters and the /* or // character sequences
+   shall not occur in a header file name
+ -
+
+   * - `Rule 20.3 
`_
+ - Required
+ - The #include directive shall be followed by either a 
+   or "filename" sequence
+ -
+
* - `Rule 20.4 
`_
  - Required
  - A macro shall not be defined with the same name as a keyword
  -
 
+   * - `Rule 20.6 
`_
+ - Required
+ - Tokens that look like a preprocessing directive shall not occur
+   within a macro argument
+ -
+
* - `Rule 20.7 
`_
  - Required
  - Expressions resulting from the expansion of macro parameters
@@ -609,6 +632,12 @@ maintainers if you want to suggest a change.
evaluation
  -
 
+   * - `Rule 20.11 
`_
+ - Required
+ - A macro parameter immediately following a # operator shall not
+   immediately be followed by a ## operator
+ -
+
* - `Rule 20.12 
`_
  - Required
  - A macro parameter used as an operand to the # or ## operators,
@@ -651,11 +680,39 @@ maintainers if you want to suggest a change.
declared
  - See comment for Rule 21.1
 
+   * - `Rule 21.3 
`_
+ - Required
+ - The memory allocation and deallocation functions of 
+   shall not be used
+ - Xen doesn't provide, use, or link against a Standard Library 
[#xen-stdlib]_
+
+   * - `Rule 21.4 
`_
+ - Required
+ - The standard header file  shall not be used
+ - Xen doesn't provide, use, or link against a Standard Library 
[#xen-stdlib]_
+
+   * - `Rule 21.5 
`_
+ - Required
+ - The standard header file  shall not be used
+ - Xen doesn't provide, use, or link against a Standard Library 
[#xen-stdlib]_
+
* - `Rule 21.6 
`_
  - Required
  - The Standard Library input/output routines shall not be used
  - Xen doesn't provide, use, or link against a Standard Library 
[#xen-stdlib]_
 
+   * - `Rule 21.7 
`_
+ - Required
+ - The Standard Library functions atof, atoi, atol and atoll of
+shall not be used
+ - Xen doesn't provide, use, or link against a Standard Library 
[#xen-stdlib]_
+
+   * - `Rule 21.8 
`_
+ - Required
+ - The Standard Library functions abort, exit and system of
+shall not be used
+ - Xen doesn't provide, use, or link against a Standard Library 
[#xen-stdlib]_
+
* - `Rule 21.9 
`_
  - Required
  - The library functions bsearch and qsort of  shall not be used
@@ -666,6 +723,11 @@ maintainers if you want to sugges