diff options
author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-02 10:24:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:00:03 -0700 |
commit | b1f9e93e9137ab7a8462b9d89ac160e3aae4e81f (patch) | |
tree | 47911fabe194e0c5811e14efad774603ceb04cb8 /scope.c | |
parent | Add some limited attribute parsing. "packed", "aligned" and "type". (diff) | |
download | sparse-b1f9e93e9137ab7a8462b9d89ac160e3aae4e81f.tar.gz sparse-b1f9e93e9137ab7a8462b9d89ac160e3aae4e81f.tar.bz2 sparse-b1f9e93e9137ab7a8462b9d89ac160e3aae4e81f.zip |
Expose scoping to symbol binders - we'll need this to check
whether it is a re-definition (ie new declaration in the same
scope).
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -12,16 +12,14 @@ #include "symbol.h" #include "scope.h" -static struct scope - base_scope = { .next = &base_scope }, - *block_scope = &base_scope, - *function_scope = &base_scope; +static struct scope toplevel_scope = { .next = &toplevel_scope }; -void bind_scope(struct symbol *sym) +struct scope *block_scope = &toplevel_scope, + *function_scope = &toplevel_scope, + *file_scope = &toplevel_scope; + +void bind_scope(struct symbol *sym, struct scope *scope) { - struct scope *scope = block_scope; - if (sym->namespace == NS_LABEL) - scope = function_scope; add_symbol(&scope->symbols, sym); } |