mbox series

[0/5] btrfs-progs: minor fixes for clang warnings

Message ID cover.1674797823.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs-progs: minor fixes for clang warnings | expand

Message

Qu Wenruo Jan. 27, 2023, 5:41 a.m. UTC
Recently I'm migrating my default compiler from GCC to clang, mostly to
get short comiling time (especially important on my aarch64 machines).

Thus I hit those (mostly false alerts) warnings in btrfs-progs, and come
up with this patchset.

Unfortunately there is still libbtrfsutils causing warnings in
setuptools, as it's still using the default flags from gcc no matter
what.

Qu Wenruo (5):
  btrfs-progs: remove an unnecessary branch to silent the clang warning
  btrfs-progs: fix a false alert on an uninitialized variable when
    BUG_ON() is involved.
  btrfs-progs: fix fallthrough cases with proper attributes
  btrfs-progs: move a union with variable sized type to the end
  btrfs-progs: fix set but not used variables

 cmds/reflink.c              |  2 +-
 cmds/scrub.c                | 12 +++---
 common/format-output.c      |  2 +-
 common/parse-utils.c        | 12 +++---
 common/units.c              |  6 +--
 crypto/xxhash.c             | 73 +++++++++++++++++++------------------
 image/main.c                | 15 +++-----
 kerncompat.h                |  8 ++++
 kernel-shared/ctree.c       | 18 +++++----
 kernel-shared/extent-tree.c |  4 +-
 kernel-shared/print-tree.c  |  2 +-
 kernel-shared/volumes.c     |  3 +-
 kernel-shared/zoned.c       |  6 +--
 mkfs/main.c                 |  4 --
 14 files changed, 84 insertions(+), 83 deletions(-)

Comments

Qu Wenruo Jan. 30, 2023, 7:28 a.m. UTC | #1
On 2023/1/27 13:41, Qu Wenruo wrote:
> Recently I'm migrating my default compiler from GCC to clang, mostly to
> get short comiling time (especially important on my aarch64 machines).

Just to mention, although the cleanup itself still makes sense, it 
doesn't make any sense to migrate to clang, at least on my aarch64 machines.

GCC takes only 22min for my trimmed kernel config, while the same config 
takes clang 32min...

Thanks,
Qu

> 
> Thus I hit those (mostly false alerts) warnings in btrfs-progs, and come
> up with this patchset.
> 
> Unfortunately there is still libbtrfsutils causing warnings in
> setuptools, as it's still using the default flags from gcc no matter
> what.
> 
> Qu Wenruo (5):
>    btrfs-progs: remove an unnecessary branch to silent the clang warning
>    btrfs-progs: fix a false alert on an uninitialized variable when
>      BUG_ON() is involved.
>    btrfs-progs: fix fallthrough cases with proper attributes
>    btrfs-progs: move a union with variable sized type to the end
>    btrfs-progs: fix set but not used variables
> 
>   cmds/reflink.c              |  2 +-
>   cmds/scrub.c                | 12 +++---
>   common/format-output.c      |  2 +-
>   common/parse-utils.c        | 12 +++---
>   common/units.c              |  6 +--
>   crypto/xxhash.c             | 73 +++++++++++++++++++------------------
>   image/main.c                | 15 +++-----
>   kerncompat.h                |  8 ++++
>   kernel-shared/ctree.c       | 18 +++++----
>   kernel-shared/extent-tree.c |  4 +-
>   kernel-shared/print-tree.c  |  2 +-
>   kernel-shared/volumes.c     |  3 +-
>   kernel-shared/zoned.c       |  6 +--
>   mkfs/main.c                 |  4 --
>   14 files changed, 84 insertions(+), 83 deletions(-)
>
hmsjwzb Jan. 30, 2023, 8:14 a.m. UTC | #2
Hi Qu,

	I think maybe clang has some optimization which GCC doesn't.

Thanks

On 1/30/23 02:28, Qu Wenruo wrote:
> 
> 
> On 2023/1/27 13:41, Qu Wenruo wrote:
>> Recently I'm migrating my default compiler from GCC to clang, mostly to
>> get short comiling time (especially important on my aarch64 machines).
> 
> Just to mention, although the cleanup itself still makes sense, it doesn't make any sense to migrate to clang, at least on my aarch64 machines.
> 
> GCC takes only 22min for my trimmed kernel config, while the same config takes clang 32min...
> 
> Thanks,
> Qu
> 
>>
>> Thus I hit those (mostly false alerts) warnings in btrfs-progs, and come
>> up with this patchset.
>>
>> Unfortunately there is still libbtrfsutils causing warnings in
>> setuptools, as it's still using the default flags from gcc no matter
>> what.
>>
>> Qu Wenruo (5):
>>    btrfs-progs: remove an unnecessary branch to silent the clang warning
>>    btrfs-progs: fix a false alert on an uninitialized variable when
>>      BUG_ON() is involved.
>>    btrfs-progs: fix fallthrough cases with proper attributes
>>    btrfs-progs: move a union with variable sized type to the end
>>    btrfs-progs: fix set but not used variables
>>
>>   cmds/reflink.c              |  2 +-
>>   cmds/scrub.c                | 12 +++---
>>   common/format-output.c      |  2 +-
>>   common/parse-utils.c        | 12 +++---
>>   common/units.c              |  6 +--
>>   crypto/xxhash.c             | 73 +++++++++++++++++++------------------
>>   image/main.c                | 15 +++-----
>>   kerncompat.h                |  8 ++++
>>   kernel-shared/ctree.c       | 18 +++++----
>>   kernel-shared/extent-tree.c |  4 +-
>>   kernel-shared/print-tree.c  |  2 +-
>>   kernel-shared/volumes.c     |  3 +-
>>   kernel-shared/zoned.c       |  6 +--
>>   mkfs/main.c                 |  4 --
>>   14 files changed, 84 insertions(+), 83 deletions(-)
>>
David Sterba Feb. 9, 2023, 7:26 p.m. UTC | #3
On Fri, Jan 27, 2023 at 01:41:13PM +0800, Qu Wenruo wrote:
> Recently I'm migrating my default compiler from GCC to clang, mostly to
> get short comiling time (especially important on my aarch64 machines).
> 
> Thus I hit those (mostly false alerts) warnings in btrfs-progs, and come
> up with this patchset.
> 
> Unfortunately there is still libbtrfsutils causing warnings in
> setuptools, as it's still using the default flags from gcc no matter
> what.
> 
> Qu Wenruo (5):
>   btrfs-progs: remove an unnecessary branch to silent the clang warning
>   btrfs-progs: fix a false alert on an uninitialized variable when
>     BUG_ON() is involved.
>   btrfs-progs: fix fallthrough cases with proper attributes
>   btrfs-progs: move a union with variable sized type to the end
>   btrfs-progs: fix set but not used variables

Added to devel, thanks.