Skip to content

Commit 50049bf

Browse files
committed
Add some inline comments
1 parent 17b1ef9 commit 50049bf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

c/misra/src/rules/RULE-6-1/BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@ predicate isSignedOrUnsignedInt(Type type) {
2020
}
2121

2222
predicate isAppropriatePrimitive(Type type) {
23+
/* An appropriate primitive types to which a bit-field can be declared. */
2324
isSignedOrUnsignedInt(type) or type instanceof BoolType
2425
}
2526

2627
predicate isAppropriateTypedef(Type type) {
2728
type instanceof TypedefType and
29+
/* An appropriate typedef should be an alias to an appropriate primitive type. */
2830
isAppropriatePrimitive(type.(TypedefType).resolveTypedefs())
2931
}
3032

3133
from BitField bitField
3234
where
3335
not isExcluded(bitField, TypesPackage::bitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery()) and
36+
/* A violation would neither an appropriate primitive type nor an appropriate typedef. */
3437
not (isAppropriatePrimitive(bitField.getType()) or isAppropriateTypedef(bitField.getType()))
3538
select bitField, "Bit-field " + bitField + " is declared on type " + bitField + "."

0 commit comments

Comments
 (0)