All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dissect: simplify lookup_member()
@ 2006-12-14 21:37 Oleg Nesterov
  2007-02-27 18:40 ` Josh Triplett
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2006-12-14 21:37 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Christopher Li, linux-sparse

Change examine_sym_node() to recursively inspect the members of SYM_STRUCT.
This allows us to simplify lookup_member(): no need to do examine_sym_node(),
the member was already examined.

This is also good because now ->r_symdef(member) is called on declaration,
not when dissect detects the first usage of ->member.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- DS/dissect.c~	2006-04-20 23:49:03.000000000 +0400
+++ DS/dissect.c	2006-04-21 00:04:18.000000000 +0400
@@ -210,13 +210,16 @@ static void examine_sym_node(struct symb
 		case SYM_STRUCT: case SYM_UNION: //case SYM_ENUM:
 			if (base->evaluated)
 				return;
+			if (!base->symbol_list)
+				return;
+			base->evaluated = 1;
+
 			if (!base->ident && name)
 				base->ident = mk_name(root, name);
-			if (!base->ident || !base->symbol_list)
-				return;
-			if (reporter->r_symdef)
+			if (base->ident && reporter->r_symdef)
 				reporter->r_symdef(base);
-			base->evaluated = 1;
+			DO_LIST(base->symbol_list, mem,
+				examine_sym_node(mem, base->ident ?: root));
 		default:
 			return;
 		}
@@ -263,14 +266,8 @@ found:
 
 static struct symbol *lookup_member(struct symbol *type, struct ident *name, int *addr)
 {
-	struct symbol *node = __lookup_member(type, name, addr);
-
-	if (node != NULL)
-		examine_sym_node(node, type->ident);
-	else
-		node = no_member(name);
-
-	return node;
+	return __lookup_member(type, name, addr)
+		?: no_member(name);
 }
 
 static struct expression *peek_preop(struct expression *expr, int op)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-28  2:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14 21:37 [PATCH] dissect: simplify lookup_member() Oleg Nesterov
2007-02-27 18:40 ` Josh Triplett
2007-02-28  1:18   ` Pavel Roskin
2007-02-28  2:55     ` Git mirror delay Josh Triplett

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.