lint: rename debug_indent to debug_print_indent

The previous name could be mistaken to mean "increase the indentation of
the debug output".  Instead, the function prints the current indentation.

In externs1.h, the macro definition was a duplicate, the macros were
sorted differently than the functions a few lines above.

No binary change.
This commit is contained in:
rillig 2021-12-21 21:04:08 +00:00
parent 164d939d08
commit 9fccf86daf
3 changed files with 13 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: debug.c,v 1.6 2021/12/20 00:10:07 rillig Exp $ */
/* $NetBSD: debug.c,v 1.7 2021/12/21 21:04:08 rillig Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: debug.c,v 1.6 2021/12/20 00:10:07 rillig Exp $");
__RCSID("$NetBSD: debug.c,v 1.7 2021/12/21 21:04:08 rillig Exp $");
#endif
#include <stdlib.h>
@ -59,7 +59,7 @@ debug_printf(const char *fmt, ...)
}
void
debug_indent(void)
debug_print_indent(void)
{
debug_printf("%*s", 2 * debug_indentation, "");
@ -91,7 +91,7 @@ debug_step(const char *fmt, ...)
{
va_list va;
debug_indent();
debug_print_indent();
va_start(va, fmt);
vfprintf(stdout, fmt, va);
va_end(va);
@ -116,7 +116,7 @@ debug_node(const tnode_t *tn)
}
op = tn->tn_op;
debug_indent();
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" : "",

View File

@ -1,4 +1,4 @@
/* $NetBSD: externs1.h,v 1.143 2021/12/20 19:34:01 rillig Exp $ */
/* $NetBSD: externs1.h,v 1.144 2021/12/21 21:04:08 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -118,7 +118,7 @@ extern void expr_restore_memory(struct memory_block *);
#ifdef DEBUG
void debug_node(const tnode_t *);
void debug_printf(const char *fmt, ...) __printflike(1, 2);
void debug_indent(void);
void debug_print_indent(void);
void debug_indent_inc(void);
void debug_indent_dec(void);
void debug_enter(const char *);
@ -130,12 +130,11 @@ void debug_leave(const char *);
#define debug_noop() do { } while (false)
#define debug_node(tn) debug_noop()
#define debug_printf(...) debug_noop()
#define debug_indent() debug_noop()
#define debug_step(...) debug_noop()
#define debug_indent() debug_noop()
#define debug_print_indent() debug_noop()
#define debug_indent_inc() debug_noop()
#define debug_indent_dec() debug_noop()
#define debug_enter() debug_noop()
#define debug_step(...) debug_noop()
#define debug_leave() debug_noop()
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: init.c,v 1.225 2021/12/21 16:50:11 rillig Exp $ */
/* $NetBSD: init.c,v 1.226 2021/12/21 21:04:08 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: init.c,v 1.225 2021/12/21 16:50:11 rillig Exp $");
__RCSID("$NetBSD: init.c,v 1.226 2021/12/21 21:04:08 rillig Exp $");
#endif
#include <stdlib.h>
@ -436,7 +436,7 @@ designation_debug(const designation *dn)
if (dn->dn_len == 0)
return;
debug_indent();
debug_print_indent();
debug_printf("designation: ");
for (i = 0; i < dn->dn_len; i++) {
const designator *dr = dn->dn_items + i;
@ -680,7 +680,7 @@ initialization_debug(const initialization *in)
i = 0;
for (bl = in->in_brace_level; bl != NULL; bl = bl->bl_enclosing) {
debug_indent();
debug_print_indent();
debug_printf("brace level %zu: ", i);
brace_level_debug(bl);
i++;