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 build_ampersand to build_ad...



details:   https://anonhg.NetBSD.org/src/rev/81205620dce4
branches:  trunk
changeset: 958707:81205620dce4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 17 14:45:21 2021 +0000

description:
lint: rename build_ampersand to build_address

At that stage of analysis, the ampersand is no longer ambiguous, it has
already been resolved as the address-of operator, instead of the
bitwise-and operator.

diffstat:

 tests/usr.bin/xlint/lint1/msg_204.c |   4 ++--
 usr.bin/xlint/lint1/tree.c          |  16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r a0d02de60b0d -r 81205620dce4 tests/usr.bin/xlint/lint1/msg_204.c
--- a/tests/usr.bin/xlint/lint1/msg_204.c       Sun Jan 17 14:37:48 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_204.c       Sun Jan 17 14:45:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_204.c,v 1.3 2021/01/08 02:11:45 rillig Exp $       */
+/*     $NetBSD: msg_204.c,v 1.4 2021/01/17 14:45:21 rillig Exp $       */
 # 3 "msg_204.c"
 
 // Test for message: controlling expressions must have scalar type [204]
@@ -21,7 +21,7 @@
 
        /*
         * FIXME: For some reason, the ampersand is discarded in
-        *  build_ampersand.  This only has a visible effect if the
+        *  build_address.  This only has a visible effect if the
         *  t_spec in check_controlling_expression is evaluated too early,
         *  as has been the case before func.c 1.52 from 2021-01-08.
         */
diff -r a0d02de60b0d -r 81205620dce4 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jan 17 14:37:48 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jan 17 14:45:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.167 2021/01/17 14:37:48 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.168 2021/01/17 14:45:21 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.167 2021/01/17 14:37:48 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.168 2021/01/17 14:45:21 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -78,7 +78,7 @@
 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 *, bool);
+static tnode_t *build_address(tnode_t *, bool);
 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 *);
@@ -586,7 +586,7 @@
                ntn = build_prepost_incdec(op, ln);
                break;
        case AMPER:
-               ntn = build_ampersand(ln, 0);
+               ntn = build_address(ln, 0);
                break;
        case STAR:
                ntn = new_tnode(STAR, ln->tn_type->t_subt, ln, NULL);
@@ -704,7 +704,7 @@
         * of type T)
         */
        if (tn->tn_type->t_tspec == FUNC)
-               tn = build_ampersand(tn, 1);
+               tn = build_address(tn, 1);
 
        /* lvalue to rvalue */
        if (tn->tn_lvalue) {
@@ -780,7 +780,7 @@
             const tnode_t *tn, const type_t *tp, tspec_t t)
 {
        if (t == ARRAY || t == FUNC) {
-               /* ok, a warning comes later (in build_ampersand()) */
+               /* ok, a warning comes later (in build_address()) */
        } else if (!tn->tn_lvalue) {
                if (tn->tn_op == CVT && tn->tn_cast &&
                    tn->tn_left->tn_op == LOAD) {
@@ -2614,7 +2614,7 @@
        nolval = op == POINT && !ln->tn_lvalue;
 
        if (op == POINT) {
-               ln = build_ampersand(ln, 1);
+               ln = build_address(ln, 1);
        } else if (ln->tn_type->t_tspec != PTR) {
                lint_assert(tflag);
                lint_assert(is_integer(ln->tn_type->t_tspec));
@@ -2700,7 +2700,7 @@
  * Create a tree node for the & operator
  */
 static tnode_t *
-build_ampersand(tnode_t *tn, bool noign)
+build_address(tnode_t *tn, bool noign)
 {
        tnode_t *ntn;
        tspec_t t;



Home | Main Index | Thread Index | Old Index