diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-22 16:55:48 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:36 -0700 |
commit | 42a74cdbd860f9a0842bfc7eb46df5d8d342214b (patch) | |
tree | ff68f0bf3e635d1949a052f3c2543cff0b414f56 /symbol.c | |
parent | Add __sizeof_ptr__ that looks at a pointer expression and (diff) | |
download | sparse-42a74cdbd860f9a0842bfc7eb46df5d8d342214b.tar.gz sparse-42a74cdbd860f9a0842bfc7eb46df5d8d342214b.tar.bz2 sparse-42a74cdbd860f9a0842bfc7eb46df5d8d342214b.zip |
Make "bind_symbol()" also set sym->ident.
This way we're guaranteed to have all bound symbols with
proper idents, which wasn't true before (at least the
preprocessor macro code didn't set the identifier).
Diffstat (limited to 'symbol.c')
-rw-r--r-- | symbol.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -365,6 +365,9 @@ void bind_symbol(struct symbol *sym, struct ident *ident, enum 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; scope = block_scope; if (ns == NS_SYMBOL && toplevel(scope)) { @@ -382,7 +385,6 @@ struct symbol *create_symbol(int stream, const char *name, int type, int namespa struct token *token = built_in_token(stream, name); struct symbol *sym = alloc_symbol(token->pos, type); - sym->ident = token->ident; bind_symbol(sym, token->ident, namespace); return sym; } |