From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrey Albershteyn <aalbersh@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>, linux-xfs@vger.kernel.org
Subject: [PATCH 1/2] xfsprogs: turn on more warnings for the filesystem code we modify most
Date: Thu, 15 Oct 2026 07:46:10 -0700 [thread overview]
Message-ID: <20261015144610.GP2705364@frogsfrogsfrogs> (raw)
From: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
include/builddefs.in | 79 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 80 insertions(+), 3 deletions(-)
diff --git a/include/builddefs.in b/include/builddefs.in
index acdbc5c865768b..41076ddf389f82 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -21,6 +21,83 @@ BUILD_CFLAGS = @BUILD_CFLAGS@ -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
# only use what we calculate from the configured options above.
LDFLAGS =
+# Generate more debugging info
+WARNINGS += -femit-struct-debug-detailed=any
+WARNINGS += -fstack-usage
+
+# Base warnings(?)
+WARNINGS += -Wall
+WARNINGS += -Wpointer-sign
+WARNINGS += -Wuninitialized
+WARNINGS += -Wno-error=format= # dont trip on printf debugging
+
+# Fedora wants to modernize C...
+WARNINGS += -Wimplicit-int
+WARNINGS += -Wimplicit-function-declaration
+WARNINGS += -Wint-conversion
+WARNINGS += -Wstrict-prototypes
+WARNINGS += -Wold-style-definition
+
+# Derived from scripts/Makefile.extrawarn on 2023-09-12 (v6.6-rc1)
+
+# W=e
+WARNINGS += -Werror
+
+# W=1
+WARNINGS += -Wextra -Wunused -Wno-unused-parameter
+WARNINGS += -Wmissing-declarations
+WARNINGS += -Wrestrict
+WARNINGS += -Wmissing-format-attribute
+WARNINGS += -Wmissing-prototypes
+WARNINGS += -Wold-style-definition
+WARNINGS += -Wmissing-include-dirs
+WARNINGS += -Wunused-but-set-variable
+WARNINGS += -Wunused-const-variable
+WARNINGS += -Wpacked-not-aligned
+WARNINGS += -Wformat-overflow
+WARNINGS += -Wformat-truncation
+WARNINGS += -Wstringop-overflow
+WARNINGS += -Wstringop-truncation
+
+WARNINGS += -Wundef
+
+# W=2
+WARNINGS += -Wdisabled-optimization
+WARNINGS += -Wshadow
+WARNINGS += -Wlogical-op
+WARNINGS += -Wmissing-field-initializers
+WARNINGS += -Wtype-limits
+WARNINGS += -Wmaybe-uninitialized
+WARNINGS += -Wno-error=maybe-uninitialized # gcc 14.2 vs xfs_bmap.c
+#WARNINGS += -Wunused-macros # dont care about extra macros
+
+# W=3
+#WARNINGS += -Wbad-function-cast # pagecache
+#WARNINGS += -Wcast-align # hits char* to struct* casts on riscv64
+#WARNINGS += -Wcast-qual # rhashtable
+#WARNINGS += -Wconversion # everywhere
+#WARNINGS += -Wpacked # this whines about unnecesary __packed??
+#WARNINGS += -Wpadded # maple tree
+#WARNINGS += -Wpointer-arith # container_of
+#WARNINGS += -Wredundant-decls # ftrace
+#WARNINGS += -Wsign-compare # percpu
+#WARNINGS += -Wswitch-default # everywhere
+#WARNINGS += $(call cc-option, -Wpacked-bitfield-compat) # not a gcc thing
+
+# Stuff we need to fix in xfsprogs
+WARNINGS += -Wno-suggest-attribute=format # dont care about printf crap
+WARNINGS += -Wno-shadow # many programs have global variables
+WARNINGS += -Wno-missing-field-initializers # why is this even a problem?
+WARNINGS += -Wno-sign-compare # zomg so much macro
+WARNINGS += -Wno-dangling-pointer # gcc 12.2 bug
+
+WARNINGS += -Wno-error=type-limits # rtgroups patchset
+WARNINGS += -Wno-error=array-bounds # rtgroups patchset
+
+# Comment out for release builds
+CFLAGS += $(WARNINGS)
+BUILD_CFLAGS += $(WARNINGS)
+
LIBRT = @librt@
LIBUUID = @libuuid@
LIBURCU = @liburcu@
@@ -128,7 +205,7 @@ NEED_INTERNAL_STATMOUNT = @need_internal_statmount@
HAVE_FANOTIFY_MOUNTINFO = @have_fanotify_mountinfo@
HAVE_QUOTACTL_FD = @have_quotactl_fd@
-GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
+GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall -Werror -Wextra -Wno-unused-parameter
# -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
# _LGPL_SOURCE is for liburcu to work correctly with GPL/LGPL programs
next reply other threads:[~2026-10-15 14:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 14:46 Darrick J. Wong [this message]
2026-10-15 14:51 ` [PATCH 2/2] xfsprogs: even more debug whining Darrick J. Wong
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=20261015144610.GP2705364@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox