]> xenbits.xensource.com Git - xen.git/commitdiff
xen/domain: deviate MISRA C Rule 16.2 violation
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Mon, 22 Apr 2024 13:11:38 +0000 (15:11 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 22 Apr 2024 13:11:38 +0000 (15:11 +0200)
MISRA C Rule 16.2 states:
"A switch label shall only be used when the most closely-enclosing
compound statement is the body of a switch statement".

The PROGRESS_VCPU local helper specifies a case that is directly
inside the compound statement of a for loop, hence violating the rule.
To avoid this, the construct is deviated with a text-based deviation.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
docs/misra/safe.json
xen/common/domain.c

index fe2bc185097d17680aff0040127ec09462b391a4..9b13bcf7170645c6ed976537ed651e117306dd66 100644 (file)
         },
         {
             "id": "SAF-5-safe",
+            "analyser": {
+                "eclair": "MC3R1.R16.2"
+            },
+            "name": "MC3R1.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
+            "text": "A switch label enclosed by some compound statement that is not the body of a switch is permitted within local helper macros that are unlikely to be misused or misunderstood."
+        },
+        {
+            "id": "SAF-6-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
index 282c3ab62308214c86e438c7a6f2b1dca7409b51..6773f7fb90ba04ec8f02c801e33207d31feb0970 100644 (file)
@@ -457,6 +457,7 @@ static int domain_teardown(struct domain *d)
 
         for_each_vcpu ( d, v )
         {
+            /* SAF-5-safe MISRA C Rule 16.2: switch label enclosed by for loop */
             PROGRESS_VCPU(teardown);
 
             rc = vcpu_teardown(v);