From: Oleg Nesterov <oleg@redhat.com>
To: Chris Li <sparse@chrisli.org>, Luc Van Oostenryck <lucvoo@kernel.org>
Cc: Alexey Gladkov <legion@kernel.org>, linux-sparse@vger.kernel.org
Subject: [PATCH 3/4] sparse/dissect: shift symscope() callsites into print_usage()
Date: Sun, 4 Jan 2026 16:22:04 +0100 [thread overview]
Message-ID: <aVqFnEPFlsFsYPhz@redhat.com> (raw)
In-Reply-To: <aVqFaL88QonZYs63@redhat.com>
Simplification and preparation for the next change.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
test-dissect.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/test-dissect.c b/test-dissect.c
index 3691218d..e2b8ec9d 100644
--- a/test-dissect.c
+++ b/test-dissect.c
@@ -16,7 +16,17 @@ static inline const char *show_mode(unsigned mode)
return str;
}
-static void print_usage(struct position *pos, struct symbol *sym, unsigned mode)
+static char symscope(struct symbol *sym)
+{
+ if (sym_is_local(sym)) {
+ if (!dissect_ctx)
+ warning(sym->pos, "no context");
+ return '.';
+ }
+ return ' ';
+}
+
+static void print_usage(struct position *pos, struct symbol *sym, unsigned mode, int kind)
{
static unsigned curr_stream = -1;
static struct ident null;
@@ -30,30 +40,21 @@ static void print_usage(struct position *pos, struct symbol *sym, unsigned mode)
if (dissect_ctx)
ctx = dissect_ctx->ident;
- printf("%4d:%-3d %-16.*s %s ",
- pos->line, pos->pos, ctx->len, ctx->name, show_mode(mode));
-
-}
+ printf("%4d:%-3d %-16.*s %s %c %c ",
+ pos->line, pos->pos, ctx->len, ctx->name,
+ show_mode(mode), symscope(sym), kind);
-static char symscope(struct symbol *sym)
-{
- if (sym_is_local(sym)) {
- if (!dissect_ctx)
- warning(sym->pos, "no context");
- return '.';
- }
- return ' ';
}
static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym)
{
- print_usage(pos, sym, mode);
-
if (!sym->ident)
sym->ident = built_in_ident("__asm__");
- printf("%c %c %-32.*s %s\n",
- symscope(sym), sym->kind, sym->ident->len, sym->ident->name,
+ print_usage(pos, sym, mode, sym->kind);
+
+ printf("%-32.*s %s\n",
+ sym->ident->len, sym->ident->name,
show_typename(sym->ctype.base_type));
switch (sym->kind) {
@@ -89,16 +90,16 @@ static void r_member(unsigned mode, struct position *pos, struct symbol *sym, st
struct ident *ni, *si, *mi;
int mk;
- print_usage(pos, sym, mode);
-
ni = built_in_ident("?");
si = sym->ident ?: ni;
/* mem == NULL means entire struct accessed */
mi = mem ? (mem->ident ?: ni) : built_in_ident("*");
mk = mem ? mem->kind : 'm';
- printf("%c %c %.*s.%-*.*s %s\n",
- symscope(sym), mk, si->len, si->name,
+ print_usage(pos, sym, mode, mk);
+
+ printf("%.*s.%-*.*s %s\n",
+ si->len, si->name,
32-1 - si->len, mi->len, mi->name,
show_typename(mem ? mem->ctype.base_type : sym));
--
2.52.0
next prev parent reply other threads:[~2026-01-04 15:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 15:21 [PATCH 0/4] sparse/dissect: handle SYM_ENUM Oleg Nesterov
2026-01-04 15:21 ` [PATCH 1/4] sparse/dissect: examine SYM_ENUM nodes Oleg Nesterov
2026-01-04 15:22 ` [PATCH 2/4] sparse/dissect: report the usage of enumerators Oleg Nesterov
2026-01-04 15:22 ` Oleg Nesterov [this message]
2026-01-04 15:22 ` [PATCH 4/4] sparse/dissect: sanitize the de-anonymization of SYM_ENUMs Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aVqFnEPFlsFsYPhz@redhat.com \
--to=oleg@redhat.com \
--cc=legion@kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=lucvoo@kernel.org \
--cc=sparse@chrisli.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.