File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -998,24 +998,24 @@ void CheckOtherImpl::checkUnreachableSwitchCase()
998998 tok && tok != scope.bodyEnd ;
999999 tok = tok->next ()) {
10001000
1001- // Do not inspect cases belonging to a nested switch.
1002- if (Token::simpleMatch (tok, " {" ) &&
1003- tok->scope ()->type == ScopeType::eSwitch) {
1004- tok = tok->link ();
1005- continue ;
1006- }
1007- if (!Token::simpleMatch (tok, " case" ))
1008- continue ;
1009- const Token* caseExpression = tok->astOperand1 ();
1010- if (!caseExpression)
1011- continue ;
1012- const ValueFlow::Value* caseValue =
1013- caseExpression->getKnownValue (ValueFlow::Value::ValueType::INT );
1014- if (!caseValue)
1015- continue ;
1016- if (switchValue->intvalue == caseValue->intvalue )
1017- continue ;
1018- unreachableSwitchCaseError (tok, caseExpression->expressionString ());
1001+ // Do not inspect cases belonging to a nested switch.
1002+ if (Token::simpleMatch (tok, " {" ) &&
1003+ tok->scope ()->type == ScopeType::eSwitch) {
1004+ tok = tok->link ();
1005+ continue ;
1006+ }
1007+ if (!Token::simpleMatch (tok, " case" ))
1008+ continue ;
1009+ const Token* caseExpression = tok->astOperand1 ();
1010+ if (!caseExpression)
1011+ continue ;
1012+ const ValueFlow::Value* caseValue =
1013+ caseExpression->getKnownValue (ValueFlow::Value::ValueType::INT );
1014+ if (!caseValue)
1015+ continue ;
1016+ if (switchValue->intvalue == caseValue->intvalue )
1017+ continue ;
1018+ unreachableSwitchCaseError (tok, caseExpression->expressionString ());
10191019 }
10201020 }
10211021}
You can’t perform that action at this time.
0 commit comments