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 create nodes



details:   https://anonhg.NetBSD.org/src/rev/9e2305d7a090
branches:  trunk
changeset: 979631:9e2305d7a090
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 03 20:31:08 2021 +0000

description:
lint: rename functions that create nodes

diffstat:

 usr.bin/xlint/lint1/cgram.y    |  18 +++++++-------
 usr.bin/xlint/lint1/externs1.h |   8 +++---
 usr.bin/xlint/lint1/init.c     |   6 ++--
 usr.bin/xlint/lint1/tree.c     |  52 +++++++++++++++++++----------------------
 4 files changed, 40 insertions(+), 44 deletions(-)

diffs (truncated from 313 to 300 lines):

diff -r 01c972fb94c1 -r 9e2305d7a090 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jan 03 20:20:01 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jan 03 20:31:08 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.127 2021/01/01 11:41:01 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.128 2021/01/03 20:31:08 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.127 2021/01/01 11:41:01 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.128 2021/01/03 20:31:08 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1855,13 +1855,13 @@
                /* XXX really necessary? */
                if (yychar < 0)
                        yychar = yylex();
-               $$ = getnnode(getsym($1), yychar);
+               $$ = new_name_node(getsym($1), yychar);
          }
        | string {
-               $$ = getsnode($1);
+               $$ = new_string_node($1);
          }
        | T_CON {
-               $$ = getcnode(gettyp($1->v_tspec), $1);
+               $$ = new_constant_node(gettyp($1->v_tspec), $1);
          }
        | T_LPAREN expr T_RPAREN {
                if ($2 != NULL)
@@ -1877,7 +1877,7 @@
                /* ({ }) is a GCC extension */
                gnuism(320);
        } comp_stmnt_rbrace T_RPAREN {
-               $$ = getnnode(initsym, 0);
+               $$ = new_name_node(initsym, 0);
        }
        | T_LPAREN comp_stmnt_lbrace expr_stmnt_list {
                blklev--;
@@ -1888,7 +1888,7 @@
                /* ({ }) is a GCC extension */
                gnuism(320);
        } comp_stmnt_rbrace T_RPAREN {
-               $$ = getnnode(initsym, 0);
+               $$ = new_name_node(initsym, 0);
        }
        | term T_INCDEC {
                $$ = build($2 == INC ? INCAFT : DECAFT, $1, NULL);
@@ -1936,7 +1936,7 @@
                                $1 = cconv($1);
                        }
                        msym = struct_or_union_member($1, $2, getsym($3));
-                       $$ = build($2, $1, getnnode(msym, 0));
+                       $$ = build($2, $1, new_name_node(msym, 0));
                } else {
                        $$ = NULL;
                }
@@ -1982,7 +1982,7 @@
                if (!Sflag)
                         /* compound literals are a C9X/GCC extension */
                         gnuism(319);
-               $$ = getnnode(initsym, 0);
+               $$ = new_name_node(initsym, 0);
          }
        ;
 
diff -r 01c972fb94c1 -r 9e2305d7a090 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h    Sun Jan 03 20:20:01 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h    Sun Jan 03 20:31:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs1.h,v 1.46 2021/01/03 20:14:38 rillig Exp $     */
+/*     $NetBSD: externs1.h,v 1.47 2021/01/03 20:31:08 rillig Exp $     */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -198,9 +198,9 @@
  */
 extern type_t  *incref(type_t *, tspec_t);
 extern type_t  *tincref(type_t *, tspec_t);
-extern tnode_t *getcnode(type_t *, val_t *);
-extern tnode_t *getnnode(sym_t *, int);
-extern tnode_t *getsnode(strg_t *);
+extern tnode_t *new_constant_node(type_t *, val_t *);
+extern tnode_t *new_name_node(sym_t *, int);
+extern tnode_t *new_string_node(strg_t *);
 extern sym_t   *struct_or_union_member(tnode_t *, op_t, sym_t *);
 extern tnode_t *build(op_t, tnode_t *, tnode_t *);
 extern tnode_t *cconv(tnode_t *);
diff -r 01c972fb94c1 -r 9e2305d7a090 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Sun Jan 03 20:20:01 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Sun Jan 03 20:31:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.59 2021/01/03 19:10:47 rillig Exp $ */
+/*     $NetBSD: init.c,v 1.60 2021/01/03 20:31:08 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.59 2021/01/03 19:10:47 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.60 2021/01/03 20:31:08 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -582,7 +582,7 @@
         */
        if ((sc == AUTO || sc == REG) &&
            initsym->s_type->t_tspec != ARRAY && initstk->i_next == NULL) {
-               ln = getnnode(initsym, 0);
+               ln = new_name_node(initsym, 0);
                ln->tn_type = tduptyp(ln->tn_type);
                ln->tn_type->t_const = 0;
                tn = build(ASSIGN, ln, tn);
diff -r 01c972fb94c1 -r 9e2305d7a090 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jan 03 20:20:01 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jan 03 20:31:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.120 2021/01/03 19:10:47 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.121 2021/01/03 20:31:08 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.120 2021/01/03 19:10:47 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.121 2021/01/03 20:31:08 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -50,7 +50,7 @@
 #include "lint1.h"
 #include "cgram.h"
 
-static tnode_t *new_int_const_node(tspec_t, int64_t);
+static tnode_t *new_integer_constant_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 *);
@@ -162,7 +162,7 @@
  * Create a node for a constant.
  */
 tnode_t *
-getcnode(type_t *tp, val_t *v)
+new_constant_node(type_t *tp, val_t *v)
 {
        tnode_t *n;
 
@@ -177,11 +177,8 @@
        return n;
 }
 
-/*
- * Create a node for a integer constant.
- */
 static tnode_t *
-new_int_const_node(tspec_t t, int64_t q)
+new_integer_constant_node(tspec_t t, int64_t q)
 {
        tnode_t *n;
 
@@ -199,7 +196,7 @@
  * ntok is the token which follows the name.
  */
 tnode_t *
-getnnode(sym_t *sym, int ntok)
+new_name_node(sym_t *sym, int ntok)
 {
        tnode_t *n;
 
@@ -247,7 +244,7 @@
        }
 
        if (sym->s_kind != FVFT && sym->s_kind != FMEMBER)
-               LERROR("getnnode(%d)", sym->s_kind);
+               LERROR("new_name_node(%d)", sym->s_kind);
 
        n = getnode();
        n->tn_type = sym->s_type;
@@ -265,11 +262,8 @@
        return n;
 }
 
-/*
- * Create a node for a string.
- */
 tnode_t *
-getsnode(strg_t *strg)
+new_string_node(strg_t *strg)
 {
        size_t  len;
        tnode_t *n;
@@ -2300,9 +2294,11 @@
        }
 
 #if PTRDIFF_IS_LONG
-       ctn = new_int_const_node(LONG, rn->tn_sym->s_value.v_quad / CHAR_BIT);
+       ctn = new_integer_constant_node(LONG,
+           rn->tn_sym->s_value.v_quad / CHAR_BIT);
 #else
-       ctn = new_int_const_node(INT, rn->tn_sym->s_value.v_quad / CHAR_BIT);
+       ctn = new_integer_constant_node(INT,
+           rn->tn_sym->s_value.v_quad / CHAR_BIT);
 #endif
 
        ntn = new_tnode(PLUS, tincref(rn->tn_type, PTR), ln, ctn);
@@ -2334,7 +2330,7 @@
        if (ln->tn_type->t_tspec == PTR) {
                cn = plength(ln->tn_type);
        } else {
-               cn = new_int_const_node(INT, (int64_t)1);
+               cn = new_integer_constant_node(INT, (int64_t)1);
        }
        ntn = new_tnode(op, ln->tn_type, ln, cn);
 
@@ -2353,13 +2349,13 @@
 
        switch (ln->tn_type->t_tspec) {
        case LCOMPLEX:
-               cn = new_int_const_node(LDOUBLE, (int64_t)1);
+               cn = new_integer_constant_node(LDOUBLE, (int64_t)1);
                break;
        case DCOMPLEX:
-               cn = new_int_const_node(DOUBLE, (int64_t)1);
+               cn = new_integer_constant_node(DOUBLE, (int64_t)1);
                break;
        case FCOMPLEX:
-               cn = new_int_const_node(FLOAT, (int64_t)1);
+               cn = new_integer_constant_node(FLOAT, (int64_t)1);
                break;
        default:
                /* __%s__ is illegal for type %s */
@@ -2668,7 +2664,7 @@
        st = INT;
 #endif
 
-       return new_int_const_node(st, (int64_t)(elem * elsz / CHAR_BIT));
+       return new_integer_constant_node(st, (int64_t)(elem * elsz / CHAR_BIT));
 }
 
 /*
@@ -2818,7 +2814,7 @@
 
        v->v_quad = xsign(q, t, -1);
 
-       cn = getcnode(tn->tn_type, v);
+       cn = new_constant_node(tn->tn_type, v);
 
        return cn;
 }
@@ -2867,7 +2863,7 @@
                lint_assert(/*CONSTCOND*/0);
        }
 
-       return getcnode(tn->tn_type, v);
+       return new_constant_node(tn->tn_type, v);
 }
 
 /*
@@ -2964,7 +2960,7 @@
            fpe = 0;
        }
 
-       return getcnode(tn->tn_type, v);
+       return new_constant_node(tn->tn_type, v);
 }
 
 
@@ -2980,7 +2976,7 @@
 #else
        st = UINT;
 #endif
-       return new_int_const_node(st, tsize(tp) / CHAR_BIT);
+       return new_integer_constant_node(st, tsize(tp) / CHAR_BIT);
 }
 
 /*
@@ -3001,7 +2997,7 @@
                error(111, "offsetof");
 
        // XXX: wrong size, no checking for sym fixme
-       return new_int_const_node(st, tsize(tp) / CHAR_BIT);
+       return new_integer_constant_node(st, tsize(tp) / CHAR_BIT);
 }
 
 int64_t
@@ -3111,7 +3107,7 @@
        st = UINT;
 #endif
 
-       return new_int_const_node(st, (int64_t)getbound(tp) / CHAR_BIT);



Home | Main Index | Thread Index | Old Index