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 getnode to expr_zalloc_tnode
details: https://anonhg.NetBSD.org/src/rev/9ec12b1e8d10
branches: trunk
changeset: 960906:9ec12b1e8d10
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Apr 02 09:52:36 2021 +0000
description:
lint: rename getnode to expr_zalloc_tnode
The new name highlights that the returned memory is only valid in the
scope of the current expression. This was misleading before since the
other related functions all have a 't' (probably for 'temporary') in
their names.
Also encode in the function name that the returned memory is zeroed out
as that could not be inferred from the old name.
No functional change.
diffstat:
usr.bin/xlint/lint1/cgram.y | 6 +++---
usr.bin/xlint/lint1/externs1.h | 4 ++--
usr.bin/xlint/lint1/mem1.c | 6 +++---
usr.bin/xlint/lint1/tree.c | 18 +++++++++---------
4 files changed, 17 insertions(+), 17 deletions(-)
diffs (154 lines):
diff -r 5855470faf07 -r 9ec12b1e8d10 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Fri Apr 02 09:45:55 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Fri Apr 02 09:52:36 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.207 2021/03/30 14:25:28 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.208 2021/04/02 09:52:36 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.207 2021/03/30 14:25:28 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.208 2021/04/02 09:52:36 rillig Exp $");
#endif
#include <limits.h>
@@ -1596,7 +1596,7 @@
seen_fallthrough = false;
}
| non_expr_statement {
- $$ = getnode();
+ $$ = expr_zalloc_tnode();
$$->tn_type = gettyp(VOID);
}
;
diff -r 5855470faf07 -r 9ec12b1e8d10 usr.bin/xlint/lint1/externs1.h
--- a/usr.bin/xlint/lint1/externs1.h Fri Apr 02 09:45:55 2021 +0000
+++ b/usr.bin/xlint/lint1/externs1.h Fri Apr 02 09:52:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.96 2021/04/02 09:39:25 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.97 2021/04/02 09:52:36 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -106,7 +106,7 @@
extern void freelblk(int);
extern void *tgetblk(size_t);
-extern tnode_t *getnode(void);
+extern tnode_t *expr_zalloc_tnode(void);
extern void tfreeblk(void);
extern struct memory_block *tsave(void);
extern void trestor(struct memory_block *);
diff -r 5855470faf07 -r 9ec12b1e8d10 usr.bin/xlint/lint1/mem1.c
--- a/usr.bin/xlint/lint1/mem1.c Fri Apr 02 09:45:55 2021 +0000
+++ b/usr.bin/xlint/lint1/mem1.c Fri Apr 02 09:52:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mem1.c,v 1.39 2021/04/02 09:45:55 rillig Exp $ */
+/* $NetBSD: mem1.c,v 1.40 2021/04/02 09:52:36 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.39 2021/04/02 09:45:55 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.40 2021/04/02 09:52:36 rillig Exp $");
#endif
#include <sys/types.h>
@@ -344,7 +344,7 @@
/* Return a freshly allocated tree node. */
tnode_t *
-getnode(void)
+expr_zalloc_tnode(void)
{
tnode_t *tn = tgetblk(sizeof *tn);
tn->tn_from_system_header = in_system_header;
diff -r 5855470faf07 -r 9ec12b1e8d10 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Fri Apr 02 09:45:55 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Fri Apr 02 09:52:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.255 2021/04/01 15:06:49 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.256 2021/04/02 09:52:36 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.255 2021/04/01 15:06:49 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.256 2021/04/02 09:52:36 rillig Exp $");
#endif
#include <float.h>
@@ -181,7 +181,7 @@
{
tnode_t *n;
- n = getnode();
+ n = expr_zalloc_tnode();
n->tn_op = CON;
n->tn_type = tp;
n->tn_val = tgetblk(sizeof *n->tn_val);
@@ -197,7 +197,7 @@
{
tnode_t *n;
- n = getnode();
+ n = expr_zalloc_tnode();
n->tn_op = CON;
n->tn_type = gettyp(t);
n->tn_val = tgetblk(sizeof *n->tn_val);
@@ -279,7 +279,7 @@
lint_assert(sym->s_kind == FVFT || sym->s_kind == FMEMBER);
- n = getnode();
+ n = expr_zalloc_tnode();
n->tn_type = sym->s_type;
if (sym->s_scl != CTCONST) {
n->tn_op = NAME;
@@ -303,7 +303,7 @@
len = strg->st_len;
- n = getnode();
+ n = expr_zalloc_tnode();
n->tn_op = STRING;
n->tn_type = tincref(gettyp(strg->st_tspec), ARRAY);
@@ -1809,7 +1809,7 @@
uint64_t rnum;
#endif
- ntn = getnode();
+ ntn = expr_zalloc_tnode();
ntn->tn_op = op;
ntn->tn_type = type;
@@ -2056,7 +2056,7 @@
check_pointer_conversion(op, tn, tp);
}
- ntn = getnode();
+ ntn = expr_zalloc_tnode();
ntn->tn_op = CVT;
ntn->tn_type = tp;
ntn->tn_cast = op == CVT;
@@ -3501,7 +3501,7 @@
}
for (m = str->sou_first_member; m != NULL; m = m->s_next) {
if (sametype(m->s_type, tn->tn_type)) {
- tn = getnode();
+ tn = expr_zalloc_tnode();
tn->tn_op = CVT;
tn->tn_type = tp;
tn->tn_cast = true;
Home |
Main Index |
Thread Index |
Old Index