]> xenbits.xensource.com Git - xen.git/commitdiff
docs/misra: adds Mandatory rules
authorStefano Stabellini <stefano.stabellini@amd.com>
Thu, 11 May 2023 23:22:37 +0000 (16:22 -0700)
committerStefano Stabellini <stefano.stabellini@amd.com>
Wed, 17 May 2023 23:13:29 +0000 (16:13 -0700)
Add the Mandatory rules agreed by the MISRA C working group to
docs/misra/rules.rst.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Tested-by: Luca Fancellu <luca.fancellu@arm.com>
docs/misra/rules.rst

index 83f01462f74b5d929106b59d47644d99eefb6506..d5a6ee8cb6507c129633624db7c0072eb5869e99 100644 (file)
@@ -204,6 +204,12 @@ existing codebase are work-in-progress.
        braces
      -
 
+   * - `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
+       parameter declared as "array of type"
+     -
+
    * - `Rule 13.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_13_06.c>`_
      - Mandatory
      - The operand of the sizeof operator shall not contain any
@@ -274,3 +280,59 @@ existing codebase are work-in-progress.
        in the same file as the #if #ifdef or #ifndef directive to which
        they are related
      -
+
+   * - `Rule 21.13 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_13.c>`_
+     - Mandatory
+     - Any value passed to a function in <ctype.h> shall be representable as an
+       unsigned char or be the value EOF
+     -
+
+   * - `Rule 21.17 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_17.c>`_
+     - Mandatory
+     - Use of the string handling functions from <string.h> shall not result in
+       accesses beyond the bounds of the objects referenced by their pointer
+       parameters
+     -
+
+   * - `Rule 21.18 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_18.c>`_
+     - Mandatory
+     - The size_t argument passed to any function in <string.h> shall have an
+       appropriate value
+     -
+
+   * - `Rule 21.19 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_19.c>`_
+     - Mandatory
+     - The pointers returned by the Standard Library functions localeconv,
+       getenv, setlocale or, strerror shall only be used as if they have
+       pointer to const-qualified type
+     -
+
+   * - `Rule 21.20 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_20.c>`_
+     - Mandatory
+     - The pointer returned by the Standard Library functions asctime ctime
+       gmtime localtime localeconv getenv setlocale or strerror shall not be
+       used following a subsequent call to the same function
+     -
+
+   * - `Rule 22.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_02.c>`_
+     - Mandatory
+     - A block of memory shall only be freed if it was allocated by means of a
+       Standard Library function
+     -
+
+   * - `Rule 22.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_04.c>`_
+     - Mandatory
+     - There shall be no attempt to write to a stream which has been opened as
+       read-only
+     -
+
+   * - `Rule 22.5 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_05.c>`_
+     - Mandatory
+     - A pointer to a FILE object shall not be dereferenced
+     -
+
+   * - `Rule 22.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_06.c>`_
+     - Mandatory
+     - The value of a pointer to a FILE shall not be used after the associated
+       stream has been closed
+     -