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: improve debug logging for NAME exp...



details:   https://anonhg.NetBSD.org/src/rev/bb38ab07cd2d
branches:  trunk
changeset: 366421:bb38ab07cd2d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu May 26 12:04:56 2022 +0000

description:
lint: improve debug logging for NAME expressions

In a NAME expression, the name is an essential part, so put it to the
front, in natural reading order.

diffstat:

 usr.bin/xlint/lint1/debug.c |  27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diffs (50 lines):

diff -r 731b44b91273 -r bb38ab07cd2d usr.bin/xlint/lint1/debug.c
--- a/usr.bin/xlint/lint1/debug.c       Thu May 26 11:54:33 2022 +0000
+++ b/usr.bin/xlint/lint1/debug.c       Thu May 26 12:04:56 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.19 2022/05/26 11:54:33 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.20 2022/05/26 12:04:56 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.19 2022/05/26 11:54:33 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.20 2022/05/26 12:04:56 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -118,15 +118,24 @@
 
        op = tn->tn_op;
        debug_print_indent();
-       debug_printf("'%s' with type '%s'%s%s%s",
-           op == CVT && !tn->tn_cast ? "convert" : modtab[op].m_name,
-           type_name(tn->tn_type), tn->tn_lvalue ? ", lvalue" : "",
-           tn->tn_parenthesized ? ", parenthesized" : "",
-           tn->tn_sys ? ", sys" : "");
+       debug_printf("'%s'",
+           op == CVT && !tn->tn_cast ? "convert" : modtab[op].m_name);
+       if (op == NAME)
+               debug_printf(" '%s' with %s",
+                   tn->tn_sym->s_name,
+                   storage_class_name(tn->tn_sym->s_scl));
+       else
+               debug_printf(" type");
+       debug_printf(" '%s'", type_name(tn->tn_type));
+       if (tn->tn_lvalue)
+               debug_printf(", lvalue");
+       if (tn->tn_parenthesized)
+               debug_printf(", parenthesized");
+       if (tn->tn_sys)
+               debug_printf(", sys");
 
        if (op == NAME)
-               debug_printf(" %s %s\n", tn->tn_sym->s_name,
-                   storage_class_name(tn->tn_sym->s_scl));
+               debug_printf("\n");
        else if (op == CON && is_floating(tn->tn_type->t_tspec))
                debug_printf(", value %Lg\n", tn->tn_val->v_ldbl);
        else if (op == CON && is_uinteger(tn->tn_type->t_tspec))



Home | Main Index | Thread Index | Old Index