MISRA C 2012, section 8.10.3
(expr, composite_operator=False)
| 583 | |
| 584 | |
| 585 | def is_composite_expr(expr, composite_operator=False): |
| 586 | """MISRA C 2012, section 8.10.3""" |
| 587 | if expr is None: |
| 588 | return False |
| 589 | |
| 590 | if not composite_operator: |
| 591 | if expr.str == '?' and simpleMatch(expr.astOperand2, ':'): |
| 592 | colon = expr.astOperand2 |
| 593 | return is_composite_expr(colon.astOperand1,True) or is_composite_expr(colon.astOperand2, True) |
| 594 | if (expr.str in ('+', '-', '*', '/', '%', '&', '|', '^', '>>', "<<", "?", ":", '~')): |
| 595 | return is_composite_expr(expr.astOperand1,True) or is_composite_expr(expr.astOperand2, True) |
| 596 | return False |
| 597 | |
| 598 | # non constant expression? |
| 599 | if expr.isNumber: |
| 600 | return False |
| 601 | if expr.astOperand1 or expr.astOperand2: |
| 602 | return is_composite_expr(expr.astOperand1,True) or is_composite_expr(expr.astOperand2, True) |
| 603 | return True |
| 604 | |
| 605 | |
| 606 | def getEssentialTypeCategory(expr): |
no test coverage detected