linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: sparse redeclaration warning when assigning to a declared variable!
@ 2007-03-08 17:53 Blaisorblade
  2007-03-08 18:06 ` Linus Torvalds
  0 siblings, 1 reply; 2+ messages in thread
From: Blaisorblade @ 2007-03-08 17:53 UTC (permalink / raw)
  To: Sparse ML

What I saw running sparse on Linux source tree:

paolo [linux-2.6.20] $ make C=2 mm/page-writeback.o
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CHECK   scripts/mod/empty.c
  CHECK   mm/page-writeback.c
mm/page-writeback.c:912:9: warning: symbol 'ret' shadows an earlier one
mm/page-writeback.c:906:6: originally declared here
mm/page-writeback.c:919:9: warning: symbol 'ret' shadows an earlier one
mm/page-writeback.c:906:6: originally declared here
mm/page-writeback.c:933:9: warning: symbol 'ret' shadows an earlier one
mm/page-writeback.c:927:6: originally declared here
mm/page-writeback.c:944:9: warning: symbol 'ret' shadows an earlier one
mm/page-writeback.c:927:6: originally declared here
  CC      mm/page-writeback.o

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.

int test_set_page_writeback(struct page *page)
{
        struct address_space *mapping = page_mapping(page);
        int ret;

        if (mapping) {
                unsigned long flags;

                write_lock_irqsave(&mapping->tree_lock, flags);
                ret = TestSetPageWriteback(page);
                if (!ret)
                        radix_tree_tag_set(&mapping->page_tree,
                                                page_index(page),
                                                PAGECACHE_TAG_WRITEBACK);
                if (!PageDirty(page))
                        radix_tree_tag_clear(&mapping->page_tree,
                                                page_index(page),
                                                PAGECACHE_TAG_DIRTY);
                write_unlock_irqrestore(&mapping->tree_lock, flags);
        } else {
                ret = TestSetPageWriteback(page);
        }
        return ret;

}

Tested with both sparse v0.2 and my git HEAD, where I get:

sparse.git $ git-describe
0.2-41-g309f380

Bye
-- 
Inform me of my mistakes, so I can add them to my list!
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-08 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-08 17:53 BUG: sparse redeclaration warning when assigning to a declared variable! Blaisorblade
2007-03-08 18:06 ` Linus Torvalds

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).