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: move getopname over to tree.c
details: https://anonhg.NetBSD.org/src/rev/35c92c131cf0
branches: trunk
changeset: 953786:35c92c131cf0
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Mar 20 20:56:58 2021 +0000
description:
lint: move getopname over to tree.c
Except for the one use in print_tnode, the name of the operator is only
used in tree.c.
No functional change.
diffstat:
usr.bin/xlint/lint1/op.h | 4 +---
usr.bin/xlint/lint1/oper.c | 8 +-------
usr.bin/xlint/lint1/print.c | 6 +++---
usr.bin/xlint/lint1/tree.c | 22 ++++++++++++++--------
4 files changed, 19 insertions(+), 21 deletions(-)
diffs (143 lines):
diff -r f4a94a761c89 -r 35c92c131cf0 usr.bin/xlint/lint1/op.h
--- a/usr.bin/xlint/lint1/op.h Sat Mar 20 20:39:35 2021 +0000
+++ b/usr.bin/xlint/lint1/op.h Sat Mar 20 20:56:58 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: op.h,v 1.15 2021/03/20 20:39:35 rillig Exp $ */
+/* $NetBSD: op.h,v 1.16 2021/03/20 20:56:58 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -72,5 +72,3 @@
name,
#define end_ops() } op_t;
#include "ops.def"
-
-const char *getopname(op_t);
diff -r f4a94a761c89 -r 35c92c131cf0 usr.bin/xlint/lint1/oper.c
--- a/usr.bin/xlint/lint1/oper.c Sat Mar 20 20:39:35 2021 +0000
+++ b/usr.bin/xlint/lint1/oper.c Sat Mar 20 20:56:58 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: oper.c,v 1.8 2021/03/20 20:39:35 rillig Exp $ */
+/* $NetBSD: oper.c,v 1.9 2021/03/20 20:56:58 rillig Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -51,9 +51,3 @@
},
#define end_ops(n) };
#include "ops.def"
-
-const char *
-getopname(op_t op)
-{
- return modtab[op].m_name;
-}
diff -r f4a94a761c89 -r 35c92c131cf0 usr.bin/xlint/lint1/print.c
--- a/usr.bin/xlint/lint1/print.c Sat Mar 20 20:39:35 2021 +0000
+++ b/usr.bin/xlint/lint1/print.c Sat Mar 20 20:56:58 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.10 2021/01/05 23:20:53 rillig Exp $ */
+/* $NetBSD: print.c,v 1.11 2021/03/20 20:56:58 rillig Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: print.c,v 1.10 2021/01/05 23:20:53 rillig Exp $");
+__RCSID("$NetBSD: print.c,v 1.11 2021/03/20 20:56:58 rillig Exp $");
#endif
#include <stdio.h>
@@ -82,7 +82,7 @@
}
break;
default:
- (void)snprintf(buf, bufsiz, "%s", getopname(tn->tn_op));
+ (void)snprintf(buf, bufsiz, "%s", modtab[tn->tn_op].m_name);
break;
}
return buf;
diff -r f4a94a761c89 -r 35c92c131cf0 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sat Mar 20 20:39:35 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sat Mar 20 20:56:58 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.240 2021/03/20 20:39:35 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.241 2021/03/20 20:56:58 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.240 2021/03/20 20:39:35 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.241 2021/03/20 20:56:58 rillig Exp $");
#endif
#include <float.h>
@@ -97,6 +97,12 @@
extern sig_atomic_t fpe;
+static const char *
+getopname(op_t op)
+{
+ return modtab[op].m_name;
+}
+
#ifdef DEBUG
void
debug_node(const tnode_t *tn, int indent)
@@ -472,7 +478,7 @@
error(105, op == POINT ? "object" : "pointer");
} else {
/* unacceptable operand of '%s' */
- error(111, modtab[op].m_name);
+ error(111, getopname(op));
}
}
@@ -1781,7 +1787,7 @@
default:
/* combination of '%s' and '%s', op %s */
warning(242, type_name(ln->tn_type), type_name(rn->tn_type),
- modtab[op].m_name);
+ getopname(op));
break;
}
}
@@ -2414,7 +2420,7 @@
*/
if (nsz < osz && (v->v_quad & xmask) != 0) {
/* constant truncated by conv., op %s */
- warning(306, modtab[op].m_name);
+ warning(306, getopname(op));
}
} else if (op == ANDASS || op == BITAND) {
/*
@@ -2427,12 +2433,12 @@
(nv->v_quad & xmask) != xmask) {
/* extra bits set to 0 in conv. of '%s' ... */
warning(309, type_name(gettyp(ot)),
- type_name(tp), modtab[op].m_name);
+ type_name(tp), getopname(op));
} else if (nsz < osz &&
(v->v_quad & xmask) != xmask &&
(v->v_quad & xmask) != 0) {
/* constant truncated by conv., op %s */
- warning(306, modtab[op].m_name);
+ warning(306, getopname(op));
}
} else if ((nt != PTR && is_uinteger(nt)) &&
(ot != PTR && !is_uinteger(ot)) &&
@@ -2930,7 +2936,7 @@
error(212);
} else {
/* unknown operand size, op %s */
- error(138, modtab[op].m_name);
+ error(138, getopname(op));
}
return NULL;
}
Home |
Main Index |
Thread Index |
Old Index