Skip to content

Commit 2250c7e

Browse files
committed
drm/i915: enable W=1 warnings by default
We enable a bunch more compiler warnings than the kernel defaults. However, they've drifted to become a unique set of warnings, and have increasingly fallen behind from the W=1 set. Align with the W=1 warnings from scripts/Makefile.extrawarn for clarity, by copy-pasting them with s/KBUILD_CFLAGS/subdir-ccflags-y/ to make it easier to compare in the future. Some of the -Wextra warnings do need to be disabled, just like in Makefile.extrawarn, but take care to not disable them for W=2 or W=3 builds, depending on the warning. v2: Add back some -Wextra warning disables (Nathan) Cc: Arnd Bergmann <arnd@arndb.de> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org> [Final s/KBUILD_CFLAGS/subdir-ccflags-y/ fix while applying] Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/69a812273091b6535ddc7f9346289d71bb30f43d.1697009258.git.jani.nikula@intel.com
1 parent 7e1defa commit 2250c7e

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

drivers/gpu/drm/i915/Makefile

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,34 @@
33
# Makefile for the drm device driver. This driver provides support for the
44
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
55

6-
# Add a set of useful warning flags and enable -Werror for CI to prevent
7-
# trivial mistakes from creeping in. We have to do this piecemeal as we reject
8-
# any patch that isn't warning clean, so turning on -Wextra (or W=1) we
9-
# need to filter out dubious warnings. Still it is our interest
10-
# to keep running locally with W=1 C=1 until we are completely clean.
11-
#
12-
# Note the danger in using -Wextra is that when CI updates gcc we
13-
# will most likely get a sudden build breakage... Hopefully we will fix
14-
# new warnings before CI updates!
15-
subdir-ccflags-y := -Wextra
16-
subdir-ccflags-y += -Wno-unused-parameter
17-
subdir-ccflags-y += -Wno-type-limits
6+
# Unconditionally enable W=1 warnings locally
7+
# --- begin copy-paste W=1 warnings from scripts/Makefile.extrawarn
8+
subdir-ccflags-y += -Wextra -Wunused -Wno-unused-parameter
9+
subdir-ccflags-y += -Wmissing-declarations
10+
subdir-ccflags-y += $(call cc-option, -Wrestrict)
11+
subdir-ccflags-y += -Wmissing-format-attribute
12+
subdir-ccflags-y += -Wmissing-prototypes
13+
subdir-ccflags-y += -Wold-style-definition
14+
subdir-ccflags-y += -Wmissing-include-dirs
15+
subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
16+
subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
17+
subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
18+
subdir-ccflags-y += $(call cc-option, -Wformat-overflow)
19+
subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
20+
subdir-ccflags-y += $(call cc-option, -Wstringop-overflow)
21+
subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
22+
# The following turn off the warnings enabled by -Wextra
23+
ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
1824
subdir-ccflags-y += -Wno-missing-field-initializers
19-
subdir-ccflags-y += -Wno-sign-compare
25+
subdir-ccflags-y += -Wno-type-limits
2026
subdir-ccflags-y += -Wno-shift-negative-value
21-
subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
27+
endif
28+
ifeq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
29+
subdir-ccflags-y += -Wno-sign-compare
30+
endif
31+
# --- end copy-paste
32+
33+
# Enable -Werror in CI and development
2234
subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
2335

2436
# Fine grained warnings disable

0 commit comments

Comments
 (0)