doc: coding_guidelines: Add a MISRA-C mandatory rule to Zephyr

This guideline address three undefined behaviors listed in the C99
standard. Although Zephyr does not support/implement these functions,
they are part of the C library and could be implemented in the future.

Also this is mandatory rule in MISRA-C and if one day Zephyr decides to
claim compliance with MISRA-C this guideline has to be followed.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-07-26 14:45:15 -07:00 committed by Carles Cufí
commit 70cd67579d

View file

@ -746,6 +746,11 @@ severity and the equivlent rules from other standards for reference.
- The size_t argument passed to any function in <string.h> shall have an appropriate value - The size_t argument passed to any function in <string.h> shall have an appropriate value
- N/A - N/A
- `Rule 21.18 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_18.c>`_ - `Rule 21.18 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_18.c>`_
* - 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
- N/A
- `Rule 21.19 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_19.c>`_
* - Rule 21.20 * - Rule 21.20
- Mandatory - 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 - 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