Thread (8 messages) 8 messages, 5 authors, 2021-09-20

Re: [PATCH] btrfs: fix initialiser warning in fs/btrfs/tree-checker.c

From: Qu Wenruo <hidden>
Date: 2021-09-19 22:57:40


On 2021/9/20 06:46, Russell King (Oracle) wrote:
On Mon, Sep 20, 2021 at 06:44:58AM +0800, Qu Wenruo wrote:
quoted

On 2021/9/20 06:40, Russell King (Oracle) wrote:
quoted
Debian gcc 10.2.1 complains thusly:

fs/btrfs/tree-checker.c:1071:9: warning: missing braces
around initializer [-Wmissing-braces]
    struct btrfs_root_item ri = { 0 };
           ^
fs/btrfs/tree-checker.c:1071:9: warning: (near initialization for 'ri.inode') [-Wmissing-braces]

Fix it by removing the unnecessary '0' initialiser, leaving the
braces.
This should be a compiler bug.

= { 0 }; is completely fine here, in fact = { }; would be more problematic.

What's the compiler version? I haven't hit such problem for GCC 11.1.0
nor clang 12.0.1.
I just realised that it's not the compiler I thought it was - It's
GCC 4.9.4 used on 32-bit ARM.
That's bare minimal GCC version required for kernel build.

I'm not sure if that old version has all the correct backports.
= { }; is not a problem for that version of GCC. Why do you think it's
problematic?
Isn't initialization with empty initializers against C89/90 standard?

Thanks,
Qu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help