MISRA context for error tracking and rule transformations state
ReadonlyanalysisScope of analysis
Protected ReadonlyappliesStandards to which this rule applies to
ProtectedcontextReadonlypriorityA positive integer starting from 1 that indicates the rule's priority, determining the order in which rules are applied.
List of dependent visits, which is empty by default
Rule identifier according to MISRA-C:2012
An alias for 'name'
ProtectedappliesVerifies if the rule applies to the standard being used
Transforms the joinpoint if it represents a switch with any misplaced case labels. For that, each case label is moved to a new location within the switch.
Joinpoint to transform
Report detailing the transformation result
Initial value stored in the shared context
ProtectedlogLogs a MISRA-C rule violation error
The joinpoint where the violation occurred
Description of the violation
Checks if the given joinpoint is a switch statement with any misplaced case labels. A case label is considered misplaced if it is not a direct child of the switch body.
Joinpoint to analyze
[logErrors=false] - Whether to log errors if a violation is detected
Returns true if the joinpoint violates the rule, false otherwise
ProtectedrebuildRebuilds the program based on the current AST, clears stored data in the shared context, and resets all caches
MISRA-C Rule 16.2: A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement