aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-06-17 23:39:16 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2007-06-18 05:25:40 -0400
commit791de79ac3473d23c020e3fc6ebebd173c8293a0 (patch)
tree2baa4a7ea0075e32e53b12a38f406f6195ce6e6d /symbol.c
parent[PATCH] rewrite of initializer handling (diff)
downloadsparse-791de79ac3473d23c020e3fc6ebebd173c8293a0.tar.gz
sparse-791de79ac3473d23c020e3fc6ebebd173c8293a0.tar.bz2
sparse-791de79ac3473d23c020e3fc6ebebd173c8293a0.zip
[PATCH] fix handling of typeof on structs
We really need it now; having a copy of struct symbol for our struct is no good. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/symbol.c b/symbol.c
index abdc734..329fed9 100644
--- a/symbol.c
+++ b/symbol.c
@@ -254,6 +254,8 @@ void merge_type(struct symbol *sym, struct symbol *base_type)
concat_ptr_list((struct ptr_list *)base_type->ctype.contexts,
(struct ptr_list **)&sym->ctype.contexts);
sym->ctype.base_type = base_type->ctype.base_type;
+ if (sym->ctype.base_type->type == SYM_NODE)
+ merge_type(sym, sym->ctype.base_type);
}
static int count_array_initializer(struct symbol *t, struct expression *expr)
@@ -408,7 +410,10 @@ struct symbol *examine_symbol_type(struct symbol * sym)
warning(base->pos, "typeof applied to bitfield type");
if (base->type == SYM_NODE)
base = base->ctype.base_type;
- if (base->type == SYM_RESTRICT) {
+ switch (base->type) {
+ case SYM_RESTRICT:
+ case SYM_UNION:
+ case SYM_STRUCT:
sym->type = SYM_NODE;
sym->ctype.modifiers = 0;
sym->ctype.base_type = base;