All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: fix all -Wshadow warnings and enable -Wshadow for default builds
Date: Mon, 11 Sep 2023 20:10:31 +0930	[thread overview]
Message-ID: <cover.1694428549.git.wqu@suse.com> (raw)

Recently David fixes quite some errno usage in kernel code, to avoid
overwriting user space @errno variable.

This inspired me that, those problems can be detected by -Wshadow, thus
let's enable -Wshadow for default builds.

The biggest cause of -Wshadow warnings is min()/max() which all uses the
same __x and __y.
To fix that, pull the kernel version with the usage of __UNIQUE_ID() to
address the problem.

The remaining ones are mostly bad namings and harmless, but there is
still some bad ones, detailed in the 2nd patch.

Tested with both GCC 13.2.1 and Clang 16.0.6, the first one is fully
clean, the latter one has some unrelated warnings, but no -Wshadow
warnings.

Qu Wenruo (3):
  btrfs-progs: pull in the full max/min/clamp implementation from kernel
  btrfs-progs: fix all variable shadowing
  btrfs-progs: enable -Wshadow for default build

 Makefile                     |   3 +-
 Makefile.extrawarn           |   1 -
 check/main.c                 |   6 +-
 check/mode-lowmem.c          |   4 +-
 check/qgroup-verify.c        |  23 +++---
 check/repair.c               |   7 +-
 cmds/filesystem-usage.c      |   8 +-
 cmds/subvolume-list.c        |   2 +-
 common/internal.h            | 147 +++++++++++++++++++++++++++++++----
 image/image-restore.c        |  10 +--
 kernel-shared/async-thread.c |   2 +-
 kernel-shared/extent-tree.c  |   1 -
 tune/change-csum.c           |  10 +--
 13 files changed, 167 insertions(+), 57 deletions(-)

--
2.42.0


WARNING: multiple messages have this Message-ID (diff)
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: fix all -Wshadow warnings and enable -Wshadow for default builds
Date: Tue, 12 Sep 2023 09:05:22 +0930	[thread overview]
Message-ID: <cover.1694428549.git.wqu@suse.com> (raw)
Message-ID: <20230911233522.ayoqy_DGHMHpxRdFykUynu6QkUW2PCKVkomWPdIESvk@z> (raw)

Recently David fixes quite some errno usage in kernel code, to avoid
overwriting user space @errno variable.

This inspired me that, those problems can be detected by -Wshadow, thus
let's enable -Wshadow for default builds.

The biggest cause of -Wshadow warnings is min()/max() which all uses the
same __x and __y.
To fix that, pull the kernel version with the usage of __UNIQUE_ID() to
address the problem.

The remaining ones are mostly bad namings and harmless, but there is
still some bad ones, detailed in the 2nd patch.

Tested with both GCC 13.2.1 and Clang 16.0.6, the first one is fully
clean, the latter one has some unrelated warnings, but no -Wshadow
warnings.

Qu Wenruo (3):
  btrfs-progs: pull in the full max/min/clamp implementation from kernel
  btrfs-progs: fix all variable shadowing
  btrfs-progs: enable -Wshadow for default build

 Makefile                     |   3 +-
 Makefile.extrawarn           |   1 -
 check/main.c                 |   6 +-
 check/mode-lowmem.c          |   4 +-
 check/qgroup-verify.c        |  23 +++---
 check/repair.c               |   7 +-
 cmds/filesystem-usage.c      |   8 +-
 cmds/subvolume-list.c        |   2 +-
 common/internal.h            | 147 +++++++++++++++++++++++++++++++----
 image/image-restore.c        |  10 +--
 kernel-shared/async-thread.c |   2 +-
 kernel-shared/extent-tree.c  |   1 -
 tune/change-csum.c           |  10 +--
 13 files changed, 167 insertions(+), 57 deletions(-)

--
2.42.0


             reply	other threads:[~2023-09-11 22:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 10:40 Qu Wenruo [this message]
2023-09-11 23:35 ` [PATCH 0/3] btrfs-progs: fix all -Wshadow warnings and enable -Wshadow for default builds Qu Wenruo
2023-09-11 10:40 ` [PATCH 1/3] btrfs-progs: pull in the full max/min/clamp implementation from kernel Qu Wenruo
2023-09-11 23:35   ` Qu Wenruo
2023-09-11 10:40 ` [PATCH 2/3] btrfs-progs: fix all variable shadowing Qu Wenruo
2023-09-11 23:35   ` Qu Wenruo
2023-09-11 10:40 ` [PATCH 3/3] btrfs-progs: enable -Wshadow for default build Qu Wenruo
2023-09-11 23:35   ` Qu Wenruo
2023-10-06 16:33 ` [PATCH 0/3] btrfs-progs: fix all -Wshadow warnings and enable -Wshadow for default builds David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1694428549.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.