aboutsummaryrefslogtreecommitdiffstats
path: root/symbol.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-04-11 18:52:27 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:00:30 -0700
commit941fd98d91760b6a7e169c7d5ed13745fd5c08a3 (patch)
treeb9032f9508ba7fe0bf99c34392ad8fe36b2ec10e /symbol.c
parentaffb6d1c90f57ae80fab6b74d0272f7bc9cf683b (diff)
downloadsparse-941fd98d91760b6a7e169c7d5ed13745fd5c08a3.tar.gz
Oops. Bad scoping for iterators and switch() statements. We didn't
close the scope properly at the end (we started a new one instead). Make all non-static functions external. And always check the declarator against previous symbols when finding a new symbol. We want to verify that we don't have duplicates.
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/symbol.c b/symbol.c
index 670fd976..2c56ad15 100644
--- a/symbol.c
+++ b/symbol.c
@@ -267,6 +267,24 @@ struct symbol *examine_symbol_type(struct symbol * sym)
return sym;
}
+void check_declaration(struct symbol *sym)
+{
+ struct symbol *next = sym;
+
+ while ((next = next->next_id) != NULL) {
+ if (next->namespace != sym->namespace)
+ continue;
+ if (sym->scope == next->scope) {
+ sym->same_symbol = next;
+ return;
+ }
+ if (sym->ctype.modifiers & next->ctype.modifiers & MOD_EXTERN) {
+ sym->same_symbol = next;
+ return;
+ }
+ }
+}
+
void bind_symbol(struct symbol *sym, struct ident *ident, enum namespace ns)
{
struct scope *scope;