]> xenbits.xensource.com Git - xen.git/commitdiff
misra: add deviations for direct inclusion guards
authorSimone Ballarin <simone.ballarin@bugseng.com>
Tue, 30 Jul 2024 09:55:09 +0000 (11:55 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 30 Jul 2024 09:55:09 +0000 (11:55 +0200)
Add deviation comments to address violations of
MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order
to prevent the contents of a header file being included more than
once").

Inclusion guards must appear at the beginning of the headers
(comments are permitted anywhere).

This patch adds deviation comments using the format specified
in docs/misra/safe.json for headers with just the direct
inclusion guard before the inclusion guard since they are
safe and not supposed to comply with the directive.

Note that with SAF-10-safe in place, failures to have proper guards later
in the header files will not be reported

Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
docs/misra/safe.json
xen/arch/arm/include/asm/hypercall.h
xen/arch/x86/include/asm/hypercall.h

index ffa8bfdc4aef0685b36a40b6547ad09cd350fe97..684346386e0242ed859e9fd4d786ed88468e1814 100644 (file)
         },
         {
             "id": "SAF-10-safe",
+            "analyser": {
+                "eclair": "MC3R1.D4.10"
+            },
+            "name": "Dir 4.10: direct inclusion guard before",
+            "text": "Headers with just the direct inclusion guard before the inclusion guard are safe."
+        },
+        {
+            "id": "SAF-11-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
index ccd26c5184117e99138fdcea5e77e9f4a24fc144..07e231f8b58147b88ec89689a11b831d537ff77a 100644 (file)
@@ -1,3 +1,4 @@
+/* SAF-10-safe direct inclusion guard before */
 #ifndef __XEN_HYPERCALL_H__
 #error "asm/hypercall.h should not be included directly - include xen/hypercall.h instead"
 #endif
index ec2edc771e9ddc5357cfd93dfe21728c85e6efa4..389fa62af2fa0c84167b2808e338f0ba7818cf0f 100644 (file)
@@ -2,6 +2,7 @@
  * asm-x86/hypercall.h
  */
 
+/* SAF-10-safe direct inclusion guard before */
 #ifndef __XEN_HYPERCALL_H__
 #error "asm/hypercall.h should not be included directly - include xen/hypercall.h instead"
 #endif