Skip to content

Commit 39bf4de

Browse files
committed
drm/i915: Add -Wall -Wextra to our build, set warnings to full
Recently W=1 on gcc-7.2 (-Wunused-const-variable) caught a regression that had been lurking for 6 months, so lets try enabling the full set of warnings for CI builds. This means more patches will be rejected early that contain trivial and sometimes not so trivial bugs. However, our code does not yet compile cleanly with W=1, so we have to apply a filter to the set of warnings until we can eliminate the mistakes. It also means that developers will have to be running the full gamut of gcc to ensure that as warnings come and go with gcc updates, we have the CI build prepared. v2: Use fine-grained -Wno overrides. Inside the makefile, we can specify CFLAGS on a per-object level, which allows us to limit the scope of any particular warning override. v3: Place per-file overrides after the main enabling block. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Tomi Sarvela <tomi.p.sarvela@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171024181547.27889-1-chris@chris-wilson.co.uk Acked-by: Jani Nikula <jani.nikula@intel.com>
1 parent 3c75de5 commit 39bf4de

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

drivers/gpu/drm/i915/Makefile

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

5-
subdir-ccflags-$(CONFIG_DRM_I915_WERROR) := -Werror
5+
# Add a set of useful warning flags and enable -Werror for CI to prevent
6+
# trivial mistakes from creeping in. We have to do this piecemeal as we reject
7+
# any patch that isn't warning clean, so turning on -Wall -Wextra (or W=1) we
8+
# need to filter out dubious warnings. Still it is our interest
9+
# to keep running locally with W=1 C=1 until we are completely clean.
10+
#
11+
# Note the danger in using -Wall -Wextra is that when CI updates gcc we
12+
# will most likely get a sudden build breakage... Hopefully we will fix
13+
# new warnings before CI updates!
14+
subdir-ccflags-y := -Wall -Wextra
15+
subdir-ccflags-y += $(call cc-option,-Wno-unused-parameter,)
16+
subdir-ccflags-y += $(call cc-option,-Wno-type-limits,)
17+
subdir-ccflags-y += $(call cc-option,-Wno-missing-field-initializers,)
18+
subdir-ccflags-y += $(call cc-option,-Wno-implicit-fallthrough,)
19+
subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
20+
21+
# Fine grained warnings disable
22+
CFLAGS_i915_pci.o = $(call cc-option,-Wno-override-init,)
23+
CFLAGS_intel_fbdev.o = $(call cc-option,-Wno-override-init,)
24+
625
subdir-ccflags-y += \
726
$(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA)
827

0 commit comments

Comments
 (0)