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 <[EMAIL PROTECTED]>

--- 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)

-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to