Module Name:    src
Committed By:   rillig
Date:           Sun Jun 20 20:48:25 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: tree.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 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/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.289 src/usr.bin/xlint/lint1/tree.c:1.290
--- src/usr.bin/xlint/lint1/tree.c:1.289	Sun Jun 20 20:32:42 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jun 20 20:48:25 2021
@@ -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;

Reply via email to