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 members of tnode_t to more ...
details: https://anonhg.NetBSD.org/src/rev/86c7db4dac44
branches: trunk
changeset: 365271:86c7db4dac44
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Apr 16 21:14:33 2022 +0000
description:
lint: rename members of tnode_t to more closely match reality
The flags do not describe the left operand of the node but both, as for
most operators, either none or both operands are in test context or in
value context.
The one exception is the operator '?' from the '?:' conditional, for
which the left operand is in test context and the right operand is in
value context.
No binary change.
diffstat:
usr.bin/xlint/lint1/op.h | 6 +++---
usr.bin/xlint/lint1/ops.def | 6 +++---
usr.bin/xlint/lint1/tree.c | 16 ++++++++--------
3 files changed, 14 insertions(+), 14 deletions(-)
diffs (105 lines):
diff -r 0e8f845af86b -r 86c7db4dac44 usr.bin/xlint/lint1/op.h
--- a/usr.bin/xlint/lint1/op.h Sat Apr 16 20:57:10 2022 +0000
+++ b/usr.bin/xlint/lint1/op.h Sat Apr 16 21:14:33 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: op.h,v 1.17 2021/08/19 18:39:34 rillig Exp $ */
+/* $NetBSD: op.h,v 1.18 2022/04/16 21:14:33 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -46,8 +46,8 @@
bool m_requires_arith: 1;
bool m_requires_scalar: 1;
bool m_fold_constant_operands: 1;
- bool m_left_value_context: 1;
- bool m_left_test_context: 1;
+ bool m_value_context: 1;
+ bool m_test_context: 1;
bool m_balance_operands: 1;
bool m_has_side_effect: 1;
bool m_warn_if_left_unsigned_in_c90: 1;
diff -r 0e8f845af86b -r 86c7db4dac44 usr.bin/xlint/lint1/ops.def
--- a/usr.bin/xlint/lint1/ops.def Sat Apr 16 20:57:10 2022 +0000
+++ b/usr.bin/xlint/lint1/ops.def Sat Apr 16 21:14:33 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.def,v 1.25 2021/09/10 20:02:50 rillig Exp $ */
+/* $NetBSD: ops.def,v 1.26 2022/04/16 21:14:33 rillig Exp $ */
begin_ops()
@@ -14,8 +14,8 @@
* warn if left operand unsigned x |
* has side effects - - - - - - - - - - - - x |
* balance operands x | |
- * left test context x | |
- * left value context x | |
+ * test context x | |
+ * value context x | |
* fold constant operands - - - - - - - - x | |
* requires scalar x | | |
* requires arithmetic x | | |
diff -r 0e8f845af86b -r 86c7db4dac44 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sat Apr 16 20:57:10 2022 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sat Apr 16 21:14:33 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.431 2022/04/16 20:57:10 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.432 2022/04/16 21:14:33 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.431 2022/04/16 20:57:10 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.432 2022/04/16 21:14:33 rillig Exp $");
#endif
#include <float.h>
@@ -536,7 +536,7 @@
* Apply class conversions to the left operand, but only if its
* value is needed or it is compared with zero.
*/
- if (mp->m_left_value_context || mp->m_left_test_context)
+ if (mp->m_value_context || mp->m_test_context)
ln = cconv(ln);
/*
* The right operand is almost always in a test or value context,
@@ -555,7 +555,7 @@
if (mp->m_comparison)
check_integer_comparison(op, ln, rn);
- if (mp->m_left_value_context || mp->m_left_test_context)
+ if (mp->m_value_context || mp->m_test_context)
ln = promote(op, false, ln);
if (mp->m_binary && op != ARROW && op != POINT &&
op != ASSIGN && op != RETURN && op != INIT) {
@@ -664,7 +664,7 @@
* it is compared with zero and if this operand is a constant.
*/
if (hflag && !constcond_flag &&
- mp->m_left_test_context &&
+ mp->m_test_context &&
(ln->tn_op == CON ||
((mp->m_binary && op != QUEST) && rn->tn_op == CON)) &&
/* XXX: rn->tn_system_dependent should be checked as well */
@@ -676,7 +676,7 @@
/* Fold if the operator requires it */
if (mp->m_fold_constant_operands) {
if (ln->tn_op == CON && (!mp->m_binary || rn->tn_op == CON)) {
- if (mp->m_left_test_context) {
+ if (mp->m_test_context) {
ntn = fold_test(ntn);
} else if (is_floating(ntn->tn_type->t_tspec)) {
ntn = fold_float(ntn);
@@ -4172,8 +4172,8 @@
szof, fcall, vctx, tctx, retval_discarded, eqwarn))
return;
- cvctx = mp->m_left_value_context;
- ctctx = mp->m_left_test_context;
+ cvctx = mp->m_value_context;
+ ctctx = mp->m_test_context;
eq = mp->m_warn_if_operand_eq &&
!ln->tn_parenthesized &&
rn != NULL && !rn->tn_parenthesized;
Home |
Main Index |
Thread Index |
Old Index