xfsprogs: turn on more warnings for the filesystem code we modify most
PATCH 1/2 xfsprogs: turn on more warnings for the filesystem code we modify most
From: Darrick J. Wong <[email protected]>
Signed-off-by "Darrick J. Wong" <[email protected]>
--- include/builddefs.in | 79 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 80 insertions(+), 3 deletions(-)
include/builddefs.in +78 -1
@@ -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
PATCH 2/2 xfsprogs: even more debug whining
From: Darrick J. Wong <[email protected]>
Yeah these should be consolidated
Signed-off-by "Darrick J. Wong" <[email protected]>
--- configure.ac | 2 ++ include/builddefs.in | 48 +++++++++++++++++++++++++++++++++++++++++++++++ m4/package_sanitizer.m4 | 14 ++++++++++++++ 3 files changed, 64 insertions(+)
configure.ac +2 -0
@@ -38,6 +38,8 @@ fi AC_PROG_CXX # no C++ build tools yet +AC_HAVE_X86_CFLAGS + AC_ARG_ENABLE(shared, [ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],, enable_shared=yes)
include/builddefs.in +48 -0
54 lines not on this page · raw message
m4/package_sanitizer.m4 +14 -0
@@ -71,3 +71,17 @@ AC_DEFUN([AC_HAVE_TRIVIAL_AUTO_VAR_INIT], CFLAGS="${OLD_CFLAGS}" AC_SUBST(autovar_init_cflags) ]) + +# Add arch-specific gcc flags if they exist +AC_DEFUN([AC_HAVE_X86_CFLAGS], + [ AC_MSG_CHECKING([if C compiler supports various x86 CFLAGS]) + OLD_CFLAGS="$CFLAGS" + TEST_CFLAGS="-fcf-protection=full -mshstk" + CFLAGS="$CFLAGS $TEST_CFLAGS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])] + [arch_cflags="$TEST_CFLAGS $arch_cflags"], + [AC_MSG_RESULT([no])]) + CFLAGS="${OLD_CFLAGS}" + AC_SUBST(arch_cflags) + ])