File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
c/misra/src/rules/RULE-6-1 Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -20,16 +20,19 @@ predicate isSignedOrUnsignedInt(Type type) {
2020}
2121
2222predicate 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
2627predicate 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
3133from BitField bitField
3234where
3335not isExcluded ( bitField , TypesPackage:: bitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery ( ) ) and
36+ /* A violation would neither an appropriate primitive type nor an appropriate typedef. */
3437not ( isAppropriatePrimitive ( bitField .getType ( ) ) or isAppropriateTypedef ( bitField .getType ( ) ) )
3538select bitField , "Bit-field " + bitField + " is declared on type " + bitField + "."
You can’t perform that action at this time.
0 commit comments