Re: BUG: sparse redeclaration warning when assigning to a declared variable!

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

 




On Thu, 8 Mar 2007, Blaisorblade wrote:
>
> Code giving one of these warnings (kernel tree 2.6.20.1), other warnings are 
> like this. I.e.:
> ret = something()
> is seen as redeclaration.

No. Sparse is actually correct, but you didn't notice that there is 
*another* "ret" there.

See how TestClearPageWriteback() is declared in <linux/page-flags.h>. THAT 
is the "ret" that shadows an earlier one..

(And no, a macro should not use a common name like that - imagine if you 
call it with an argument that really is "struct page *ret", and thing what 
happens to the TestClearPageWritepage expansion..)

So sparse in this case does seem to be pointing out a potentially 
dangerous situation, where a macro declares a local variable with the same 
name as a user of that macro.

			Linus
-
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