lkml.org 
[lkml]   [2019]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] btrfs: Turn an 'else if' into an 'else' in btrfs_uuid_tree_add
On Thu, Mar 7, 2019 at 9:54 AM David Sterba <dsterba@suse.cz> wrote:
>
> On Thu, Mar 07, 2019 at 09:35:15AM -0700, Nathan Chancellor wrote:
> > When building with -Wsometimes-uninitialized, Clang warns:
> >
> > fs/btrfs/uuid-tree.c:129:13: warning: variable 'eb' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> > fs/btrfs/uuid-tree.c:129:13: warning: variable 'offset' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> >
> > Clang can't tell that all cases are covered with this final else if.
>
> The chain of conditions is
>
> if (ret >= 0)
> else if (ret == -EEXIST)
> else if (ret < 0)

In the few cases we looked at, it seemed that the compiler's heuristic
for coverage doesn't try very hard. I assume once you start having
more complicated expressions is gets quite difficult to prove.

Thanks for the patch Nathan!
--
Thanks,
~Nick Desaulniers

\
 
 \ /
  Last update: 2019-03-07 19:00    [W:0.038 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site