All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/4] sparse/dissect: introduce find_report_member()
Date: Fri, 5 Jun 2026 16:56:42 +0200	[thread overview]
Message-ID: <aiLjqif9hlvb3VbP@redhat.com> (raw)
In-Reply-To: <aiLjjDwKRB1UjNcs@redhat.com>

No functional changes, preparation for the next patches.

Add the new helper, find_report_member(), which simply does
lookup_member() + report_member(), and update the current users of
the same pattern to use it.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 dissect.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/dissect.c b/dissect.c
index 04ec89ca..6b5cb0ef 100644
--- a/dissect.c
+++ b/dissect.c
@@ -331,6 +331,13 @@ static struct symbol *lookup_member(struct symbol *type, struct ident *name, int
 	return mem;
 }
 
+static struct symbol *find_report_member(usage_t mode, struct position *pos,
+					 struct symbol *type, struct ident *name,
+					 int *p_addr)
+{
+	return report_member(mode, pos, type, lookup_member(type, name, p_addr));
+}
+
 static struct expression *peek_preop(struct expression *expr, int op)
 {
 	do {
@@ -474,8 +481,8 @@ again:
 			p_mode = U_R_VAL;
 		p_type = do_expression(p_mode, expr->deref);
 
-		ret = report_member(mode, &expr->m_pos, p_type,
-			lookup_member(p_type, expr->member, NULL));
+		ret = find_report_member(mode, &expr->m_pos,
+					 p_type, expr->member, NULL);
 	}
 
 	break; case EXPR_OFFSETOF: {
@@ -483,8 +490,8 @@ again:
 
 		do {
 			if (expr->op == '.') {
-				in = report_member(U_VOID, &expr->pos, in,
-					lookup_member(in, expr->ident, NULL));
+				in = find_report_member(U_VOID, &expr->pos,
+							in, expr->ident, NULL);
 			} else {
 				do_expression(U_R_VAL, expr->index);
 				in = in->ctype.base_type;
@@ -609,8 +616,8 @@ static struct symbol *do_initializer(struct symbol *type, struct expression *exp
 
 				m_type = type;
 				while (m_expr->type == EXPR_IDENTIFIER) {
-					m_type = report_member(U_W_VAL, &m_expr->pos, m_type,
-							lookup_member(m_type, m_expr->expr_ident, m_atop));
+					m_type = find_report_member(U_W_VAL, &m_expr->pos,
+								    m_type, m_expr->expr_ident, m_atop);
 					m_expr = m_expr->ident_expression;
 					m_atop = NULL;
 
@@ -621,8 +628,8 @@ static struct symbol *do_initializer(struct symbol *type, struct expression *exp
 				}
 
 				if (m_atop) {
-					m_type = report_member(U_W_VAL, &m_expr->pos, m_type,
-							lookup_member(m_type, NULL, m_atop));
+					m_type = find_report_member(U_W_VAL, &m_expr->pos,
+								    m_type, NULL, m_atop);
 				}
 
 				if (m_expr->type != EXPR_INITIALIZER)
-- 
2.52.0


  reply	other threads:[~2026-06-05 14:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05 14:56 [PATCH 0/4] sparse/dissect: fix missing usage reports for unnamed members of named types Oleg Nesterov
2026-06-05 14:56 ` Oleg Nesterov [this message]
2026-06-05 14:56 ` [PATCH 2/4] sparse/dissect: fold lookup_member() into find_report_member() Oleg Nesterov
2026-06-05 14:56 ` [PATCH 3/4] sparse/dissect: introduce struct lookup_args for lookup_member() Oleg Nesterov
2026-06-05 14:56 ` [PATCH 4/4] sparse/dissect: fix missing usage reports for unnamed members of named types 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=aiLjqif9hlvb3VbP@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.