Re: [PATCH] btrfs: Fix backref.c selftest compilation warning

From: Qu Wenruo
Date: Sun Apr 12 2020 - 01:05:34 EST




On 2020/4/12 äå11:21, Tang Bin wrote:
> Hi Qu:
>
> On 2020/4/12 8:52, Qu Wenruo wrote:
>>
>> On 2020/4/11 äå11:49, Tang Bin wrote:
>>> Fix missing braces compilation warning in the ARM
>>> compiler environment:
>>> ÂÂÂÂ fs/btrfs/backref.c: In function âis_shared_data_backrefâ:
>>> ÂÂÂÂ fs/btrfs/backref.c:394:9: warning: missing braces around
>>> initializer [-Wmissing-braces]
>>> ÂÂÂÂÂÂ struct prelim_ref target = {0};
>>> ÂÂÂÂ fs/btrfs/backref.c:394:9: warning: (near initialization for
>>> âtarget.rbnodeâ) [-Wmissing-braces]
>> GCC version please.
>>
>> It looks like you're using an older GCC, as it's pretty common certain
>> prebuild tool chain is still using outdated GCC.
>>
>> In my environment with GCC 9.2.0 natively (on aarch64) it's completely
>> fine.
>> Thus personally I recommend to build your own tool chain using
>> buildroot, or run it natively, other than rely on prebuilt one.
>
> My environment:
>
> Â PC : Ubuntu 16.04
>
> Â Hardware : I.MX6ULL
>
> Â Tool Chain : arm-linux-gnueabihf-gcc (Linaro GCC 4.9-2017.01) 4.9.4

That's pretty old.

You'd better fetch the newer version, as newer kernel may require higher
version gcc.

Or even build your own using tools like buildroot.

Thanks,
Qu

>
>>
>> In fact your fix could cause problem, as the original code is
>> initializing all members to 0, but now it's uninitialized.
>>
>> You need to locate the root cause other than blindly follow the warning.
>
> In hardware experiment, this approach is feasible.
>
> Thanks.
>
> Tang Bin
>
>>
>>
>
>

Attachment: signature.asc
Description: OpenPGP digital signature