diff mbox series

[v2,14/14] btrfs: Enable W=1 checks for btrfs

Message ID 20210120102526.310486-15-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series Make btrfs W=1 clean | expand

Commit Message

Nikolay Borisov Jan. 20, 2021, 10:25 a.m. UTC
Now that the btrfs' codebase is clean of W=1 warning let's enable those
checks unconditionally for the entire fs/btrfs/ and its subdirectories.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/Makefile | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Josef Bacik Jan. 20, 2021, 3:55 p.m. UTC | #1
On 1/20/21 5:25 AM, Nikolay Borisov wrote:
> Now that the btrfs' codebase is clean of W=1 warning let's enable those
> checks unconditionally for the entire fs/btrfs/ and its subdirectories.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Once this is enabled I get

fs/btrfs/zoned.c: In function ‘btrfs_sb_log_location_bdev’:
fs/btrfs/zoned.c:491:6: warning: variable ‘zone_size’ set but not used 
[-Wunused-but-set-variable]
   491 |  u64 zone_size;
       |      ^~~~~~~~~

on misc-next.  Thanks,

Josef
Nikolay Borisov Jan. 21, 2021, 7:31 a.m. UTC | #2
On 20.01.21 г. 17:55 ч., Josef Bacik wrote:
> On 1/20/21 5:25 AM, Nikolay Borisov wrote:
>> Now that the btrfs' codebase is clean of W=1 warning let's enable those
>> checks unconditionally for the entire fs/btrfs/ and its subdirectories.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> 
> Once this is enabled I get
> 
> fs/btrfs/zoned.c: In function ‘btrfs_sb_log_location_bdev’:
> fs/btrfs/zoned.c:491:6: warning: variable ‘zone_size’ set but not used
> [-Wunused-but-set-variable]
>   491 |  u64 zone_size;
>       |      ^~~~~~~~~
> 
> on misc-next.  Thanks,
> 

I know, I intentionally haven't fixed it since:

a)  David might be intending to merge other patches which will utilize
this member

b) It shows a genuine problem that this patchset has uncovered ( I even
mentioned this in the initial cover letter)


> Josef
>
David Sterba Jan. 24, 2021, 1:23 p.m. UTC | #3
On Thu, Jan 21, 2021 at 09:31:34AM +0200, Nikolay Borisov wrote:
> On 20.01.21 г. 17:55 ч., Josef Bacik wrote:
> > On 1/20/21 5:25 AM, Nikolay Borisov wrote:
> >> Now that the btrfs' codebase is clean of W=1 warning let's enable those
> >> checks unconditionally for the entire fs/btrfs/ and its subdirectories.
> >>
> >> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> > 
> > Once this is enabled I get
> > 
> > fs/btrfs/zoned.c: In function ‘btrfs_sb_log_location_bdev’:
> > fs/btrfs/zoned.c:491:6: warning: variable ‘zone_size’ set but not used
> > [-Wunused-but-set-variable]
> >   491 |  u64 zone_size;
> >       |      ^~~~~~~~~
> > 
> > on misc-next.  Thanks,
> > 
> 
> I know, I intentionally haven't fixed it since:
> 
> a)  David might be intending to merge other patches which will utilize
> this member

That's one possibility, but would show the warning until the zoned
patches get merged. I'd rather have a clean build once the W=1 build is
on.

I can insert a patch removing the variable, the zoned patches get still
rebased so that's fixable. Let me know if you want to send the patch as
it's from your series, or I can do that too.

> b) It shows a genuine problem that this patchset has uncovered ( I even
> mentioned this in the initial cover letter)

This should have been mentioned in the v2+ cover letter as well, along
with the version-to-version changelog.
diff mbox series

Patch

diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 9f1b1a88e317..44faee776027 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -1,5 +1,22 @@ 
 # SPDX-License-Identifier: GPL-2.0
 
+subdir-ccflags-y += -Wextra -Wunused -Wno-unused-parameter
+subdir-ccflags-y += -Wmissing-declarations
+subdir-ccflags-y += -Wmissing-format-attribute
+subdir-ccflags-y += -Wmissing-prototypes
+subdir-ccflags-y += -Wold-style-definition
+subdir-ccflags-y += -Wmissing-include-dirs
+subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
+subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
+subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
+subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
+# The following turn off the warnings enabled by -Wextra
+subdir-ccflags-y += -Wno-missing-field-initializers
+subdir-ccflags-y += -Wno-sign-compare
+subdir-ccflags-y += -Wno-type-limits
+
+cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
+
 obj-$(CONFIG_BTRFS_FS) := btrfs.o
 
 btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \