Re: Structures from -include are "weak"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 08, 2007 at 06:42:18AM +0100, Al Viro wrote:
> {
> 	struct st;
> 	struct st *p;
> 	...
> 	struct st {....} x;
> 	...
> }
> 
> will make p a pointer to struct st from that scope.  If you omit it,
> p will be a pointer to struct st from the outer scope and x will have
> a different type.  Too late beginning of file scope, perhaps?

Gyah...  So it is.  We put the stuff from -include into builtin_scope
and start the file scope only in __sparse().

See if adding
int is_outer_scope(struct scope *scope)
{
	if (scope == block_scope)
		return 0;
	if (scope == &builtin_scope && block_scope->next == &builtin_scope)
		return 0;
	return 1;
}
to scope.c and replacing
		sym = lookup_symbol(token->ident, NS_STRUCT);
		if (!sym ||
		    (sym->scope != block_scope &&
		     (match_op(token->next,';') || match_op(token->next,'{')))) {
with
		sym = lookup_symbol(token->ident, NS_STRUCT);
		if (!sym ||
		    (is_outer_scope(sym->scope) &&
		     (match_op(token->next,';') || match_op(token->next,'{')))) {
in parse.c:struct_union_enum_specifier() would fix all problems of that kind.
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux