(self, data)
| 2567 | continue |
| 2568 | |
| 2569 | def misra_10_6(self, data): |
| 2570 | for token in data.tokenlist: |
| 2571 | if token.str != '=' or not token.astOperand1 or not token.astOperand2: |
| 2572 | continue |
| 2573 | if not is_composite_expr(token.astOperand2): |
| 2574 | continue |
| 2575 | vt1 = token.astOperand1.valueType |
| 2576 | vt2 = token.astOperand2.valueType |
| 2577 | if not vt1 or vt1.pointer > 0: |
| 2578 | continue |
| 2579 | if not vt2 or vt2.pointer > 0: |
| 2580 | continue |
| 2581 | try: |
| 2582 | if isCast(token.astOperand2): |
| 2583 | e = vt2.type |
| 2584 | else: |
| 2585 | e = getEssentialType(token.astOperand2) |
| 2586 | if not e: |
| 2587 | continue |
| 2588 | if e == "char" and vt1.type == "int": |
| 2589 | # When arithmetic operations are performed on char values, they are usually promoted to int |
| 2590 | continue |
| 2591 | lhsbits = vt1.bits if vt1.bits else bitsOfEssentialType(vt1.type) |
| 2592 | if lhsbits > bitsOfEssentialType(e): |
| 2593 | self.reportError(token, 10, 6) |
| 2594 | except ValueError: |
| 2595 | pass |
| 2596 | |
| 2597 | def misra_10_7(self, cfg): |
| 2598 | for token in cfg.tokenlist: |
nothing calls this directly
no test coverage detected