Module Name: src
Committed By: rillig
Date: Sun Jan 17 14:50:11 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: cgram.y emit1.c func.c ops.def tree.c
Log Message:
lint: rename operator AMPER to ADDR
There is no operator called 'ampersand'. The ampersand sign is merely
the textual representation of both the operator ADDR and the operator
BITAND.
To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint1/ops.def
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/xlint/lint1/tree.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.141 src/usr.bin/xlint/lint1/cgram.y:1.142
--- src/usr.bin/xlint/lint1/cgram.y:1.141 Sat Jan 16 16:03:46 2021
+++ src/usr.bin/xlint/lint1/cgram.y Sun Jan 17 14:50:11 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.141 2021/01/16 16:03:46 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.142 2021/01/17 14:50:11 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.141 2021/01/16 16:03:46 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.142 2021/01/17 14:50:11 rillig Exp $");
#endif
#include <limits.h>
@@ -1903,7 +1903,7 @@ term:
$$ = build(STAR, $2, NULL);
}
| T_AND term {
- $$ = build(AMPER, $2, NULL);
+ $$ = build(ADDR, $2, NULL);
}
| T_UNOP term {
$$ = build($1, $2, NULL);
Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.38 src/usr.bin/xlint/lint1/emit1.c:1.39
--- src/usr.bin/xlint/lint1/emit1.c:1.38 Sat Jan 16 16:53:23 2021
+++ src/usr.bin/xlint/lint1/emit1.c Sun Jan 17 14:50:11 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.38 2021/01/16 16:53:23 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.39 2021/01/17 14:50:11 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit1.c,v 1.38 2021/01/16 16:53:23 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.39 2021/01/17 14:50:11 rillig Exp $");
#endif
#include <ctype.h>
@@ -460,7 +460,7 @@ outcall(const tnode_t *tn, bool rvused,
}
outint(n);
}
- } else if (arg->tn_op == AMPER &&
+ } else if (arg->tn_op == ADDR &&
arg->tn_left->tn_op == STRING &&
arg->tn_left->tn_string->st_tspec == CHAR) {
/* constant string, write all format specifiers */
Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.61 src/usr.bin/xlint/lint1/func.c:1.62
--- src/usr.bin/xlint/lint1/func.c:1.61 Sun Jan 17 11:28:01 2021
+++ src/usr.bin/xlint/lint1/func.c Sun Jan 17 14:50:11 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.61 2021/01/17 11:28:01 rillig Exp $ */
+/* $NetBSD: func.c,v 1.62 2021/01/17 14:50:11 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.61 2021/01/17 11:28:01 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.62 2021/01/17 14:50:11 rillig Exp $");
#endif
#include <stdlib.h>
@@ -1010,7 +1010,7 @@ doreturn(tnode_t *tn)
rn = tn->tn_right;
while ((op = rn->tn_op) == CVT || op == PLUS)
rn = rn->tn_left;
- if (rn->tn_op == AMPER && rn->tn_left->tn_op == NAME &&
+ if (rn->tn_op == ADDR && rn->tn_left->tn_op == NAME &&
rn->tn_left->tn_sym->s_scl == AUTO) {
/* %s returns pointer to automatic object */
warning(302, funcsym->s_name);
Index: src/usr.bin/xlint/lint1/ops.def
diff -u src/usr.bin/xlint/lint1/ops.def:1.12 src/usr.bin/xlint/lint1/ops.def:1.13
--- src/usr.bin/xlint/lint1/ops.def:1.12 Sat Jan 16 19:03:47 2021
+++ src/usr.bin/xlint/lint1/ops.def Sun Jan 17 14:50:11 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.def,v 1.12 2021/01/16 19:03:47 rillig Exp $ */
+/* $NetBSD: ops.def,v 1.13 2021/01/17 14:50:11 rillig Exp $ */
begin_ops()
@@ -19,7 +19,7 @@ op( DECAFT, "x--", , , , , , , ,1, , ,
op( UPLUS, "+", , , , , , ,1, ,1,1, , , , , , , , ,1,1,1)
op( UMINUS, "-", , , , , , ,1, ,1,1, , , ,1, , , , ,1,1,1)
op( STAR, "*", , , , , , , , , ,1, , , , , , , , , , ,1)
-op( AMPER, "&", , ,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 */
op( MULT, "*", 1, , , , , ,1, ,1,1, ,1, , ,1, , , ,1,1,1)
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.168 src/usr.bin/xlint/lint1/tree.c:1.169
--- src/usr.bin/xlint/lint1/tree.c:1.168 Sun Jan 17 14:45:21 2021
+++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:50:11 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.168 2021/01/17 14:45:21 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.169 2021/01/17 14:50:11 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.168 2021/01/17 14:45:21 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.169 2021/01/17 14:50:11 rillig Exp $");
#endif
#include <float.h>
@@ -585,7 +585,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn)
case DECBEF:
ntn = build_prepost_incdec(op, ln);
break;
- case AMPER:
+ case ADDR:
ntn = build_address(ln, 0);
break;
case STAR:
@@ -692,9 +692,9 @@ cconv(tnode_t *tn)
if (!tn->tn_lvalue) {
/* XXX print correct operator */
/* %soperand of '%s' must be lvalue */
- gnuism(114, "", modtab[AMPER].m_name);
+ gnuism(114, "", modtab[ADDR].m_name);
}
- tn = new_tnode(AMPER, tincref(tn->tn_type->t_subt, PTR),
+ tn = new_tnode(ADDR, tincref(tn->tn_type->t_subt, PTR),
tn, NULL);
}
@@ -1283,7 +1283,7 @@ typeok_op(op_t op, const mod_t *mp, int
if (!typeok_incdec(mp, ln, ltp))
return false;
break;
- case AMPER:
+ case ADDR:
if (!typeok_amper(mp, ln, ltp, lt))
return false;
break;
@@ -2719,7 +2719,7 @@ build_address(tnode_t *tn, bool noign)
return tn->tn_left;
}
- ntn = new_tnode(AMPER, tincref(tn->tn_type, PTR), tn, NULL);
+ ntn = new_tnode(ADDR, tincref(tn->tn_type, PTR), tn, NULL);
return ntn;
}
@@ -3898,7 +3898,7 @@ check_expr_misc(const tnode_t *tn, bool
mp = &modtab[op = tn->tn_op];
switch (op) {
- case AMPER:
+ case ADDR:
if (ln->tn_op == NAME && (reached || rchflg)) {
if (!szof)
mark_as_set(ln->tn_sym);
@@ -3961,7 +3961,7 @@ check_expr_misc(const tnode_t *tn, bool
check_array_index(ln->tn_left, 0);
break;
case CALL:
- lint_assert(ln->tn_op == AMPER);
+ lint_assert(ln->tn_op == ADDR);
lint_assert(ln->tn_left->tn_op == NAME);
if (!szof)
outcall(tn, vctx || tctx, rvdisc);
@@ -4074,7 +4074,7 @@ check_array_index(tnode_t *tn, bool ampe
return;
/* Return if the left node does not stem from an array. */
- if (ln->tn_op != AMPER)
+ if (ln->tn_op != ADDR)
return;
if (ln->tn_left->tn_op != STRING && ln->tn_left->tn_op != NAME)
return;
@@ -4179,7 +4179,7 @@ check_integer_comparison(op_t op, tnode_
* the result is returned in *offsp. In the second case, the static
* object is returned in *symp and the offset in *offsp.
*
- * The expression can consist of PLUS, MINUS, AMPER, NAME, STRING and
+ * The expression can consist of PLUS, MINUS, ADDR, NAME, STRING and
* CON. Type conversions are allowed if they do not change binary
* representation (including width).
*/
@@ -4215,7 +4215,7 @@ conaddr(tnode_t *tn, sym_t **symp, ptrdi
*symp = sym;
*offsp = offs1 + offs2;
break;
- case AMPER:
+ case ADDR:
if (tn->tn_left->tn_op == NAME) {
*symp = tn->tn_left->tn_sym;
*offsp = 0;