diff options
author | Alexey Zaytsev <alexey.zaytsev@gmail.com> | 2008-06-11 16:15:58 +0400 |
---|---|---|
committer | Josh Triplett <josh@freedesktop.org> | 2008-06-11 10:08:31 -0700 |
commit | 6a0698873c43e41c78abf3231c6d5a7863bda897 (patch) | |
tree | 369051d9f73d6a4f5e901b4348b36f46fe8a45d7 | |
parent | fix bug in context tracking code (diff) | |
download | sparse-6a0698873c43e41c78abf3231c6d5a7863bda897.tar.gz sparse-6a0698873c43e41c78abf3231c6d5a7863bda897.tar.bz2 sparse-6a0698873c43e41c78abf3231c6d5a7863bda897.zip |
Remove symbol.id_list
It was only used to check if the symbol was already bound, and would
cause significant complication in the serialization code.
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
-rw-r--r-- | scope.c | 2 | ||||
-rw-r--r-- | symbol.c | 4 | ||||
-rw-r--r-- | symbol.h | 3 |
3 files changed, 4 insertions, 5 deletions
@@ -64,7 +64,7 @@ void start_function_scope(void) static void remove_symbol_scope(struct symbol *sym) { - struct symbol **ptr = sym->id_list; + struct symbol **ptr = &sym->ident->symbols; while (*ptr != sym) ptr = &(*ptr)->next_id; @@ -539,7 +539,7 @@ void check_declaration(struct symbol *sym) void bind_symbol(struct symbol *sym, struct ident *ident, enum namespace ns) { struct scope *scope; - if (sym->id_list) { + if (sym->bound) { sparse_error(sym->pos, "internal error: symbol type already bound"); return; } @@ -550,10 +550,10 @@ void bind_symbol(struct symbol *sym, struct ident *ident, enum namespace ns) sym->namespace = ns; sym->next_id = ident->symbols; ident->symbols = sym; - sym->id_list = &ident->symbols; if (sym->ident && sym->ident != ident) warning(sym->pos, "Symbol '%s' already bound", show_ident(sym->ident)); sym->ident = ident; + sym->bound = 1; scope = block_scope; if (ns == NS_SYMBOL && toplevel(scope)) { @@ -110,12 +110,11 @@ extern int expand_constant_p(struct expression *expr, int cost); struct symbol { enum type type:8; enum namespace namespace:9; - unsigned char used:1, attr:2, enum_member:1; + unsigned char used:1, attr:2, enum_member:1, bound:1; struct position pos; /* Where this symbol was declared */ struct position endpos; /* Where this symbol ends*/ struct ident *ident; /* What identifier this symbol is associated with */ struct symbol *next_id; /* Next semantic symbol that shares this identifier */ - struct symbol **id_list; /* Back pointer to symbol list head */ struct symbol *replace; /* What is this symbol shadowed by in copy-expression */ struct scope *scope; union { |