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 operator STAR to INDIR



details:   https://anonhg.NetBSD.org/src/rev/0884c9067356
branches:  trunk
changeset: 1017968:0884c9067356
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 17 14:55:22 2021 +0000

description:
lint: rename operator STAR to INDIR

C99 calls this operator the "indirection operator".  The word "star"
does not occur in the index of that standard.

diffstat:

 usr.bin/xlint/lint1/cgram.y |   8 ++++----
 usr.bin/xlint/lint1/ops.def |   4 ++--
 usr.bin/xlint/lint1/tree.c  |  24 ++++++++++++------------
 3 files changed, 18 insertions(+), 18 deletions(-)

diffs (153 lines):

diff -r 479870d459ad -r 0884c9067356 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jan 17 14:50:11 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jan 17 14:55:22 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.142 2021/01/17 14:50:11 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.143 2021/01/17 14:55:22 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.142 2021/01/17 14:50:11 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.143 2021/01/17 14:55:22 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1900,7 +1900,7 @@
                $$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL);
          }
        | T_ASTERISK term {
-               $$ = build(STAR, $2, NULL);
+               $$ = build(INDIR, $2, NULL);
          }
        | T_AND term {
                $$ = build(ADDR, $2, NULL);
@@ -1916,7 +1916,7 @@
                $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL);
          }
        | term T_LBRACK expr T_RBRACK {
-               $$ = build(STAR, build(PLUS, $1, $3), NULL);
+               $$ = build(INDIR, build(PLUS, $1, $3), NULL);
          }
        | term T_LPAREN T_RPAREN {
                $$ = new_function_call_node($1, NULL);
diff -r 479870d459ad -r 0884c9067356 usr.bin/xlint/lint1/ops.def
--- a/usr.bin/xlint/lint1/ops.def       Sun Jan 17 14:50:11 2021 +0000
+++ b/usr.bin/xlint/lint1/ops.def       Sun Jan 17 14:55:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ops.def,v 1.13 2021/01/17 14:50:11 rillig Exp $ */
+/*     $NetBSD: ops.def,v 1.14 2021/01/17 14:55:22 rillig Exp $ */
 
 begin_ops()
 
@@ -18,7 +18,7 @@
 op(    DECAFT, "x--",           , , , , , , ,1, , , , ,1, , , , , ,1, ,1)
 op(    UPLUS,  "+",             , , , , , ,1, ,1,1, , , , , , , , ,1,1,1)
 op(    UMINUS, "-",             , , , , , ,1, ,1,1, , , ,1, , , , ,1,1,1)
-op(    STAR,   "*",             , , , , , , , , ,1, , , , , , , , , , ,1)
+op(    INDIR,  "*",             , , , , , , , , ,1, , , , , , , , , , ,1)
 op(    ADDR,   "&",             , ,1, , , , , , , , , , , , , , , , , ,1)
 
 /*     name    repr            b l b o i c a s f v t b s l r p c e e = act */
diff -r 479870d459ad -r 0884c9067356 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jan 17 14:50:11 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jan 17 14:55:22 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.169 2021/01/17 14:50:11 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.170 2021/01/17 14:55:22 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.169 2021/01/17 14:50:11 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.170 2021/01/17 14:55:22 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -588,8 +588,8 @@
        case ADDR:
                ntn = build_address(ln, 0);
                break;
-       case STAR:
-               ntn = new_tnode(STAR, ln->tn_type->t_subt, ln, NULL);
+       case INDIR:
+               ntn = new_tnode(INDIR, ln->tn_type->t_subt, ln, NULL);
                break;
        case PLUS:
        case MINUS:
@@ -1287,7 +1287,7 @@
                if (!typeok_amper(mp, ln, ltp, lt))
                        return false;
                break;
-       case STAR:
+       case INDIR:
                if (!typeok_star(lt))
                        return false;
                break;
@@ -1806,7 +1806,7 @@
                        ntn->tn_type->t_tspec = t;
                break;
 #endif
-       case STAR:
+       case INDIR:
        case FSEL:
                lint_assert(ln->tn_type->t_tspec == PTR);
                t = ln->tn_type->t_subt->t_tspec;
@@ -2636,7 +2636,7 @@
        if (rn->tn_type->t_bitfield) {
                ntn = new_tnode(FSEL, ntn->tn_type->t_subt, ntn, NULL);
        } else {
-               ntn = new_tnode(STAR, ntn->tn_type->t_subt, ntn, NULL);
+               ntn = new_tnode(INDIR, ntn->tn_type->t_subt, ntn, NULL);
        }
 
        if (nolval)
@@ -2713,7 +2713,7 @@
        }
 
        /* eliminate &* */
-       if (tn->tn_op == STAR &&
+       if (tn->tn_op == INDIR &&
            tn->tn_left->tn_type->t_tspec == PTR &&
            tn->tn_left->tn_type->t_subt == tn->tn_type) {
                return tn->tn_left;
@@ -3904,12 +3904,12 @@
                                mark_as_set(ln->tn_sym);
                        mark_as_used(ln->tn_sym, fcall, szof);
                }
-               if (ln->tn_op == STAR && ln->tn_left->tn_op == PLUS)
+               if (ln->tn_op == INDIR && ln->tn_left->tn_op == PLUS)
                        /* check the range of array indices */
                        check_array_index(ln->tn_left, 1);
                break;
        case LOAD:
-               if (ln->tn_op == STAR && ln->tn_left->tn_op == PLUS)
+               if (ln->tn_op == INDIR && ln->tn_left->tn_op == PLUS)
                        /* check the range of array indices */
                        check_array_index(ln->tn_left, 0);
                /* FALLTHROUGH */
@@ -3956,7 +3956,7 @@
                        if (ln->tn_sym->s_scl == EXTERN)
                                outusg(ln->tn_sym);
                }
-               if (ln->tn_op == STAR && ln->tn_left->tn_op == PLUS)
+               if (ln->tn_op == INDIR && ln->tn_left->tn_op == PLUS)
                        /* check the range of array indices */
                        check_array_index(ln->tn_left, 0);
                break;
@@ -3990,7 +3990,7 @@
        case MOD:
        case DIV:
        case MULT:
-       case STAR:
+       case INDIR:
        case UMINUS:
        case UPLUS:
        case DEC:



Home | Main Index | Thread Index | Old Index