aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Zaytsev <alexey.zaytsev@gmail.com>2008-06-11 16:15:58 +0400
committerJosh Triplett <josh@freedesktop.org>2008-06-11 10:08:31 -0700
commit6a0698873c43e41c78abf3231c6d5a7863bda897 (patch)
tree369051d9f73d6a4f5e901b4348b36f46fe8a45d7
parent6dcc36aec041ea5bb4b8d013d97aaa60d51c18df (diff)
downloadsparse-6a0698873c43e41c78abf3231c6d5a7863bda897.tar.gz
sparse-6a0698873c43e41c78abf3231c6d5a7863bda897.tar.xz
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.c2
-rw-r--r--symbol.c4
-rw-r--r--symbol.h3
3 files changed, 4 insertions, 5 deletions
diff --git a/scope.c b/scope.c
index f09c8e9..27e38bc 100644
--- a/scope.c
+++ b/scope.c
@@ -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;
diff --git a/symbol.c b/symbol.c
index 7539817..3292907 100644
--- a/symbol.c
+++ b/symbol.c
@@ -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)) {
diff --git a/symbol.h b/symbol.h
index 50fb86a..c4d7f28 100644
--- a/symbol.h
+++ b/symbol.h
@@ -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 {