[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] misra: add R14.4 R21.1 R21.2



Add 14.4, with the same note and exception already listed for 10.1.

Add 21.1 and 21.2, with a longer comment to explain how strategy with
leading underscores and why we think we are safe today.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index b423580b23..56eec8bafd 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -422,6 +422,13 @@ maintainers if you want to suggest a change.
 
        while(0) and while(1) and alike are allowed.
 
+   * - `Rule 14.4 
<https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_04.c>`_
+     - Required
+     - The controlling expression of an if statement and the controlling
+       expression of an iteration-statement shall have essentially
+       Boolean type
+     - Implicit conversions to boolean are allowed
+
    * - `Rule 16.7 
<https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_16_07.c>`_
      - Required
      - A switch-expression shall not have essentially Boolean type
@@ -479,6 +486,24 @@ maintainers if you want to suggest a change.
        they are related
      -
 
+   * - `Rule 21.1 
<https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_01.c>`_
+     - Required
+     - #define and #undef shall not be used on a reserved identifier or
+       reserved macro name
+     - No identifiers should start with _BUILTIN to avoid clashes with
+       GCC reserved identifiers. In general, all identifiers starting with
+       an underscore are reserved, and are best avoided. However, Xen
+       makes extensive usage of leading underscores in header guards,
+       bitwise manipulation functions, and a few other places. They are
+       considered safe as checks have been done against the list of
+       GCC's reserved identifiers. They don't need to be replaced.
+
+   * - `Rule 21.2 
<https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_02.c>`_
+     - Required
+     - A reserved identifier or reserved macro name shall not be
+       declared
+     - See comment for Rule 21.1
+
    * - `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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.