From bdf48bf170bf1257b236b8f467d3de6c3adb9608 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Thu, 11 May 2023 16:22:37 -0700 Subject: [PATCH] docs/misra: adds Mandatory rules Add the Mandatory rules agreed by the MISRA C working group to docs/misra/rules.rst. Signed-off-by: Stefano Stabellini Acked-by: Jan Beulich Reviewed-by: Luca Fancellu Tested-by: Luca Fancellu --- docs/misra/rules.rst | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index 83f01462f7..d5a6ee8cb6 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -204,6 +204,12 @@ existing codebase are work-in-progress. braces - + * - `Rule 12.5 `_ + - Mandatory + - The sizeof operator shall not have an operand which is a function + parameter declared as "array of type" + - + * - `Rule 13.6 `_ - 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 `_ + - Mandatory + - Any value passed to a function in shall be representable as an + unsigned char or be the value EOF + - + + * - `Rule 21.17 `_ + - Mandatory + - Use of the string handling functions from shall not result in + accesses beyond the bounds of the objects referenced by their pointer + parameters + - + + * - `Rule 21.18 `_ + - Mandatory + - The size_t argument passed to any function in shall have an + appropriate value + - + + * - `Rule 21.19 `_ + - 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 `_ + - 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 `_ + - Mandatory + - A block of memory shall only be freed if it was allocated by means of a + Standard Library function + - + + * - `Rule 22.4 `_ + - Mandatory + - There shall be no attempt to write to a stream which has been opened as + read-only + - + + * - `Rule 22.5 `_ + - Mandatory + - A pointer to a FILE object shall not be dereferenced + - + + * - `Rule 22.6 `_ + - Mandatory + - The value of a pointer to a FILE shall not be used after the associated + stream has been closed + - -- 2.39.5