Module Name: src Committed By: rillig Date: Sun Jan 17 14:55:22 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: cgram.y ops.def tree.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint1/ops.def cvs rdiff -u -r1.169 -r1.170 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.142 src/usr.bin/xlint/lint1/cgram.y:1.143 --- src/usr.bin/xlint/lint1/cgram.y:1.142 Sun Jan 17 14:50:11 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jan 17 14:55:22 2021 @@ -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 @@ term: $$ = 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 @@ term: $$ = 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); Index: src/usr.bin/xlint/lint1/ops.def diff -u src/usr.bin/xlint/lint1/ops.def:1.13 src/usr.bin/xlint/lint1/ops.def:1.14 --- src/usr.bin/xlint/lint1/ops.def:1.13 Sun Jan 17 14:50:11 2021 +++ src/usr.bin/xlint/lint1/ops.def Sun Jan 17 14:55:22 2021 @@ -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( INCAFT, "x++", , , , , , , ,1, , , 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 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.169 src/usr.bin/xlint/lint1/tree.c:1.170 --- src/usr.bin/xlint/lint1/tree.c:1.169 Sun Jan 17 14:50:11 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 14:55:22 2021 @@ -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 @@ build(op_t op, tnode_t *ln, tnode_t *rn) 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 @@ typeok_op(op_t op, const mod_t *mp, int 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 @@ new_tnode(op_t op, type_t *type, tnode_t 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 @@ build_struct_access(op_t op, tnode_t *ln 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 @@ build_address(tnode_t *tn, bool noign) } /* 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 @@ check_expr_misc(const tnode_t *tn, bool 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 @@ check_expr_misc(const tnode_t *tn, bool 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 @@ check_expr_misc(const tnode_t *tn, bool case MOD: case DIV: case MULT: - case STAR: + case INDIR: case UMINUS: case UPLUS: case DEC: