On Tue, 2 Aug 2005, Mitesh Shah wrote:
>
> How do I sparse multiple files? It seems that sparse builds up the tree for
> one file and there is no easy way to cleanup the global and static variables
> so that it can be called again for another file. Does anyone have any better
> idea?
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