Lines Matching refs:rn
641 build_op(op_t op, bool sys, type_t *type, tnode_t *ln, tnode_t *rn)
649 ntn->u.ops.right = rn;
886 const tnode_t *rn, tspec_t rt)
891 if (lt == CHAR && is_out_of_char_range(rn)) {
894 op_name(op), (int)rn->u.value.u.integer);
911 check_integer_comparison(op_t op, tnode_t *ln, tnode_t *rn)
915 tspec_t rt = rn->tn_type->t_tspec;
917 if (ln->tn_op != CON && rn->tn_op != CON)
924 if (lt == CHAR && rn->tn_op == CON &&
925 !rn->u.value.v_char_constant) {
928 op_name(op), (int)rn->u.value.u.integer);
938 if (!check_nonportable_char_comparison(op, ln, lt, rn, rt))
942 rn->tn_op == CON && rn->u.value.u.integer <= 0) {
943 if (rn->u.value.u.integer < 0) {
957 "negative constant", expr_type_name(rn));
960 warning(162, op_name(op), "0", expr_type_name(rn));
1323 build_struct_access(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1326 lint_assert(rn->tn_op == NAME);
1327 lint_assert(is_member(rn->u.sym));
1340 rn->u.sym->u.s_member.sm_offset_in_bits / CHAR_SIZE);
1342 type_t *ptr_tp = expr_derive_type(rn->tn_type, PTR);
1347 op_t nop = rn->tn_type->t_bitfield ? FSEL : INDIR;
1425 check_enum_array_index(const tnode_t *ln, const tnode_t *rn)
1438 if (rn->tn_op != CVT || !rn->tn_type->t_is_enum)
1440 if (rn->u.ops.left->tn_op != LOAD)
1443 const type_t *rtp = rn->u.ops.left->tn_type;
1478 build_plus_minus(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1481 if (rn->tn_type->t_tspec == PTR && is_integer(ln->tn_type->t_tspec)) {
1483 ln = rn;
1484 rn = tmp;
1491 tspec_t rt = rn->tn_type->t_tspec;
1495 check_ctype_macro_invocation(ln, rn);
1496 check_enum_array_index(ln, rn);
1501 rn = convert(NOOP, 0, elsz->tn_type, rn);
1503 tnode_t *prod = build_op(MULT, sys, rn->tn_type, rn, elsz);
1504 if (rn->tn_op == CON)
1516 tnode_t *raw_diff = build_op(op, sys, ptrdiff, ln, rn);
1517 if (ln->tn_op == CON && rn->tn_op == CON)
1526 return build_op(op, sys, ln->tn_type, ln, rn);
1530 build_bit_shift(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1533 if (!allow_c90 && rn->tn_type->t_tspec != INT)
1537 rn = convert(NOOP, 0, gettyp(INT), rn);
1538 return build_op(op, sys, ln->tn_type, ln, rn);
1581 build_colon(bool sys, tnode_t *ln, tnode_t *rn)
1584 tspec_t rt = rn->tn_type->t_tspec;
1596 lint_assert(ln->tn_type->u.sou == rn->tn_type->u.sou);
1605 rn = convert(NOOP, 0, gettyp(PTRDIFF_TSPEC), rn);
1610 tp = rn->tn_type;
1611 } else if (lt == PTR && is_null_pointer(rn))
1612 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
1614 tp = merge_qualifiers(rn->tn_type, ln->tn_type);
1616 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
1617 else if (rt == PTR && rn->tn_type->t_subt->t_tspec == VOID)
1618 tp = merge_qualifiers(rn->tn_type, ln->tn_type);
1625 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
1628 return build_op(COLON, sys, tp, ln, rn);
1691 build_assignment(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1695 tspec_t rt = rn->tn_type->t_tspec;
1697 if (is_assignment(rn->tn_op))
1699 query_message(10, op_name(op), op_name(rn->tn_op));
1704 if (rn->tn_type->t_tspec != ctn->tn_type->t_tspec)
1705 rn = convert(NOOP, 0, ctn->tn_type, rn);
1706 rn = build_op(MULT, sys, rn->tn_type, rn, ctn);
1707 if (rn->u.ops.left->tn_op == CON)
1708 rn = fold_constant_integer(rn);
1714 lint_assert(ln->tn_type->u.sou == rn->tn_type->u.sou);
1733 && (lt != rt || (ln->tn_type->t_bitfield && rn->tn_op == CON))) {
1734 rn = convert(op, 0, ln->tn_type, rn);
1739 && rt == PTR && rn->tn_type->t_subt->t_tspec == VOID
1740 && !is_null_pointer(rn))
1744 if (any_query_enabled && rn->tn_op == CVT && rn->tn_cast &&
1745 types_compatible(ln->tn_type, rn->tn_type, false, false, NULL) &&
1746 is_cast_redundant(rn)) {
1748 query_message(7, expr_type_name(rn->u.ops.left),
1749 type_name(rn->tn_type));
1752 return build_op(op, sys, ln->tn_type, ln, rn);
1828 tnode_t *ln, *rn;
1838 for (rn = tn->u.ops.right; rn->tn_op == CVT; rn = rn->u.ops.left)
1843 is_confusing_precedence(tn->tn_op, rn, &cop)) {
2031 * for unary operators; in that case rn is NULL.
2036 build_binary(tnode_t *ln, op_t op, bool sys, tnode_t *rn)
2041 if (ln == NULL || (mp->m_binary && rn == NULL))
2047 rn = cconv(rn);
2050 check_integer_comparison(op, ln, rn);
2056 rn = promote(op, false, rn);
2065 rn->tn_op == CON && rn->u.value.v_unsigned_since_c90) {
2068 rn->u.value.v_unsigned_since_c90 = false;
2072 balance(op, &ln, &rn);
2074 if (!typeok(op, NULL, 0, ln, rn))
2081 ntn = build_struct_access(op, sys, ln, rn);
2097 ntn = build_plus_minus(op, sys, ln, rn);
2101 ntn = build_bit_shift(op, sys, ln, rn);
2104 ntn = build_colon(sys, ln, rn);
2119 ntn = build_assignment(op, sys, ln, rn);
2124 expr_type_name(ln), expr_type_name(rn));
2127 ntn = build_op(op, sys, rn->tn_type, ln, rn);
2134 lint_assert(mp->m_binary == (rn != NULL));
2143 && rn->tn_op == ASSIGN && rn->u.ops.right->tn_op == CON) {
2145 warning(382, expr_type_name(rn), op_name(op),
2146 is_nonzero_val(&rn->u.ops.right->u.value)
2151 ntn = build_op(op, sys, rettp, ln, rn);
2162 if (!mp->m_binary || rn->tn_op == CON) {
2170 lint_assert(has_operands(rn));
2172 ? rn->u.ops.right : rn->u.ops.left);
2174 ? rn->u.ops.left : rn->u.ops.right;
2585 const tnode_t *rn, tspec_t rt)
2588 tspec_t ort = before_conversion(rn)->tn_type->t_tspec;
2629 typeok_shl_signed_to_msb(const tnode_t *ln, const tnode_t *rn)
2640 && rn->tn_op == CON
2641 && (n = rn->u.value.u.integer, 1 <= n && n <= lw)
2648 typeok_shl(const tnode_t *ln, tspec_t lt, const tnode_t *rn, tspec_t rt)
2658 typeok_shl_signed_to_msb(ln, rn);
2662 typeok_shift(const tnode_t *ln, tspec_t lt, const tnode_t *rn, tspec_t rt)
2664 if (rn->tn_op != CON)
2667 if (!is_uinteger(rt) && rn->u.value.u.integer < 0)
2670 else if ((uint64_t)rn->u.value.u.integer == size_in_bits(lt))
2673 (unsigned)rn->u.value.u.integer, expr_type_name(ln));
2674 else if ((uint64_t)rn->u.value.u.integer > size_in_bits(lt)) {
2676 warning(122, (unsigned long long)rn->u.value.u.integer,
2683 is_typeok_eq(const tnode_t *ln, tspec_t lt, const tnode_t *rn, tspec_t rt)
2685 if (lt == PTR && is_null_pointer(rn))
2723 check_pointer_comparison(op_t op, const tnode_t *ln, const tnode_t *rn)
2725 type_t *ltp = ln->tn_type, *rtp = rn->tn_type;
2758 const tnode_t *rn, const type_t *rtp, tspec_t rt)
2761 check_pointer_comparison(op, ln, rn);
2781 typeok_quest(tspec_t lt, const tnode_t *rn)
2788 lint_assert(before_conversion(rn)->tn_op == COLON);
2818 const tnode_t *rn, const type_t *rtp, tspec_t rt)
2831 if (lt == PTR && is_null_pointer(rn))
2848 warning(126, expr_type_name(ln), expr_type_name(rn));
2858 error(126, expr_type_name(ln), expr_type_name(rn));
3028 check_unconst_function(const type_t *lstp, const tnode_t *rn)
3033 is_direct_function_call(rn, &function_name) &&
3035 rn->u.call->args_len >= 1 &&
3036 is_const_char_pointer(rn->u.call->args[0])) {
3042 is_direct_function_call(rn, &function_name) &&
3044 rn->u.call->args_len >= 2 &&
3045 is_const_pointer(rn->u.call->args[1])) {
3055 const tnode_t *rn,
3091 check_unconst_function(lstp, rn);
3176 const tnode_t *ln, const tnode_t *rn)
3183 if ((rt = (rtp = rn->tn_type)->t_tspec) == PTR)
3195 if (lt == PTR && is_null_pointer(rn)) {
3196 if (is_integer(rn->tn_type->t_tspec))
3205 lt, lstp, lst, rn, rtp, rt, rstp, rst))
3291 const tnode_t *rn, const type_t *rtp, tspec_t rt)
3312 typeok_shl(ln, lt, rn, rt);
3315 typeok_shr(ln, lt, rn, rt);
3317 typeok_shift(ln, lt, rn, rt);
3324 return typeok_compare(op, ln, ltp, lt, rn, rtp, rt);
3327 if (is_typeok_eq(ln, lt, rn, rt))
3331 return typeok_quest(lt, rn);
3333 return typeok_colon(ln, ltp, lt, rn, rtp, rt);
3338 if (!check_assign_types_compatible(op, call, arg, ln, rn))
3358 warning(117, op_name(op), expr_type_name(rn));
3377 check_bad_enum_operation(op_t op, const tnode_t *ln, const tnode_t *rn)
3385 ((ln->tn_type->t_is_enum && rn->tn_type->t_tspec == PTR) ||
3386 (rn->tn_type->t_is_enum && ln->tn_type->t_tspec == PTR))) {
3395 check_enum_type_mismatch(op_t op, int arg, const tnode_t *ln, const tnode_t *rn)
3399 if (ln->tn_type->u.enumer != rn->tn_type->u.enumer) {
3404 type_name(ln->tn_type), type_name(rn->tn_type));
3409 type_name(ln->tn_type), type_name(rn->tn_type),
3415 type_name(ln->tn_type), type_name(rn->tn_type));
3421 expr_type_name(before_conversion(rn)));
3430 check_enum_int_mismatch(op_t op, int arg, const tnode_t *ln, const tnode_t *rn)
3442 if (!rn->tn_type->t_is_enum && rn->tn_op == CON &&
3443 is_integer(rn->tn_type->t_tspec) &&
3444 rn->u.value.u.integer == 0) {
3448 warning(277, type_name(ln->tn_type), expr_type_name(rn));
3453 type_name(ln->tn_type), expr_type_name(rn), arg);
3457 warning(279, type_name(ln->tn_type), expr_type_name(rn));
3461 warning(242, type_name(ln->tn_type), expr_type_name(rn),
3470 const tnode_t *rn, const type_t *rtp)
3474 check_bad_enum_operation(op, ln, rn);
3477 check_enum_type_mismatch(op, arg, ln, rn);
3480 check_enum_int_mismatch(op, arg, ln, rn);
3487 const tnode_t *ln, const tnode_t *rn)
3495 type_t *rtp = mp->m_binary ? rn->tn_type : NULL;
3498 if (Tflag && !typeok_scalar_strict_bool(op, mp, arg, ln, rn))
3503 if (!typeok_op(op, call, arg, ln, ltp, lt, rn, rtp, rt))
3506 typeok_enum(op, mp, arg, ln, ltp, rn, rtp);
4978 tnode_t *rn = tn->u.ops.right;
4986 rn != NULL && !rn->tn_parenthesized;
5003 check_expr_misc(rn, false, true, eq, false, false, szof);
5006 check_expr_misc(rn, cvctx, ccond, eq, false, false, szof);
5009 check_expr_misc(rn, vctx, cond, false, false, false, szof);
5013 check_expr_misc(rn, true, false, eq, false, false,