(self, data)
| 2493 | self.reportError(tok, 10, 3) |
| 2494 | |
| 2495 | def misra_10_4(self, data): |
| 2496 | op = {'+', '-', '*', '/', '%', '&', '|', '^', '+=', '-=', ':'} |
| 2497 | for token in data.tokenlist: |
| 2498 | if token.str not in op and not token.isComparisonOp: |
| 2499 | continue |
| 2500 | if not token.astOperand1 or not token.astOperand2: |
| 2501 | continue |
| 2502 | if not token.astOperand1.valueType or not token.astOperand2.valueType: |
| 2503 | continue |
| 2504 | if ((token.astOperand1.str in op or token.astOperand1.isComparisonOp) and |
| 2505 | (token.astOperand2.str in op or token.astOperand2.isComparisonOp)): |
| 2506 | e1, e2 = getEssentialCategorylist(token.astOperand1.astOperand2, token.astOperand2.astOperand1) |
| 2507 | elif token.astOperand1.str in op or token.astOperand1.isComparisonOp: |
| 2508 | e1, e2 = getEssentialCategorylist(token.astOperand1.astOperand2, token.astOperand2) |
| 2509 | elif token.astOperand2.str in op or token.astOperand2.isComparisonOp: |
| 2510 | e1, e2 = getEssentialCategorylist(token.astOperand1, token.astOperand2.astOperand1) |
| 2511 | else: |
| 2512 | e1, e2 = getEssentialCategorylist(token.astOperand1, token.astOperand2) |
| 2513 | if token.str == "+=" or token.str == "+": |
| 2514 | if e1 == "char" and (e2 == "signed" or e2 == "unsigned"): |
| 2515 | continue |
| 2516 | if e2 == "char" and (e1 == "signed" or e1 == "unsigned"): |
| 2517 | continue |
| 2518 | if token.str == "-=" or token.str == "-": |
| 2519 | if e1 == "char" and (e2 == "signed" or e2 == "unsigned"): |
| 2520 | continue |
| 2521 | if e1 and e2 and (e1.find('Anonymous') != -1 and (e2 == "signed" or e2 == "unsigned")): |
| 2522 | continue |
| 2523 | if e1 and e2 and (e2.find('Anonymous') != -1 and (e1 == "signed" or e1 == "unsigned")): |
| 2524 | continue |
| 2525 | if e1 and e2 and e1 != e2: |
| 2526 | self.reportError(token, 10, 4) |
| 2527 | |
| 2528 | def misra_10_5(self, cfg): |
| 2529 | def _get_essential_category(token): |
nothing calls this directly
no test coverage detected