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: remove unnecessary call to print_t...



details:   https://anonhg.NetBSD.org/src/rev/58947b2c8bff
branches:  trunk
changeset: 379817:58947b2c8bff
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jun 20 20:48:25 2021 +0000

description:
lint: remove unnecessary call to print_tnode

For the possible operators that occur in message 324, print_tnode is
equivalent to op_name, and the latter is simpler.

When the function print_node was added to the code base, it had another
use in init.c, for understanding how initialization works in lint.  That
code has since been rewritten completely, therefore print_tnode is no
longer needed.  For debugging, display_expression is the better choice
since it has multi-line output and does not suffer from a fixed-length
buffer.

No functional change.

diffstat:

 usr.bin/xlint/lint1/tree.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r a3825928af5d -r 58947b2c8bff usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Jun 20 20:32:42 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Jun 20 20:48:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.289 2021/06/20 20:32:42 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.290 2021/06/20 20:48:25 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.289 2021/06/20 20:32:42 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.290 2021/06/20 20:48:25 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -1934,12 +1934,10 @@ check_prototype_conversion(int arg, tspe
 /*
  * Print warnings for conversions of integer types which may cause problems.
  */
-/* ARGSUSED */
 static void
 check_integer_conversion(op_t op, int arg, tspec_t nt, tspec_t ot, type_t *tp,
                         tnode_t *tn)
 {
-       char opbuf[16];
 
        if (tn->tn_op == CON)
                return;
@@ -1971,7 +1969,7 @@ check_integer_conversion(op_t op, int ar
                case SHL:
                        /* suggest cast from '%s' to '%s' on op %s to ... */
                        warning(324, type_name(gettyp(ot)), type_name(tp),
-                           print_tnode(opbuf, sizeof(opbuf), tn));
+                           op_name(tn->tn_op));
                        break;
                default:
                        break;



Home | Main Index | Thread Index | Old Index