Module Name: src Committed By: rillig Date: Sun Jan 17 14:45:21 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_204.c src/usr.bin/xlint/lint1: tree.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_204.c cvs rdiff -u -r1.167 -r1.168 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/tests/usr.bin/xlint/lint1/msg_204.c diff -u src/tests/usr.bin/xlint/lint1/msg_204.c:1.3 src/tests/usr.bin/xlint/lint1/msg_204.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_204.c:1.3 Fri Jan 8 02:11:45 2021 +++ src/tests/usr.bin/xlint/lint1/msg_204.c Sun Jan 17 14:45:21 2021 @@ -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 @@ bug_between_2020_12_31_and_2021_01_08(vo /* * 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. */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.167 src/usr.bin/xlint/lint1/tree.c:1.168 --- src/usr.bin/xlint/lint1/tree.c:1.167 Sun Jan 17 14:37:48 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:45:21 2021 @@ -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 void check_pointer_conversion(op_ 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 @@ build(op_t op, tnode_t *ln, tnode_t *rn) 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 @@ cconv(tnode_t *tn) * 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 @@ typeok_amper(const mod_t *mp, 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 @@ build_struct_access(op_t op, tnode_t *ln 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 @@ build_real_imag(op_t op, tnode_t *ln) * 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;