From: Linus Torvalds <torvalds@linux-foundation.org>
To: Blaisorblade <blaisorblade@yahoo.it>
Cc: Sparse ML <linux-sparse@vger.kernel.org>
Subject: Re: BUG: sparse redeclaration warning when assigning to a declared variable!
Date: Thu, 8 Mar 2007 10:06:30 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0703081003400.10832@woody.linux-foundation.org> (raw)
In-Reply-To: <200703081853.15693.blaisorblade@yahoo.it>
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
prev parent reply other threads:[~2007-03-08 18:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 17:53 BUG: sparse redeclaration warning when assigning to a declared variable! Blaisorblade
2007-03-08 18:06 ` Linus Torvalds [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0703081003400.10832@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=blaisorblade@yahoo.it \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).