Lines Matching defs:ln

598 build_op(op_t op, bool sys, type_t *type, tnode_t *ln, tnode_t *rn)
605 ntn->u.ops.left = ln;
609 lint_assert(ln->tn_type->t_tspec == PTR);
610 tspec_t t = ln->tn_type->t_subt->t_tspec;
842 const tnode_t *ln, tspec_t lt,
856 if (rt == CHAR && is_out_of_char_range(ln)) {
859 (int)ln->u.value.u.integer, op_name(op));
868 check_integer_comparison(op_t op, tnode_t *ln, tnode_t *rn)
871 tspec_t lt = ln->tn_type->t_tspec;
874 if (ln->tn_op != CON && rn->tn_op != CON)
887 if (rt == CHAR && ln->tn_op == CON &&
888 !ln->u.value.v_char_constant) {
891 op_name(op), (int)ln->u.value.u.integer);
895 if (!check_nonportable_char_comparison(op, ln, lt, rn, rt))
903 type_name(ln->tn_type), "negative constant");
906 warning(162, op_name(op), type_name(ln->tn_type), "0");
910 ln->tn_op == CON && ln->u.value.u.integer <= 0) {
911 if (ln->u.value.u.integer < 0) {
1289 build_struct_access(op_t op, bool sys, tnode_t *ln, tnode_t *rn)
1295 bool lvalue = op == ARROW || ln->tn_lvalue;
1298 ln = build_address(sys, ln, true);
1299 else if (ln->tn_type->t_tspec != PTR) {
1301 lint_assert(is_integer(ln->tn_type->t_tspec));
1302 ln = convert(NOOP, 0, expr_derive_type(gettyp(VOID), PTR), ln);
1309 tnode_t *ntn = build_op(PLUS, sys, ptr_tp, ln, ctn);
1310 if (ln->tn_op == CON)
1380 build_prepost_incdec(op_t op, bool sys, tnode_t *ln)
1383 lint_assert(ln != NULL);
1384 tnode_t *cn = ln->tn_type->t_tspec == PTR
1385 ? subt_size_in_bytes(ln->tn_type)
1387 return build_op(op, sys, ln->tn_type, ln, cn);
1391 check_enum_array_index(const tnode_t *ln, const tnode_t *rn)
1394 if (ln->tn_op != ADDR || ln->u.ops.left->tn_op != NAME)
1397 const type_t *ltp = ln->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)) {
1440 tnode_t *tmp = ln;
1441 ln = rn;
1448 tspec_t lt = ln->tn_type->t_tspec;
1453 check_ctype_macro_invocation(ln, rn);
1454 check_enum_array_index(ln, rn);
1456 tnode_t *elsz = subt_size_in_bytes(ln->tn_type);
1465 return build_op(op, sys, ln->tn_type, ln, prod);
1474 tnode_t *raw_diff = build_op(op, sys, ptrdiff, ln, rn);
1475 if (ln->tn_op == CON && rn->tn_op == CON)
1478 tnode_t *elsz = subt_size_in_bytes(ln->tn_type);
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)
1496 return build_op(op, sys, ln->tn_type, ln, rn);
1539 build_colon(bool sys, tnode_t *ln, tnode_t *rn)
1541 tspec_t lt = ln->tn_type->t_tspec;
1547 tp = ln->tn_type;
1549 tp = ln->tn_type;
1554 lint_assert(ln->tn_type->u.sou == rn->tn_type->u.sou);
1555 if (is_incomplete(ln->tn_type)) {
1560 tp = ln->tn_type;
1564 tp = ln->tn_type;
1567 ln = convert(NOOP, 0, gettyp(PTRDIFF_TSPEC), ln);
1570 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
1571 else if (rt == PTR && is_null_pointer(ln))
1572 tp = merge_qualifiers(rn->tn_type, ln->tn_type);
1573 else if (lt == PTR && ln->tn_type->t_subt->t_tspec == VOID)
1574 tp = merge_qualifiers(ln->tn_type, rn->tn_type);
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)
1652 tspec_t lt = ln->tn_type->t_tspec;
1661 tnode_t *ctn = subt_size_in_bytes(ln->tn_type);
1672 lint_assert(ln->tn_type->u.sou == rn->tn_type->u.sou);
1673 if (is_incomplete(ln->tn_type)) {
1691 && (lt != rt || (ln->tn_type->t_bitfield && rn->tn_op == CON))) {
1692 rn = convert(op, 0, ln->tn_type, rn);
1696 if (lt == PTR && ln->tn_type->t_subt->t_tspec != VOID
1700 query_message(20, type_name(ln->tn_type));
1703 types_compatible(ln->tn_type, rn->tn_type, false, false, NULL) &&
1710 return build_op(op, sys, ln->tn_type, ln, rn);
1714 build_real_imag(op_t op, bool sys, tnode_t *ln)
1717 lint_assert(ln != NULL);
1718 if (ln->tn_op == NAME) {
1723 mark_as_used(ln->u.sym, false, false);
1724 mark_as_set(ln->u.sym);
1728 switch (ln->tn_type->t_tspec) {
1741 type_name(ln->tn_type));
1745 tnode_t *ntn = build_op(op, sys, gettyp(t), ln, NULL);
1786 tnode_t *ln, *rn;
1794 for (ln = tn->u.ops.left; ln->tn_op == CVT; ln = ln->u.ops.left)
1800 if (is_confusing_precedence(tn->tn_op, ln, &cop) ||
1997 build_binary(tnode_t *ln, op_t op, bool sys, tnode_t *rn)
2002 if (ln == NULL || (mp->m_binary && rn == NULL))
2006 ln = cconv(ln);
2011 check_integer_comparison(op, ln, rn);
2014 ln = promote(op, false, ln);
2020 ln->tn_op == CON && ln->u.value.v_unsigned_since_c90) {
2023 ln->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);
2045 if (ln->tn_op == ASSIGN && ln->u.ops.right->tn_op == CON) {
2047 warning(382, type_name(ln->tn_type),
2048 is_nonzero_val(&ln->u.ops.right->u.value)
2051 ntn = build_op(op, sys, gettyp(Tflag ? BOOL : INT), ln, NULL);
2057 ntn = build_prepost_incdec(op, sys, ln);
2060 ntn = build_address(sys, ln, false);
2063 ntn = build_op(INDIR, sys, ln->tn_type->t_subt, ln, NULL);
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);
2101 ntn = build_real_imag(op, sys, ln);
2106 ? gettyp(Tflag ? BOOL : INT) : ln->tn_type;
2107 ntn = build_op(op, sys, rettp, ln, rn);
2119 (ln->tn_op == CON ||
2122 !ln->tn_system_dependent)
2126 if (mp->m_fold_constant_operands && ln->tn_op == CON) {
2136 use(ln->u.value.u.integer != 0
2138 ntn = ln->u.value.u.integer != 0
2321 build_member_access(tnode_t *ln, op_t op, bool sys, sbuf_t *member)
2325 if (ln == NULL)
2330 ln = cconv(ln);
2331 msym = struct_or_union_member(ln, op, getsym(member));
2332 return build_binary(ln, op, sys, build_name(msym, false));
2385 typeok_point(const tnode_t *ln, const type_t *ltp, tspec_t lt)
2399 if (ln->tn_lvalue)
2550 const tnode_t *ln, tspec_t lt,
2553 tspec_t olt = before_conversion(ln)->tn_type->t_tspec;
2558 integer_constraints lc = ic_expr(ln);
2562 if (ln->tn_op != CON)
2565 else if (ln->u.value.u.integer < 0)
2571 if (hflag && (ln->tn_op != CON || ln->u.value.u.integer < 0)) {
2582 if (hflag && (ln->tn_op != CON || ln->u.value.u.integer < 0)) {
2631 is_typeok_eq(const tnode_t *ln, tspec_t lt, const tnode_t *rn, tspec_t rt)
2635 if (rt == PTR && is_null_pointer(ln))
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;
2705 const tnode_t *ln, const type_t *ltp, tspec_t lt,
2709 check_pointer_comparison(op, ln, rn);
2765 typeok_colon(const tnode_t *ln, const type_t *ltp, tspec_t lt,
2781 if (rt == PTR && is_null_pointer(ln))
2828 typeok_assign(op_t op, const tnode_t *ln, const type_t *ltp, tspec_t lt)
2833 if (!ln->tn_lvalue) {
2834 if (ln->tn_op == CVT && ln->tn_cast &&
2835 ln->u.ops.left->tn_op == LOAD)
3122 const tnode_t *ln, const tnode_t *rn)
3127 if ((lt = (ltp = ln->tn_type)->t_tspec) == PTR)
3238 const tnode_t *ln, const type_t *ltp, tspec_t lt,
3245 return typeok_point(ln, ltp, lt);
3250 return typeok_incdec(op, ln, ltp);
3254 return typeok_address(op, ln, ltp, lt);
3263 typeok_shr(op, ln, lt, rn, rt);
3272 return typeok_compare(op, ln, ltp, lt, rn, rtp, rt);
3275 if (is_typeok_eq(ln, lt, rn, rt))
3281 return typeok_colon(ln, ltp, lt, rn, rtp, rt);
3286 if (!check_assign_types_compatible(op, arg, ln, rn))
3313 return typeok_assign(op, ln, ltp, lt);
3315 if (!modtab[ln->tn_op].m_has_side_effect)
3316 check_null_effect(ln);
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));
3367 warning(130, type_name(ln->tn_type), op_name(op),
3373 warning(243, op_name(op), type_name(ln->tn_type));
3377 check_enum_int_mismatch(op_t op, int arg, const tnode_t *ln, const tnode_t *rn)
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),
3416 const tnode_t *ln, const type_t *ltp,
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)
3438 type_t *ltp = ln->tn_type;
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);
4513 tnode_t *ln = xcalloc(1, sizeof(*ln));
4514 ln->tn_type = expr_unqualified_type(tp);
4515 ln->tn_lvalue = true;
4516 if (typeok(FARG, n, ln, tn)) {
4522 free(ln);
4759 check_expr_addr(const tnode_t *ln, bool szof, bool fcall)
4762 if (ln->tn_op == NAME && (reached || !warn_about_unreachable)) {
4764 mark_as_set(ln->u.sym);
4765 mark_as_used(ln->u.sym, fcall, szof);
4767 check_array_index(ln, true);
4784 check_expr_side_effect(const tnode_t *ln, bool szof)
4788 if (ln->tn_op == NAME && (reached || !warn_about_unreachable)) {
4789 scl_t sc = ln->u.sym->s_scl;
4791 !ln->u.sym->s_set && !szof && !is_asm_around()) {
4793 warning(158, ln->u.sym->s_name);
4794 mark_as_set(ln->u.sym);
4796 mark_as_used(ln->u.sym, false, false);
4801 check_expr_assign(const tnode_t *ln, bool szof)
4804 if (ln->tn_op == NAME && !szof && (reached || !warn_about_unreachable)) {
4805 mark_as_set(ln->u.sym);
4806 if (ln->u.sym->s_scl == EXTERN)
4807 outusg(ln->u.sym);
4809 check_array_index(ln, false);
4813 check_expr_call(const tnode_t *tn, const tnode_t *ln,
4816 lint_assert(ln->tn_op == ADDR);
4817 lint_assert(ln->u.ops.left->tn_op == NAME);
4818 if (!szof && !is_compiler_builtin(ln->u.ops.left->u.sym->s_name))
4827 check_expr_op(op_t op, const tnode_t *ln, bool szof, bool fcall, bool eqwarn)
4831 check_expr_addr(ln, szof, fcall);
4834 check_array_index(ln, false);
4852 check_expr_side_effect(ln, szof);
4855 check_expr_assign(ln, szof);
4909 tnode_t *ln = tn->u.ops.left;
4911 check_expr_op(op, ln, szof, fcall, eqwarn);
4917 !ln->tn_parenthesized &&
4930 check_expr_misc(ln, cvctx, ccond, eq, is_direct, discard, szof);