Re: [josef-btrfs:master 61/69] fs/btrfs/delayed-inode.c:393:1:warning: control reaches end of non-void function

From: Fengguang Wu
Date: Wed Jun 12 2013 - 23:19:03 EST


On Wed, Jun 12, 2013 at 12:32:11PM -0700, Zach Brown wrote:
> > fs/btrfs/delayed-inode.c: In function 'get_ins_del_root':
> > >> fs/btrfs/delayed-inode.c:393:1: warning: control reaches end of non-void function [-Wreturn-type]
> >
> > vim +393 fs/btrfs/delayed-inode.c
> >
> > 385 static struct rb_root *get_ins_del_root(struct btrfs_delayed_node *delayed_node,
> > 386 int ins_del)
> > 387 {
> > 388 if (ins_del == BTRFS_DELAYED_INSERTION_ITEM)
> > 389 return &delayed_node->ins_root;
> > 390 if (ins_del == BTRFS_DELAYED_DELETION_ITEM)
> > 391 return &delayed_node->del_root;
> > 392 BUG();
> > > 393 }
>
> Hrmph.
>
> Is this false positive worth working around? What version of gcc is
> this from?

gcc (Debian 4.7.1-6) 4.7.1

> I'd expect the unreachable() in BUG() to silence this
> warning on modern gcc.

Yeah it's strange why gcc still complain about that. Anyway I'll
detect and ignore this kind of false positive in my report scripts.

Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/