Lines Matching defs:rn
598 build_op(op_t op, bool sys, type_t *type, tnode_t *ln, tnode_t *rn)
606 ntn->u.ops.right = rn;
843 const tnode_t *rn, tspec_t rt)
848 if (lt == CHAR && is_out_of_char_range(rn)) {
851 op_name(op), (int)rn->u.value.u.integer);
868 check_integer_comparison(op_t op, tnode_t *ln, tnode_t *rn)
872 tspec_t rt = rn->tn_type->t_tspec;
874 if (ln->tn_op != CON && rn->tn_op != CON)
881 if (lt == CHAR && rn->tn_op == CON &&
882 !rn->u.value.v_char_constant) {
885 op_name(op), (int)rn->u.value.u.integer);
895 if (!check_nonportable_char_comparison(op, ln, lt, rn, rt))
899 rn->tn_op == CON && rn->u.value.u.integer <= 0) {
900 if (rn->u.value.u.integer < 0) {
914 "negative constant", type_name(rn->tn_type));
917 warning(162, op_name(op), "0", type_name(rn->tn_type));
1289 build_struct_access(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1292 lint_assert(rn->tn_op == NAME);
1293 lint_assert(is_member(rn->u.sym));
1306 rn->u.sym->u.s_member.sm_offset_in_bits / CHAR_SIZE);
1308 type_t *ptr_tp = expr_derive_type(rn->tn_type, PTR);
1313 op_t nop = rn->tn_type->t_bitfield ? FSEL : INDIR;
1391 check_enum_array_index(const tnode_t *ln, const tnode_t *rn)
1401 if (rn->tn_op != CVT || !rn->tn_type->t_is_enum)
1403 if (rn->u.ops.left->tn_op != LOAD)
1406 const type_t *rtp = rn->u.ops.left->tn_type;
1436 build_plus_minus(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1439 if (rn->tn_type->t_tspec == PTR && is_integer(ln->tn_type->t_tspec)) {
1441 ln = rn;
1442 rn = tmp;
1449 tspec_t rt = rn->tn_type->t_tspec;
1453 check_ctype_macro_invocation(ln, rn);
1454 check_enum_array_index(ln, rn);
1459 rn = convert(NOOP, 0, elsz->tn_type, rn);
1461 tnode_t *prod = build_op(MULT, sys, rn->tn_type, rn, elsz);
1462 if (rn->tn_op == CON)
1474 tnode_t *raw_diff = build_op(op, sys, ptrdiff, ln, rn);
1475 if (ln->tn_op == CON && rn->tn_op == CON)
1484 return build_op(op, sys, ln->tn_type, ln, rn);
1488 build_bit_shift(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1491 if (!allow_c90 && rn->tn_type->t_tspec != INT)
1495 rn = convert(NOOP, 0, gettyp(INT), rn);
1496 return build_op(op, sys, ln->tn_type, ln, rn);
1539 build_colon(bool sys, tnode_t *ln, tnode_t *rn)
1542 tspec_t rt = rn->tn_type->t_tspec;
1554 lint_assert(ln->tn_type->u.sou == rn->tn_type->u.sou);
1563 rn = convert(NOOP, 0, gettyp(PTRDIFF_TSPEC), rn);
1568 tp = rn->tn_type;
1569 } else if (lt == PTR && is_null_pointer(rn))
1570 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
1572 tp = merge_qualifiers(rn->tn_type, ln->tn_type);
1574 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
1575 else if (rt == PTR && rn->tn_type->t_subt->t_tspec == VOID)
1576 tp = merge_qualifiers(rn->tn_type, ln->tn_type);
1583 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
1586 return build_op(COLON, sys, tp, ln, rn);
1649 build_assignment(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1653 tspec_t rt = rn->tn_type->t_tspec;
1655 if (is_assignment(rn->tn_op))
1657 query_message(10, op_name(op), op_name(rn->tn_op));
1662 if (rn->tn_type->t_tspec != ctn->tn_type->t_tspec)
1663 rn = convert(NOOP, 0, ctn->tn_type, rn);
1664 rn = build_op(MULT, sys, rn->tn_type, rn, ctn);
1665 if (rn->u.ops.left->tn_op == CON)
1666 rn = fold_constant_integer(rn);
1672 lint_assert(ln->tn_type->u.sou == rn->tn_type->u.sou);
1691 && (lt != rt || (ln->tn_type->t_bitfield && rn->tn_op == CON))) {
1692 rn = convert(op, 0, ln->tn_type, rn);
1697 && rt == PTR && rn->tn_type->t_subt->t_tspec == VOID
1698 && !is_null_pointer(rn))
1702 if (any_query_enabled && rn->tn_op == CVT && rn->tn_cast &&
1703 types_compatible(ln->tn_type, rn->tn_type, false, false, NULL) &&
1704 is_cast_redundant(rn)) {
1706 query_message(7, type_name(rn->u.ops.left->tn_type),
1707 type_name(rn->tn_type));
1710 return build_op(op, sys, ln->tn_type, ln, rn);
1786 tnode_t *ln, *rn;
1796 for (rn = tn->u.ops.right; rn->tn_op == CVT; rn = rn->u.ops.left)
1801 is_confusing_precedence(tn->tn_op, rn, &cop)) {
1992 * for unary operators; in that case rn is NULL.
1997 build_binary(tnode_t *ln, op_t op, bool sys, tnode_t *rn)
2002 if (ln == NULL || (mp->m_binary && rn == NULL))
2008 rn = cconv(rn);
2011 check_integer_comparison(op, ln, rn);
2017 rn = promote(op, false, rn);
2026 rn->tn_op == CON && rn->u.value.v_unsigned_since_c90) {
2029 rn->u.value.v_unsigned_since_c90 = false;
2033 balance(op, &ln, &rn);
2035 if (!typeok(op, 0, ln, rn))
2042 ntn = build_struct_access(op, sys, ln, rn);
2067 ntn = build_plus_minus(op, sys, ln, rn);
2071 ntn = build_bit_shift(op, sys, ln, rn);
2074 ntn = build_colon(sys, ln, rn);
2089 ntn = build_assignment(op, sys, ln, rn);
2094 type_name(ln->tn_type), type_name(rn->tn_type));
2097 ntn = build_op(op, sys, rn->tn_type, ln, rn);
2104 lint_assert(mp->m_binary == (rn != NULL));
2107 ntn = build_op(op, sys, rettp, ln, rn);
2120 (mp->m_binary && op != QUEST && rn->tn_op == CON)) &&
2121 /* XXX: rn->tn_system_dependent should be checked as well */
2127 if (!mp->m_binary || rn->tn_op == CON) {
2135 lint_assert(has_operands(rn));
2137 ? rn->u.ops.right : rn->u.ops.left);
2139 ? rn->u.ops.left : rn->u.ops.right;
2551 const tnode_t *rn, tspec_t rt)
2554 tspec_t ort = before_conversion(rn)->tn_type->t_tspec;
2611 typeok_shift(const type_t *ltp, tspec_t lt, const tnode_t *rn, tspec_t rt)
2613 if (rn->tn_op != CON)
2616 if (!is_uinteger(rt) && rn->u.value.u.integer < 0)
2619 else if ((uint64_t)rn->u.value.u.integer == size_in_bits(lt))
2621 warning(267, (unsigned)rn->u.value.u.integer, type_name(ltp));
2622 else if ((uint64_t)rn->u.value.u.integer > size_in_bits(lt)) {
2624 warning(122, (unsigned long long)rn->u.value.u.integer,
2631 is_typeok_eq(const tnode_t *ln, tspec_t lt, const tnode_t *rn, tspec_t rt)
2633 if (lt == PTR && is_null_pointer(rn))
2671 check_pointer_comparison(op_t op, const tnode_t *ln, const tnode_t *rn)
2673 type_t *ltp = ln->tn_type, *rtp = rn->tn_type;
2706 const tnode_t *rn, const type_t *rtp, tspec_t rt)
2709 check_pointer_comparison(op, ln, rn);
2729 typeok_quest(tspec_t lt, const tnode_t *rn)
2736 lint_assert(before_conversion(rn)->tn_op == COLON);
2766 const tnode_t *rn, const type_t *rtp, tspec_t rt)
2779 if (lt == PTR && is_null_pointer(rn))
2976 check_unconst_function(const type_t *lstp, const tnode_t *rn)
2981 is_direct_function_call(rn, &function_name) &&
2983 rn->u.call->args_len >= 1 &&
2984 is_const_char_pointer(rn->u.call->args[0])) {
2990 is_direct_function_call(rn, &function_name) &&
2992 rn->u.call->args_len >= 2 &&
2993 is_const_pointer(rn->u.call->args[1])) {
3003 const tnode_t *rn,
3038 check_unconst_function(lstp, rn);
3122 const tnode_t *ln, const tnode_t *rn)
3129 if ((rt = (rtp = rn->tn_type)->t_tspec) == PTR)
3141 if (lt == PTR && is_null_pointer(rn)) {
3142 if (is_integer(rn->tn_type->t_tspec))
3151 lt, lstp, lst, rn, rtp, rt, rstp, rst))
3239 const tnode_t *rn, const type_t *rtp, tspec_t rt)
3263 typeok_shr(op, ln, lt, rn, rt);
3265 typeok_shift(ltp, lt, rn, rt);
3272 return typeok_compare(op, ln, ltp, lt, rn, rtp, rt);
3275 if (is_typeok_eq(ln, lt, rn, rt))
3279 return typeok_quest(lt, rn);
3281 return typeok_colon(ln, ltp, lt, rn, rtp, rt);
3286 if (!check_assign_types_compatible(op, arg, ln, rn))
3325 check_bad_enum_operation(op_t op, const tnode_t *ln, const tnode_t *rn)
3333 ((ln->tn_type->t_is_enum && rn->tn_type->t_tspec == PTR) ||
3334 (rn->tn_type->t_is_enum && ln->tn_type->t_tspec == PTR))) {
3343 check_enum_type_mismatch(op_t op, int arg, const tnode_t *ln, const tnode_t *rn)
3347 if (ln->tn_type->u.enumer != rn->tn_type->u.enumer) {
3352 type_name(ln->tn_type), type_name(rn->tn_type));
3357 type_name(ln->tn_type), type_name(rn->tn_type),
3363 type_name(ln->tn_type), type_name(rn->tn_type));
3368 type_name(rn->tn_type));
3377 check_enum_int_mismatch(op_t op, int arg, const tnode_t *ln, const tnode_t *rn)
3389 if (!rn->tn_type->t_is_enum && rn->tn_op == CON &&
3390 is_integer(rn->tn_type->t_tspec) &&
3391 rn->u.value.u.integer == 0) {
3395 warning(277, type_name(ln->tn_type), type_name(rn->tn_type));
3400 type_name(ln->tn_type), type_name(rn->tn_type), arg);
3404 warning(279, type_name(ln->tn_type), type_name(rn->tn_type));
3408 warning(242, type_name(ln->tn_type), type_name(rn->tn_type),
3417 const tnode_t *rn, const type_t *rtp)
3421 check_bad_enum_operation(op, ln, rn);
3424 check_enum_type_mismatch(op, arg, ln, rn);
3427 check_enum_int_mismatch(op, arg, ln, rn);
3433 typeok(op_t op, int arg, const tnode_t *ln, const tnode_t *rn)
3441 type_t *rtp = mp->m_binary ? rn->tn_type : NULL;
3444 if (Tflag && !typeok_scalar_strict_bool(op, mp, arg, ln, rn))
3449 if (!typeok_op(op, arg, ln, ltp, lt, rn, rtp, rt))
3452 typeok_enum(op, mp, arg, ln, ltp, rn, rtp);
4910 tnode_t *rn = tn->u.ops.right;
4918 rn != NULL && !rn->tn_parenthesized;
4935 check_expr_misc(rn, false, true, eq, false, false, szof);
4938 check_expr_misc(rn, cvctx, ccond, eq, false, false, szof);
4941 check_expr_misc(rn, vctx, cond, false, false, false, szof);
4945 check_expr_misc(rn, true, false, eq, false, false,