Skip to content

Commit 2d41f29

Browse files
Checks: Added new MISRA04_14.2: All non-null statements shall either (a) have at least one side-effect however executed, or (b) cause control flow to change [autosync]
1 parent 07d8d4d commit 2d41f29

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

CodeCheck/clang/misra.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,25 @@
752752
}
753753
},
754754

755+
"MISRA04_15.4": {
756+
"tags": ["Language: C", "Standard: MISRA C 2004", "Category: Required", "Control Flow"],
757+
"key": "switch-bool",
758+
"name": "Published Standards/MISRA-C 2004/15.4 A switch expression shall not represent a value that is effectively Boolean",
759+
"test": "CPP_CF000",
760+
"desc": {
761+
"html": [
762+
"<p><b>Title</b></p>",
763+
"<p>A switch expression shall not represent a value that is effectively Boolean.</p>",
764+
"<p><b>Rationale</b></p>",
765+
"<p>See “Boolean expressions” in the glossary.</p>",
766+
"<p><b>Example</b></p>",
767+
"<pre><code language=\"C\">switch (x == 0) /* not compliant - effectively Boolean */",
768+
"{",
769+
"...</code></pre>"
770+
]
771+
}
772+
},
773+
755774
"MISRA04_16.8": {
756775
"tags": ["Language: C", "Standard: MISRA C 2004", "Category: Required", "Functions"],
757776
"keys": ["return-mismatch", "return-type"],

0 commit comments

Comments
 (0)