We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentbc7bf51 commitf7cd25eCopy full SHA for f7cd25e
cpp/misra/src/codingstandards/cpp/misra/BuiltInTypeRules.qll
@@ -243,8 +243,16 @@ predicate isPreConversionAssignment(Expr source, Type targetType, string context
243
exists(SwitchCasecase,SwitchStmtswitch|
244
case.getExpr()=sourceand
245
case.getSwitchStmt()=switchand
246
-targetType=switch.getExpr().getFullyConverted().getType()and
247
context="switch case"
+|
248
+ifswitch.getExpr().(FieldAccess).getTarget()instanceofBitField
249
+then
250
+// For the MISRA type rules we treat bit fields as a special case
251
+targetType=getBitFieldType(switch.getExpr().(FieldAccess).getTarget())
252
+else
253
+// Regular variable initialization
254
+// Get the type of the switch expression, which is the type of the case expression
255
+targetType=switch.getExpr().getFullyConverted().getType()
256
)
257
or
258
// Class aggregate literal initialization