Well, apart from the scope there are other issues as well. For example, with
the identifiers, input_streams, includepaths, hash_table, etc. All the
static initialization of idents and symbol_table_init is also causing
trouble. I think the correct approach would be to not initialize all these
things statically and cleanup before starting the next file. What do you
suggest?
Thanks,
-Mitesh
>
> The biggest problem (I _think_) is the scoping.
>
> Right now we have one top-level scope:
>
> static struct scope toplevel_scope = { .next = &toplevel_scope };
>
> struct scope *block_scope = &toplevel_scope,
> *function_scope = &toplevel_scope,
> *file_scope = &toplevel_scope;
>
> and you'd basically need to allocate one scope per file parsed.
>
> I'm sure that there are other issues too, but you could try starting by
> changing "toplevel_scope" into pointer to a scope instead of being
> statically allocated, and do something like
>
> static void start_new_file(void)
> {
> struct scope *scope = __alloc_scope(0);
> memset(scope, 0, sizeof(*scope));
> scope.next = scope;
> toplevel_scope = scope;
> block_scope = scope;
> function_scope = scope;
> file_scope = scope;
> }
>
> and then you make sure to call that at the beginning of every new C file.
>
> Then you just have to debug the fallout ;)
>
> I'm sure there are other things that will need fixing, but I really think
> that the above should get you pretty far toward your goal..
>
> Linus
>
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html