public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Anand Jain <anand.jain@oracle.com>,
	Filipe Manana <fdmanana@suse.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] btrfs: avoid Wmaybe-uninitialized warnings
Date: Wed,  5 Jul 2023 16:01:08 +0200	[thread overview]
Message-ID: <20230705140117.795478-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

The -Wmaybe-uninitialized warning option in gcc produces tons of false
positive warnings when KASAN is enabled, as that turns off some required
optimizations.

Rework the makefile to only enable the warning in btrfs when KASAN is
disabled, as it was before commit 78a5255ffb6a1 ("Stop the ad-hoc games
with -Wno-maybe-initialized") turned it off globally.

Fixes: 1ec49744ba83f ("btrfs: turn on -Wmaybe-uninitialized")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/btrfs/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 90d53209755bf..a4927bf2ce7ee 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -11,8 +11,12 @@ condflags := \
 	$(call cc-option, -Wunused-but-set-variable)		\
 	$(call cc-option, -Wunused-const-variable)		\
 	$(call cc-option, -Wpacked-not-aligned)			\
-	$(call cc-option, -Wstringop-truncation)		\
-	$(call cc-option, -Wmaybe-uninitialized)
+	$(call cc-option, -Wstringop-truncation)
+
+ifndef CONFIG_KASAN
+conflags += $(call cc-option, -Wmaybe-uninitialized)
+endif
+
 subdir-ccflags-y += $(condflags)
 # The following turn off the warnings enabled by -Wextra
 subdir-ccflags-y += -Wno-missing-field-initializers
-- 
2.39.2


             reply	other threads:[~2023-07-05 14:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 14:01 Arnd Bergmann [this message]
2023-07-05 14:01 ` [PATCH 2/2] btrfs: fix 64-bit division link failure Arnd Bergmann
2023-07-10 17:06   ` David Sterba
2023-07-10 16:55 ` [PATCH 1/2] btrfs: avoid Wmaybe-uninitialized warnings David Sterba
2023-07-10 19:12   ` Arnd Bergmann
2023-07-10 19:25     ` Arnd Bergmann

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=20230705140117.795478-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=anand.jain@oracle.com \
    --cc=arnd@arndb.de \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wqu@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox