[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XEN PATCH v2] xen/compiler: deviate the inline macro for MISRA C Rule 20.4
 
- To: Jan Beulich <jbeulich@xxxxxxxx>
 
- From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
 
- Date: Tue, 12 Mar 2024 12:36:00 +0100
 
- Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, bertrand.marquis@xxxxxxx, julien@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
 
- Delivery-date: Tue, 12 Mar 2024 11:36:09 +0000
 
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
 
 
 
On 2024-03-12 12:25, Jan Beulich wrote:
 
On 12.03.2024 12:13, Nicola Vetrini wrote:
 
Rule 20.4 states: "A macro shall not be defined with the same name
as a keyword".
Defining this macro with the same name as the inline keyword
allows for additionally checking that out-of-lined static inline
functions end up in the correct section while minimizing churn and
has a positive impact on the overall safety. See [1] for additional
context on the motivation of this deviation.
No functional change.
 [1] 
https://lore.kernel.org/xen-devel/adaa6d55-266d-4df8-8967-9340080d17e4@xxxxxxxxxx/
Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
 
 
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
with ...
 
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -322,6 +322,12 @@ Deviations related to MISRA C:2012 Rules:
          - /\* Fallthrough \*/
          - /\* Fallthrough. \*/
+   * - R20.4
+     -  The override of the keyword \"inline\" in xen/compiler.h is 
present so
+        that section contents checks pass when the compiler chooses 
not to
+        inline a particular function.
 
 
 ... padding (1st line of this bullet point) and indentation (2nd and 
3rd
lines) adjusted to what's used elsewhere, including e.g ...
 
 
Yeah, sorry.
 
+     - Comment-based deviation.
+
    * - R20.7
      - Code violating Rule 20.7 is safe when macro parameters are 
used:
        (1) as function arguments;
 
... here. Happy to do so while committing.
 
 
Thanks,
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
 
 
    
     |