Skip to content

Commit 944f727

Browse files
committed
Rule 14.3: Exclude results in macro expansions
Expansions of macros may have expressions which are seemingly invariant, but are different per invocation. We therefore exclude all such results.
1 parent 7dab957 commit 944f727

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

c/misra/src/rules/RULE-14-3/ControllingExprInvariant.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,7 @@ where
5252
)
5353
) and
5454
message = "Controlling expression in switch statement has invariant value."
55-
)
55+
) and
56+
// Exclude macros, which may generate seemingly invariant expressions
57+
not expr.isAffectedByMacro()
5658
select expr, message

0 commit comments

Comments
 (0)