Skip to content

Commit 1cc458b

Browse files
committed
Rule 7.0.3: Address review feedback
1 parent dd34127 commit 1cc458b

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

cpp/misra/src/rules/RULE-7-0-3/NoCharacterNumericalValue.ql

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ where
2929
// Conversion from non-character type to character type
3030
not sourceType instanceof CharacterType and
3131
targetType instanceof CharacterType
32-
// or
33-
// // Conversion between different character types
34-
// getTypeCategory(sourceType) instanceof Character and
35-
// getTypeCategory(targetType) instanceof Character and
36-
// not sourceType = targetType
3732
) and
3833
// Exclude conversions where both operands have the same character type in equality operations
3934
not exists(EqualityOperation eq, CharacterType leftType, CharacterType rightType |
@@ -43,19 +38,7 @@ where
4338
leftType.getRealType() = rightType.getRealType()
4439
) and
4540
// Exclude unevaluated operands
46-
not (
47-
expr.getParent*() instanceof SizeofExprOperator or
48-
expr.getParent*() instanceof SizeofTypeOperator or
49-
expr.getParent*() instanceof TypeidOperator or
50-
expr.getParent*() = any(Decltype dt).getExpr() or
51-
expr.getParent*() instanceof StaticAssert
52-
) and
53-
// Exclude optional comparisons that don't involve conversion
54-
not exists(FunctionCall fc |
55-
fc.getTarget().hasName("operator==") and
56-
fc.getAnArgument() = expr and
57-
fc.getQualifier().getType().hasName("optional")
58-
)
41+
not expr.isUnevaluated()
5942
select expr,
6043
"Conversion of character type '" + sourceType.getName() + "' to '" + targetType.getName() +
6144
"' uses numerical value of character."

0 commit comments

Comments
 (0)