Skip to content

Commit bf1ee22

Browse files
committed
EssentialTypes: Handle boolean type defs
The computation of essential type category was incorrect when the type was a typedef of a boolean.
1 parent 3a5d033 commit bf1ee22

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

c/misra/src/codingstandards/c/misra/EssentialTypes.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ private IntegralType stlr(Expr const) {
7878
*/
7979
EssentialTypeCategory getEssentialTypeCategory(Type type) {
8080
exists(Type essentialType |
81-
// Resolve typedefs to ensure
82-
essentialType = type.getUnspecifiedType()
81+
if type instanceof MisraBoolType
82+
then essentialType = type
83+
else
84+
// If not a bool type, resolve the typedefs to determine the actual type
85+
essentialType = type.getUnspecifiedType()
8386
|
8487
result = EssentiallyBooleanType() and essentialType instanceof MisraBoolType
8588
or

0 commit comments

Comments
 (0)