aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-04-02 10:24:35 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:00:03 -0700
commitb1f9e93e9137ab7a8462b9d89ac160e3aae4e81f (patch)
tree47911fabe194e0c5811e14efad774603ceb04cb8 /scope.c
parentAdd some limited attribute parsing. "packed", "aligned" and "type". (diff)
downloadsparse-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.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/scope.c b/scope.c
index 0cd4f0e..de240f0 100644
--- a/scope.c
+++ b/scope.c
@@ -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);
}