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: condense debug output for initiali...



details:   https://anonhg.NetBSD.org/src/rev/8aaadf739b4d
branches:  trunk
changeset: 953936:8aaadf739b4d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Mar 25 16:30:23 2021 +0000

description:
lint: condense debug output for initializations

This way it does not look more impressive than it really is.

No functional change outside debug mode.

diffstat:

 usr.bin/xlint/lint1/init.c |  28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diffs (75 lines):

diff -r 921cf054f2c9 -r 8aaadf739b4d usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Thu Mar 25 13:10:19 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Thu Mar 25 16:30:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.119 2021/03/25 13:10:19 rillig Exp $        */
+/*     $NetBSD: init.c,v 1.120 2021/03/25 16:30:23 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.119 2021/03/25 13:10:19 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.120 2021/03/25 16:30:23 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -380,27 +380,27 @@
 static void
 debug_initstack_element(const initstack_element *elem)
 {
-       /* TODO: use debug_ind++ instead of the leading spaces here */
-
        if (elem->i_type != NULL)
-               debug_step("  i_type           = %s", type_name(elem->i_type));
+               debug_printf("type '%s'", type_name(elem->i_type));
+       if (elem->i_type != NULL && elem->i_subt != NULL)
+               debug_printf(", ");
        if (elem->i_subt != NULL)
-               debug_step("  i_subt           = %s", type_name(elem->i_subt));
+               debug_printf("subtype '%s'", type_name(elem->i_subt));
 
        if (elem->i_brace)
-               debug_step("  i_brace");
+               debug_printf(", needs closing brace");
        if (elem->i_array_of_unknown_size)
-               debug_step("  i_array_of_unknown_size");
+               debug_printf(", array of unknown size");
        if (elem->i_seen_named_member)
-               debug_step("  i_seen_named_member");
+               debug_printf(", seen named member");
 
        const type_t *eff_type = elem->i_type != NULL
            ? elem->i_type : elem->i_subt;
        if (eff_type->t_tspec == STRUCT && elem->i_current_object != NULL)
-               debug_step("  i_current_object = %s",
+               debug_printf(", current object '%s'",
                    elem->i_current_object->s_name);
 
-       debug_step("  i_remaining      = %d", elem->i_remaining);
+       debug_printf(", remaining %d\n", elem->i_remaining);
 }
 
 /*
@@ -417,7 +417,8 @@
        size_t i = 0;
        for (const initstack_element *elem = initstk;
             elem != NULL; elem = elem->i_enclosing) {
-               debug_step("initstk[%zu]:", i);
+               debug_indent();
+               debug_printf("initstk[%zu]: ", i);
                debug_initstack_element(elem);
                i++;
        }
@@ -642,7 +643,8 @@
        debug_enter();
 
        istk = initstk;
-       debug_step("popping:");
+       debug_indent();
+       debug_printf("popping: ");
        debug_initstack_element(istk);
 
        initstk = istk->i_enclosing;



Home | Main Index | Thread Index | Old Index