aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-22 16:55:48 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:03:36 -0700
commit42a74cdbd860f9a0842bfc7eb46df5d8d342214b (patch)
treeff68f0bf3e635d1949a052f3c2543cff0b414f56 /symbol.c
parentAdd __sizeof_ptr__ that looks at a pointer expression and (diff)
downloadsparse-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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/symbol.c b/symbol.c
index bdcbb58..0c8cf3e 100644
--- a/symbol.c
+++ b/symbol.c
@@ -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;
}