Module Name:    src
Committed By:   rillig
Date:           Thu Oct 10 05:01:03 UTC 2024

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

Log Message:
lint: reduce debug logging for possible loss of accuracy

When checking whether a type can represent an expression, only do the
debug logging in the case where the expression cannot obviously be
represented by the type, as the successful cases are usually
uninteresting. While here, clean up the nesting in the debug log.


To generate a diff of this commit:
cvs rdiff -u -r1.653 -r1.654 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.653 src/usr.bin/xlint/lint1/tree.c:1.654
--- src/usr.bin/xlint/lint1/tree.c:1.653	Tue Oct  8 19:50:49 2024
+++ src/usr.bin/xlint/lint1/tree.c	Thu Oct 10 05:01:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.653 2024/10/08 19:50:49 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.654 2024/10/10 05:01:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.653 2024/10/08 19:50:49 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.654 2024/10/10 05:01:03 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -3452,10 +3452,6 @@ check_prototype_conversion(int arg, tspe
 static bool
 can_represent(const type_t *tp, const tnode_t *tn)
 {
-
-	debug_step("%s: type '%s'", __func__, type_name(tp));
-	debug_node(tn);
-
 	uint64_t nmask = value_bits(width_in_bits(tp));
 	if (!is_uinteger(tp->t_tspec))
 		nmask >>= 1;
@@ -3470,6 +3466,10 @@ can_represent(const type_t *tp, const tn
 	    : tpc.smin <= c.smin && tpc.smax >= c.smax)
 		return true;
 
+	debug_enter();
+	debug_step("type '%s' cannot represent:", type_name(tp));
+	debug_node(tn);
+	debug_leave();
 	return false;
 }
 

Reply via email to