Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: rename functions that had very sho...



details:   https://anonhg.NetBSD.org/src/rev/656e4b89020b
branches:  trunk
changeset: 1017520:656e4b89020b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 29 23:04:31 2020 +0000

description:
lint: rename functions that had very short names

diffstat:

 usr.bin/xlint/lint1/tree.c |  329 ++++++++++++++++++++++----------------------
 1 files changed, 168 insertions(+), 161 deletions(-)

diffs (truncated from 1027 to 300 lines):

diff -r 3524317cd400 -r 656e4b89020b usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Tue Dec 29 22:13:40 2020 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Tue Dec 29 23:04:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.99 2020/12/29 21:32:46 rillig Exp $ */
+/*     $NetBSD: tree.c,v 1.100 2020/12/29 23:04:31 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.99 2020/12/29 21:32:46 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.100 2020/12/29 23:04:31 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -51,41 +51,44 @@
 #include "cgram.h"
 #include "externs1.h"
 
-static tnode_t *getinode(tspec_t, int64_t);
-static void    ptrcmpok(op_t, tnode_t *, tnode_t *);
-static int     asgntypok(op_t, int, tnode_t *, tnode_t *);
-static void    chkbeop(op_t, tnode_t *, tnode_t *);
-static void    chkeop2(op_t, int, tnode_t *, tnode_t *);
-static void    chkeop1(op_t, int, tnode_t *, tnode_t *);
-static tnode_t *mktnode(op_t, type_t *, tnode_t *, tnode_t *);
+static tnode_t *new_int_const_node(tspec_t, int64_t);
+static void    check_pointer_comparison(op_t, tnode_t *, tnode_t *);
+static int     check_assign_types_compatible(op_t, int, tnode_t *, tnode_t *);
+static void    check_bad_enum_operation(op_t, tnode_t *, tnode_t *);
+static void    check_enum_type_mismatch(op_t, int, tnode_t *, tnode_t *);
+static void    check_enum_int_mismatch(op_t, int, tnode_t *, tnode_t *);
+static tnode_t *new_tnode(op_t, type_t *, tnode_t *, tnode_t *);
 static void    balance(op_t, tnode_t **, tnode_t **);
-static void    incompat(op_t, tspec_t, tspec_t);
+static void    warn_incompatible_types(op_t, tspec_t, tspec_t);
 static void    warn_incompatible_pointers(mod_t *, type_t *, type_t *);
 static void    merge_qualifiers(type_t **, type_t *, type_t *);
-static int     conmemb(type_t *);
-static void    ptconv(int, tspec_t, tspec_t, type_t *, tnode_t *);
-static void    iiconv(op_t, int, tspec_t, tspec_t, type_t *, tnode_t *);
-static void    piconv(op_t, tspec_t, type_t *, tnode_t *);
-static void    ppconv(op_t, tnode_t *, type_t *);
-static tnode_t *bldstr(op_t, tnode_t *, tnode_t *);
-static tnode_t *bldincdec(op_t, tnode_t *);
-static tnode_t *bldri(op_t, tnode_t *);
+static int     has_constant_member(type_t *);
+static void    check_prototype_conversion(int, tspec_t, tspec_t, type_t *,
+                                          tnode_t *);
+static void    check_integer_conversion(op_t, int, tspec_t, tspec_t, type_t *,
+                                        tnode_t *);
+static void    check_pointer_integer_conversion(op_t, tspec_t, type_t *,
+                                                tnode_t *);
+static void    check_pointer_conversion(op_t, tnode_t *, type_t *);
+static tnode_t *build_struct_access(op_t, tnode_t *, tnode_t *);
+static tnode_t *build_prepost_incdec(op_t, tnode_t *);
+static tnode_t *build_real_imag(op_t, tnode_t *);
 static tnode_t *build_ampersand(tnode_t *, int);
-static tnode_t *bldplmi(op_t, tnode_t *, tnode_t *);
-static tnode_t *bldshft(op_t, tnode_t *, tnode_t *);
-static tnode_t *bldcol(tnode_t *, tnode_t *);
-static tnode_t *bldasgn(op_t, tnode_t *, tnode_t *);
+static tnode_t *build_plus_minus(op_t, tnode_t *, tnode_t *);
+static tnode_t *build_bit_shift(op_t, tnode_t *, tnode_t *);
+static tnode_t *build_colon(tnode_t *, tnode_t *);
+static tnode_t *build_assignment(op_t, tnode_t *, tnode_t *);
 static tnode_t *plength(type_t *);
 static tnode_t *fold(tnode_t *);
-static tnode_t *foldtst(tnode_t *);
-static tnode_t *foldflt(tnode_t *);
-static tnode_t *chkfarg(type_t *, tnode_t *);
-static tnode_t *parg(int, type_t *, tnode_t *);
-static void    nulleff(tnode_t *);
-static void    displexpr(tnode_t *, int);
+static tnode_t *fold_test(tnode_t *);
+static tnode_t *fold_float(tnode_t *);
+static tnode_t *check_function_arguments(type_t *, tnode_t *);
+static tnode_t *check_prototype_argument(int, type_t *, tnode_t *);
+static void    check_null_effect(tnode_t *);
+static void    display_expression(tnode_t *, int);
 static void    check_array_index(tnode_t *, int);
-static void    chkcomp(op_t, tnode_t *, tnode_t *);
-static void    precconf(tnode_t *);
+static void    check_integer_comparison(op_t, tnode_t *, tnode_t *);
+static void    check_precedence_confusion(tnode_t *);
 
 extern sig_atomic_t fpe;
 
@@ -180,7 +183,7 @@
  * Create a node for a integer constant.
  */
 static tnode_t *
-getinode(tspec_t t, int64_t q)
+new_int_const_node(tspec_t t, int64_t q)
 {
        tnode_t *n;
 
@@ -496,7 +499,7 @@
         * CHAR, which would also become int.
         */
        if (mp->m_comp)
-               chkcomp(op, ln, rn);
+               check_integer_comparison(op, ln, rn);
 
        /*
         * Promote the left operand if it is in a test or value context
@@ -543,30 +546,30 @@
        switch (op) {
        case POINT:
        case ARROW:
-               ntn = bldstr(op, ln, rn);
+               ntn = build_struct_access(op, ln, rn);
                break;
        case INCAFT:
        case DECAFT:
        case INCBEF:
        case DECBEF:
-               ntn = bldincdec(op, ln);
+               ntn = build_prepost_incdec(op, ln);
                break;
        case AMPER:
                ntn = build_ampersand(ln, 0);
                break;
        case STAR:
-               ntn = mktnode(STAR, ln->tn_type->t_subt, ln, NULL);
+               ntn = new_tnode(STAR, ln->tn_type->t_subt, ln, NULL);
                break;
        case PLUS:
        case MINUS:
-               ntn = bldplmi(op, ln, rn);
+               ntn = build_plus_minus(op, ln, rn);
                break;
        case SHL:
        case SHR:
-               ntn = bldshft(op, ln, rn);
+               ntn = build_bit_shift(op, ln, rn);
                break;
        case COLON:
-               ntn = bldcol(ln, rn);
+               ntn = build_colon(ln, rn);
                break;
        case ASSIGN:
        case MULASS:
@@ -580,21 +583,21 @@
        case XORASS:
        case ORASS:
        case RETURN:
-               ntn = bldasgn(op, ln, rn);
+               ntn = build_assignment(op, ln, rn);
                break;
        case COMMA:
        case QUEST:
-               ntn = mktnode(op, rn->tn_type, ln, rn);
+               ntn = new_tnode(op, rn->tn_type, ln, rn);
                break;
        case REAL:
        case IMAG:
-               ntn = bldri(op, ln);
+               ntn = build_real_imag(op, ln);
                break;
        default:
                rtp = mp->m_logical ? gettyp(INT) : ln->tn_type;
                if (!mp->m_binary && rn != NULL)
                        LERROR("build()");
-               ntn = mktnode(op, rtp, ln, rn);
+               ntn = new_tnode(op, rtp, ln, rn);
                break;
        }
 
@@ -604,7 +607,7 @@
 
        /* Print a warning if precedence confusion is possible */
        if (mp->m_tpconf)
-               precconf(ntn);
+               check_precedence_confusion(ntn);
 
        /*
         * Print a warning if one of the operands is in a context where
@@ -623,9 +626,9 @@
        if (mp->m_fold) {
                if (ln->tn_op == CON && (!mp->m_binary || rn->tn_op == CON)) {
                        if (mp->m_tctx) {
-                               ntn = foldtst(ntn);
+                               ntn = fold_test(ntn);
                        } else if (tspec_is_float(ntn->tn_type->t_tspec)) {
-                               ntn = foldflt(ntn);
+                               ntn = fold_float(ntn);
                        } else {
                                ntn = fold(ntn);
                        }
@@ -659,7 +662,7 @@
                        /* XXX print correct operator */
                        (void)gnuism(114, "", modtab[AMPER].m_name);
                }
-               tn = mktnode(AMPER, tincref(tn->tn_type->t_subt, PTR),
+               tn = new_tnode(AMPER, tincref(tn->tn_type->t_subt, PTR),
                             tn, NULL);
        }
 
@@ -675,7 +678,7 @@
        if (tn->tn_lvalue) {
                tp = tduptyp(tn->tn_type);
                tp->t_const = tp->t_volatile = 0;
-               tn = mktnode(LOAD, tp, tn, NULL);
+               tn = new_tnode(LOAD, tp, tn, NULL);
        }
 
        return tn;
@@ -714,26 +717,26 @@
 
        if (mp->m_requires_integer) {
                if (!tspec_is_int(lt) || (mp->m_binary && !tspec_is_int(rt))) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                }
        } else if (mp->m_requires_integer_or_complex) {
                if ((!tspec_is_int(lt) && !tspec_is_complex(lt)) ||
                    (mp->m_binary &&
                     (!tspec_is_int(rt) && !tspec_is_complex(rt)))) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                }
        } else if (mp->m_requires_scalar) {
                if (!tspec_is_scalar(lt) ||
                    (mp->m_binary && !tspec_is_scalar(rt))) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                }
        } else if (mp->m_requires_arith) {
                if (!tspec_is_arith(lt) ||
                    (mp->m_binary && !tspec_is_arith(rt))) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                }
        }
@@ -842,17 +845,17 @@
                /* operands have scalar types (checked above) */
                if ((lt == PTR && !tspec_is_int(rt)) ||
                    (rt == PTR && !tspec_is_int(lt))) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                }
                break;
        case MINUS:
                /* operands have scalar types (checked above) */
                if (lt == PTR && (!tspec_is_int(rt) && rt != PTR)) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                } else if (rt == PTR && lt != PTR) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                }
                if (lt == PTR && rt == PTR) {
@@ -966,11 +969,11 @@
                                /* illegal comb. of pointer and int., op %s */
                                warning(123, lx, lbuf, rx, rbuf, mp->m_name);
                        } else {
-                               incompat(op, lt, rt);
+                               warn_incompatible_types(op, lt, rt);
                                return 0;
                        }
                } else if (lt == PTR && rt == PTR) {
-                       ptrcmpok(op, ln, rn);
+                       check_pointer_comparison(op, ln, rn);
                }
                break;
        case QUEST:
@@ -1049,7 +1052,7 @@
        case INIT:
        case FARG:
        case RETURN:
-               if (!asgntypok(op, arg, ln, rn))
+               if (!check_assign_types_compatible(op, arg, ln, rn))
                        return 0;
                goto assign;
        case MULASS:
@@ -1060,7 +1063,7 @@
        case SUBASS:
                /* operands have scalar types (checked above) */
                if ((lt == PTR && !tspec_is_int(rt)) || rt == PTR) {
-                       incompat(op, lt, rt);
+                       warn_incompatible_types(op, lt, rt);
                        return 0;
                }
                goto assign;
@@ -1090,7 +1093,7 @@
                        error(114, "left ", mp->m_name);
                        return 0;
                } else if (ltp->t_const || ((lt == STRUCT || lt == UNION) &&
-                                           conmemb(ltp))) {



Home | Main Index | Thread Index | Old Index